From owner-freebsd-current Wed Jul 3 10:14: 5 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB3E737B400 for ; Wed, 3 Jul 2002 10:14:00 -0700 (PDT) Received: from mail.speakeasy.net (mail13.speakeasy.net [216.254.0.213]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34BD143E42 for ; Wed, 3 Jul 2002 10:14:00 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 22077 invoked from network); 3 Jul 2002 17:13:58 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail13.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 3 Jul 2002 17:13:58 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g63HDvM26597; Wed, 3 Jul 2002 13:13:57 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Wed, 03 Jul 2002 13:13:59 -0400 (EDT) From: John Baldwin To: Julian Elischer Subject: Re: KSE status report Cc: current@FreeBSD.ORG, David Wolfskill Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 03-Jul-2002 Julian Elischer wrote: > congratulations.. I think that you win the Matt Dillon "got both > processors to enter the ddb at the same time" award.. > > On Wed, 3 Jul 2002, David Wolfskill wrote: > >> login: panic: vm_page_free: invalid wire count (360), pindex: 0x1 >> cpuid = 0; lapic.id = 00000000 >> Debugger("panic") >> uernteilm etoruatp s9t owpiptihn gi nctpeursr >> Sttso pdpiesda balte d >> in_Debugger.0x46: xchgl %ebx, >> db> >> al trap 9: general protectinuwlppippelo >> u 1lcd i10 >> irtnot 0:c026scpnr 01:da20fmpnr 010a2ppx8cxppxexpeppxxeppxp pps@xxltx >> = DPL 0, pres 1, def32 1, gran 1 >> processor eflags = resume, IOPL = 0 >> current process = c)elt r,o= >> S >> Xc >> pDcXKK`K$KhK,KpK4KxK > > doing an nm and figuring out where the processor was > might be informative. If you have a valid eip you can use addr2line to get the exact source line. We probably need to not allow concurrent panics. We already don't allow concurrent ddb sessions, but we do let both processors panic at the same time I think. Hmm, this should already be happening though: panic(const char *fmt, ...) { int bootopt; va_list ap; static char buf[256]; #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 * 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 */ #endif I suppose this could be broken if we migrate. I'll try to think of a better solution. Probably using curthread instead of cpuid. Try this untested diff (warning, my mailer will probably botch this): Index: kern_shutdown.c =================================================================== RCS file: /usr/cvs/src/sys/kern/kern_shutdown.c,v retrieving revision 1.128 diff -u -r1.128 kern_shutdown.c --- kern_shutdown.c 12 May 2002 18:27:28 -0000 1.128 +++ kern_shutdown.c 3 Jul 2002 17:12:32 -0000 @@ -421,7 +421,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; @@ -479,7 +481,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; } -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message