From owner-p4-projects Thu Aug 1 6:41:47 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C896D37B401; Thu, 1 Aug 2002 06:41:34 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BBF737B400 for ; Thu, 1 Aug 2002 06:41:34 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2AE4C43E5E for ; Thu, 1 Aug 2002 06:41:34 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g71DfYJU059439 for ; Thu, 1 Aug 2002 06:41:34 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g71DfXSW059436 for perforce@freebsd.org; Thu, 1 Aug 2002 06:41:33 -0700 (PDT) Date: Thu, 1 Aug 2002 06:41:33 -0700 (PDT) Message-Id: <200208011341.g71DfXSW059436@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 15378 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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