[PATCH] smp_call_function doco fix
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 22 May 2002 05:23:59 +0000 (22:23 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 22 May 2002 05:23:59 +0000 (22:23 -0700)
commit57078435cabebaad6c4590e1340c01e3c17a46a8
treef679fac2ac542341d309c493973ae6a732d2b199
parent87c2543780d197d268c09302fcb408a2afe8ff0b
[PATCH] smp_call_function doco fix

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
  ----------------------------
arch/alpha/kernel/smp.c
arch/i386/kernel/smp.c
arch/ia64/kernel/smp.c
arch/mips/kernel/smp.c
arch/ppc/kernel/smp.c
arch/ppc64/kernel/smp.c
arch/s390/kernel/smp.c
arch/s390x/kernel/smp.c
arch/sparc64/kernel/smp.c
arch/x86_64/kernel/smp.c