Subject: SA i386 SMP deadlock
To: None <port-i386@NetBSD.org>
From: Stephan Uphoff <ups@stups.com>
List: port-i386
Date: 08/10/2003 17:37:20
The patch below fixes the following deadlock:

sa_switch() running on CPU A tries to save thread context while holding 
the scheduler lock and saving the context requires a CPU crosscall
to CPU B to save the FPU state.

cpu_switch() running on CPU B tries to acquire the scheduler lock while 
blocking all interrupts.

	Stephan


Index: locore.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/locore.S,v
retrieving revision 1.13
diff -u -r1.13 locore.S
--- locore.S    2003/08/08 20:14:06     1.13
+++ locore.S    2003/08/10 21:20:40
@@ -1794,7 +1794,8 @@
        cli
        cmpl    $0,_C_LABEL(sched_whichqs)
        jz      idle_loop
-idle_exit:     
+idle_exit:
+       sti
        movl    $IPL_HIGH,CPUVAR(ILEVEL)                # splhigh
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)      
        call    _C_LABEL(sched_lock_idle)