From: Andrea Arcangeli <andrea@suse.de>

This patch avoids a lockup with kernel.panic sysctl > 0, due an underflow
of the number of the cpus.

Later, Andrea said:

 While this still seems a needed fix, unfortunately this wasn't enough to
 fix the problem (the first positive report I got was because they did a
 mistake and they tested an UP kernel, oh well ;).

 Anyway the smp_stop_cpu executed by the cpu that invoked panic is wrong
 and it really causes an underflow of the number of cpus that can lead to
 further lockups. So I don't want to stop you from merging it since it
 seems a correct fix and it brings x86-64 in line with the x86 code too.

 But apparently we need something more than this too.


Signed-off-by: Andrea Arcangeli <andrea@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/x86_64/kernel/smp.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN arch/x86_64/kernel/smp.c~x86_64-avoid-panic-lockup arch/x86_64/kernel/smp.c
--- 25/arch/x86_64/kernel/smp.c~x86_64-avoid-panic-lockup	Wed Mar 30 13:36:46 2005
+++ 25-akpm/arch/x86_64/kernel/smp.c	Wed Mar 30 13:36:46 2005
@@ -373,7 +373,10 @@ void smp_send_stop(void)
 	__smp_call_function(smp_really_stop_cpu, NULL, 0, 0);
 	if (!nolock)
 		spin_unlock(&call_lock);
-	smp_stop_cpu();
+
+	local_irq_disable();
+	disable_local_APIC();
+	local_irq_enable();
 }
 
 /*
_