From owner-p4-projects@FreeBSD.ORG Tue Sep 30 19:06:27 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D585F1065696; Tue, 30 Sep 2008 19:06:27 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 990461065691 for ; Tue, 30 Sep 2008 19:06:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 883698FC23 for ; Tue, 30 Sep 2008 19:06:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8UJ6R39029398 for ; Tue, 30 Sep 2008 19:06:27 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8UJ6RnA029376 for perforce@freebsd.org; Tue, 30 Sep 2008 19:06:27 GMT (envelope-from jhb@freebsd.org) Date: Tue, 30 Sep 2008 19:06:27 GMT Message-Id: <200809301906.m8UJ6RnA029376@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 150719 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2008 19:06:28 -0000 http://perforce.freebsd.org/chv.cgi?CH=150719 Change 150719 by jhb@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; }