Date: Wed, 03 Jul 2002 13:13:59 -0400 (EDT) From: John Baldwin <jhb@FreeBSD.org> To: Julian Elischer <julian@elischer.org> Cc: current@FreeBSD.ORG, David Wolfskill <david@catwhisker.org> Subject: Re: KSE status report Message-ID: <XFMail.20020703131359.jhb@FreeBSD.org> In-Reply-To: <Pine.BSF.4.21.0207030954400.1443-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org> <>< 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020703131359.jhb>