Date: Wed, 30 Mar 2005 22:04:00 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 74128 for review Message-ID: <200503302204.j2UM40Rw070412@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=74128 Change 74128 by jhb@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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503302204.j2UM40Rw070412>
