• Rusty Russell's avatar
    [PATCH] smp_call_function doco fix · 57078435
    Rusty Russell authored
    Trivial patch update against 2.5.17:
    dipankar@in.ibm.com: smp_call_function change:
      My earlier patch fixed only i386. As per Dave Miller's suggestion,
      I have fixed smp_call_function for other smp architectures too.
    
      Description
      -----------
      Going by the documentation and use of _bh version of spin_lock(),
      smp_call_function() is allowed to be called from BH context,
      We can run into a deadlock with some locks if we do so.
      This because reader-writer locks can sometimes be used optimally
      by not disabling irqs while taking the reader side if only the
      reader side of the lock is taken from irq context.
    
            CPU #0                                CPU #1
    
            read_lock(&tasklist_lock)
                                             write_lock_irq(&tasklist_lock)
                                             [spins with interrupt disabled]
            [Interrupted by BH]
            smp_call_function() for BH
                 handler
                                             [ doesn't take the IPI]
    
      So, cpu #1 doesn't take the IPI and cpu #0 spinwaits
      for the IPI handler to start, resulting in a deadlock.
    
      The last time I looked, I couldn't see smp_call_function() being
      called from BH context anywhere. So, there is no immediate problem.
      However it seems right to correct the documentation and also not
      disable BH while taking the call lock since it isn't necessary.
      This patch does exactly that.
    
      Thanks
      --
      Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
      Linux Technology Center, IBM Software Lab, Bangalore, India.
    
      smp_call_func-2.5.14-1.patch
      ----------------------------
    57078435
smp.c 8.19 KB