svn commit: r213648 - head/sys/kern
Andriy Gapon
avg at FreeBSD.org
Sat Oct 9 08:07:50 UTC 2010
Author: avg
Date: Sat Oct 9 08:07:49 2010
New Revision: 213648
URL: http://svn.freebsd.org/changeset/base/213648
Log:
panic_cpu variable should be volatile
This is to prevent caching of its value in a register when it is checked
and modified by multiple CPUs in parallel.
Also, move the variable into the scope of the only function that uses it.
Reviewed by: jhb
Hint from: mdf
MFC after: 1 week
Modified:
head/sys/kern/kern_shutdown.c
Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c Sat Oct 9 07:45:24 2010 (r213647)
+++ head/sys/kern/kern_shutdown.c Sat Oct 9 08:07:49 2010 (r213648)
@@ -513,10 +513,6 @@ shutdown_reset(void *junk, int howto)
/* NOTREACHED */ /* assuming reset worked */
}
-#ifdef SMP
-static u_int panic_cpu = NOCPU;
-#endif
-
/*
* Panic is called on unresolvable fatal errors. It prints "panic: mesg",
* and then reboots. If we are called twice, then we avoid trying to sync
@@ -525,6 +521,9 @@ static u_int panic_cpu = NOCPU;
void
panic(const char *fmt, ...)
{
+#ifdef SMP
+ static volatile u_int panic_cpu = NOCPU;
+#endif
struct thread *td = curthread;
int bootopt, newpanic;
va_list ap;
More information about the svn-src-all
mailing list