Re2: panic: cpu_switch: not SRUN

Matthew Dillon dillon at
Mon Sep 15 19:35:06 PDT 2003

:I've been getting these panics under moderate load,
:panic: cpu_switch: not SRUN
:   David P. Reese, Jr.                                     daver at xxxxxxxxxxxx

    Here.  Before you waste time trying to get a core dump, please try this
    patch.  I believe what is happening is that a user program is calling
    exit1() and an interrupt is preempting it just after exit1() sets
    p_stat to SZOMB.  This is perfectly legal to do and the DIAGNOSTIC code
    is improperly panicing.  

    That's my guess, anyway.  If the patch solves the problem then we will
    know that is what it was.


Index: i386/i386/genassym.c
RCS file: /cvs/src/sys/i386/i386/genassym.c,v
retrieving revision 1.28
diff -u -r1.28 genassym.c
--- i386/i386/genassym.c	7 Aug 2003 21:17:22 -0000	1.28
+++ i386/i386/genassym.c	16 Sep 2003 02:31:13 -0000
@@ -104,6 +104,7 @@
 ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
 ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
 ASSYM(V_SENDSYS, offsetof(struct vmmeter, v_sendsys));
Index: i386/i386/swtch.s
RCS file: /cvs/src/sys/i386/i386/swtch.s,v
retrieving revision 1.26
diff -u -r1.26 swtch.s
--- i386/i386/swtch.s	7 Aug 2003 21:17:22 -0000	1.26
+++ i386/i386/swtch.s	16 Sep 2003 02:31:52 -0000
@@ -228,7 +228,10 @@
 	movl	TD_PROC(%eax),%ecx
 	cmpb	$SRUN,P_STAT(%ecx)
+	je	1f
+	cmpb	$SZOMB,P_STAT(%ecx)
 	jne	badsw2
 #if defined(SWTCH_OPTIM_STATS)

More information about the Bugs mailing list