Date: Thu, 1 Aug 2002 06:41:33 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 15378 for review Message-ID: <200208011341.g71DfXSW059436@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15378 Change 15378 by jhb@jhb_laptop on 2002/08/01 06:41:10 Replace panic_cpu with panic_thread and make the panic spin lock be thread-based since if a panic'ing thread migrates and another thread panics on the same CPU the spinlock doesn't DTRT. Affected files ... .. //depot/projects/smpng/sys/kern/kern_shutdown.c#25 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_shutdown.c#25 (text+ko) ==== @@ -420,7 +420,7 @@ } #ifdef SMP -static u_int panic_cpu = NOCPU; +static uintptr_t panic_thread = NULL; #endif /* @@ -441,15 +441,17 @@ #ifdef SMP /* * We don't want multiple CPU's to panic at the same time, so we - * 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 + * 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_cpu != PCPU_GET(cpuid)) - while (atomic_cmpset_int(&panic_cpu, NOCPU, - PCPU_GET(cpuid)) == 0) - while (panic_cpu != NOCPU) - ; /* nothing */ + if (panic_thread != curthread) + while (atomic_cmpset_ptr(&panic_thread, NULL, curthread) == 0) + while (panic_thread != NULL) { +#ifdef __i386__ + ia32_pause(); +#endif + } #endif bootopt = RB_AUTOBOOT | RB_DUMP; @@ -481,7 +483,7 @@ /* See if the user aborted the panic, in which case we continue. */ if (panicstr == NULL) { #ifdef SMP - atomic_store_rel_int(&panic_cpu, NOCPU); + atomic_store_rel_ptr(&panic_thread, NULL); #endif return; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208011341.g71DfXSW059436>