[patch] 2.6.5 BUG if smp_call_function is called with interrupts disabled

From: Keith Owens <kaos_at_sgi.com>
Date: 2004-04-27 10:09:39
There is a nasty race if smp_call_function() is called with interrupts

CPU A                               CPU B
Disable interrupts
                                    Take call_lock
                                    Send IPIs
                                    Wait for all cpus to acknowledge IPI
                                    CPU A has not responded, spin waiting
                                    for cpu A to respond, holding call_lock
Spin waiting for call_lock
Deadlock                            Deadlock

This bug is hard to reproduce and even harder to diagnose.  Since the
comments at the start of smp_call_function() say it should never be
entered with interrupts disabled, make it so.

Index: linux/arch/ia64/kernel/smp.c
--- linux.orig/arch/ia64/kernel/smp.c	Mon Apr 26 15:20:17 2004
+++ linux/arch/ia64/kernel/smp.c	Tue Apr 27 09:56:55 2004
@@ -319,10 +319,14 @@
 	struct call_data_struct data;
 	int cpus = num_online_cpus()-1;
+	unsigned long psr;
 	if (!cpus)
 		return 0;
+	__asm__ __volatile__ ("mov %0=psr;; " : "=r" (psr));
+	BUG_ON(!(psr & IA64_PSR_I));
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Apr 26 20:10:07 2004

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:25 EST