summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-10-09 08:07:49 +0000
committeravg <avg@FreeBSD.org>2010-10-09 08:07:49 +0000
commitdca49a4289ccc5a7ea6ff861c2ca2608feb62d4d (patch)
tree8f27163c84470743ae9bc2f9adeede8d0c638f89 /sys/kern/kern_shutdown.c
parent77a8584fd98601764683b95454ea91ac9d1050de (diff)
downloadFreeBSD-src-dca49a4289ccc5a7ea6ff861c2ca2608feb62d4d.zip
FreeBSD-src-dca49a4289ccc5a7ea6ff861c2ca2608feb62d4d.tar.gz
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
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 018bd8e..0f14623 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -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;
OpenPOWER on IntegriCloud