PERFORCE change 74128 for review
John Baldwin
jhb at FreeBSD.org
Wed Mar 30 14:04:01 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=74128
Change 74128 by jhb at jhb_slimer on 2005/03/30 22:03:59
Fixes for SMP kernels for atomic_ptr() changes.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_mutex.c#95 edit
.. //depot/projects/smpng/sys/kern/kern_shutdown.c#56 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_mutex.c#95 (text+ko) ====
@@ -599,7 +599,7 @@
if (apic_hack)
APIC_IPI_SPINWAIT_ENTER();
#endif
- while (m->mtx_lock != (void *)MTX_UNOWNED) {
+ while (m->mtx_lock != MTX_UNOWNED) {
if (i++ < 10000000) {
cpu_spinwait();
continue;
==== //depot/projects/smpng/sys/kern/kern_shutdown.c#56 (text+ko) ====
@@ -475,7 +475,7 @@
}
#ifdef SMP
-static volatile void *panic_thread = NULL;
+static volatile uintptr_t panic_thread;
#endif
/*
@@ -492,17 +492,19 @@
int bootopt, newpanic;
va_list ap;
static char buf[256];
+#ifdef SMP
+ uintptr_t tid;
-#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
* CPU is canceled.
*/
- if (panic_thread != td)
- while (atomic_cmpset_ptr(&panic_thread, NULL, td) == 0)
- while (panic_thread != NULL)
+ tid = (uintptr_t)td;
+ if (panic_thread != tid)
+ while (atomic_cmpset_ptr(&panic_thread, 0, tid) == 0)
+ while (panic_thread != 0)
cpu_spinwait();
#endif
@@ -539,7 +541,7 @@
/* See if the user aborted the panic, in which case we continue. */
if (panicstr == NULL) {
#ifdef SMP
- atomic_store_rel_ptr(&panic_thread, NULL);
+ atomic_store_rel_ptr(&panic_thread, 0);
#endif
return;
}
More information about the p4-projects
mailing list