PERFORCE change 150719 for review
John Baldwin
jhb at FreeBSD.org
Tue Sep 30 19:06:28 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=150719
Change 150719 by jhb at jhb_mutex on 2008/09/30 19:05:42
Drop these diffs. I think the critical section fixes this
already.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_shutdown.c#72 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_shutdown.c#72 (text+ko) ====
@@ -495,7 +495,7 @@
}
#ifdef SMP
-static volatile uintptr_t panic_thread;
+static u_int panic_cpu = NOCPU;
#endif
/*
@@ -510,23 +510,20 @@
int bootopt, newpanic;
va_list ap;
static char buf[256];
-#ifdef SMP
- uintptr_t tid;
-#endif
critical_enter();
#ifdef SMP
/*
* We don't want multiple CPU's to panic at the same time, so we
- * use panic_thread as a simple spinlock. We have to keep checking
- * panic_thread if we are spinning in case the panic on the first
+ * use panic_cpu as a simple spinlock. We have to keep checking
+ * panic_cpu if we are spinning in case the panic on the first
* CPU is canceled.
*/
- tid = (uintptr_t)td;
- if (panic_thread != tid)
- while (atomic_cmpset_ptr(&panic_thread, 0, tid) == 0)
- while (panic_thread != 0)
- cpu_spinwait();
+ if (panic_cpu != PCPU_GET(cpuid))
+ while (atomic_cmpset_int(&panic_cpu, NOCPU,
+ PCPU_GET(cpuid)) == 0)
+ while (panic_cpu != NOCPU)
+ ; /* nothing */
#endif
bootopt = RB_AUTOBOOT | RB_DUMP;
@@ -562,7 +559,7 @@
/* See if the user aborted the panic, in which case we continue. */
if (panicstr == NULL) {
#ifdef SMP
- atomic_store_rel_ptr(&panic_thread, 0);
+ atomic_store_rel_int(&panic_cpu, NOCPU);
#endif
return;
}
More information about the p4-projects
mailing list