Module Name: src Committed By: ad Date: Sun Jun 28 09:25:05 UTC 2009
Modified Files: src/sys/kern: kern_idle.c Log Message: idle_loop: explicitly go to spl0() to sidestep potential MD bugs. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/kern/kern_idle.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_idle.c diff -u src/sys/kern/kern_idle.c:1.21 src/sys/kern/kern_idle.c:1.22 --- src/sys/kern/kern_idle.c:1.21 Wed Jun 11 13:42:02 2008 +++ src/sys/kern/kern_idle.c Sun Jun 28 09:25:05 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_idle.c,v 1.21 2008/06/11 13:42:02 ad Exp $ */ +/* $NetBSD: kern_idle.c,v 1.22 2009/06/28 09:25:05 ad Exp $ */ /*- * Copyright (c)2002, 2006, 2007 YAMAMOTO Takashi, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.21 2008/06/11 13:42:02 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.22 2009/06/28 09:25:05 ad Exp $"); #include <sys/param.h> #include <sys/cpu.h> @@ -48,7 +48,6 @@ struct cpu_info *ci = curcpu(); struct schedstate_percpu *spc; struct lwp *l = curlwp; - int s; ci->ci_data.cpu_onproc = l; @@ -57,10 +56,15 @@ binuptime(&l->l_stime); lwp_unlock(l); + /* + * Use spl0() here to ensure that we have the correct interrupt + * priority. This may be the first thread running on the CPU, + * in which case we took a dirtbag route to get here. + */ spc = &ci->ci_schedstate; - s = splsched(); + (void)splsched(); spc->spc_flags |= SPCF_RUNNING; - splx(s); + spl0(); KERNEL_UNLOCK_ALL(l, NULL); l->l_stat = LSONPROC;