Module Name:    src
Committed By:   bouyer
Date:           Tue May  5 20:26:36 UTC 2009

Modified Files:
        src/sys/kern: kern_softint.c

Log Message:
Declare sh_flags volatile.
Without it, on ports where splhigh() is inline, the compiler will optimise
the second SOFTINT_PENDING test in softint_schedule(). A dissasembly
of softint_schedule() with and without the volatile sh_flags confirm this
on sparc.
Because of this there is a race that could lead to the softhand_t
being enqueued twice on si_q, leading to a corrupted queue and
some handler being SOFTINT_PENDING but never called.

Should fix PR kern/38637


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/kern/kern_softint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_softint.c
diff -u src/sys/kern/kern_softint.c:1.26 src/sys/kern/kern_softint.c:1.27
--- src/sys/kern/kern_softint.c:1.26	Mon Apr  6 21:22:47 2009
+++ src/sys/kern/kern_softint.c	Tue May  5 20:26:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_softint.c,v 1.26 2009/04/06 21:22:47 dyoung Exp $	*/
+/*	$NetBSD: kern_softint.c,v 1.27 2009/05/05 20:26:36 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -176,7 +176,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.26 2009/04/06 21:22:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.27 2009/05/05 20:26:36 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -210,7 +210,7 @@
 	void			(*sh_func)(void *);
 	void			*sh_arg;
 	softint_t		*sh_isr;
-	u_int			sh_flags;
+	volatile u_int		sh_flags;
 } softhand_t;
 
 typedef struct softcpu {

Reply via email to