]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] smp_call_function_single() check that local interrupts are enabled
authorAndrew Morton <akpm@osdl.org>
Thu, 7 Dec 2006 04:38:16 +0000 (20:38 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 7 Dec 2006 16:39:39 +0000 (08:39 -0800)
smp_call_function_single() can deadlock if the caller disabled local
interrupts (the target CPU could be spinning on call_lock).  Check for that.

Why on earth do these functions use spin_lock_bh()??

Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Andi Kleen <ak@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/smp.c
arch/x86_64/kernel/smp.c

index 31e5c6573aae450b3a1f94fe7129de94fc4ea26e..9827cf927ecb2c49223d6bc856a15c48151a5e06 100644 (file)
@@ -699,6 +699,10 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                put_cpu();
                return -EBUSY;
        }
+
+       /* Can deadlock when called with interrupts disabled */
+       WARN_ON(irqs_disabled());
+
        spin_lock_bh(&call_lock);
        __smp_call_function_single(cpu, func, info, nonatomic, wait);
        spin_unlock_bh(&call_lock);
index 9f74c883568c419909b6542449161d5b109f6b51..32f4d7e2a0608119467058968bae73bf0bd7ee4f 100644 (file)
@@ -379,6 +379,10 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
                put_cpu();
                return 0;
        }
+
+       /* Can deadlock when called with interrupts disabled */
+       WARN_ON(irqs_disabled());
+
        spin_lock_bh(&call_lock);
        __smp_call_function_single(cpu, func, info, nonatomic, wait);
        spin_unlock_bh(&call_lock);