From owner-freebsd-current@FreeBSD.ORG Fri Jun 10 18:20:07 2005 Return-Path: X-Original-To: current@freebsd.org 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 977FF16A41C for ; Fri, 10 Jun 2005 18:20:07 +0000 (GMT) (envelope-from ups@tree.com) Received: from smtp.speedfactory.net (talon.speedfactory.net [66.23.216.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3716A43D48 for ; Fri, 10 Jun 2005 18:20:07 +0000 (GMT) (envelope-from ups@tree.com) Received: (qmail 12308 invoked from network); 10 Jun 2005 18:20:01 +0000 Received: from 66-23-216-49.clients.speedfactory.net (HELO palm.tree.com) (66.23.216.49) by smtp.speedfactory.net with AES256-SHA encrypted SMTP; 10 Jun 2005 18:20:01 +0000 Received: from [127.0.0.1] (ups@localhost.tree.com [127.0.0.1]) by palm.tree.com (8.12.10/8.12.10) with ESMTP id j5AIJbpP001730; Fri, 10 Jun 2005 14:19:37 -0400 (EDT) (envelope-from ups@tree.com) From: Stephan Uphoff To: Kris Kennaway In-Reply-To: <20050609183835.GA9451@xor.obsecurity.org> References: <20050609183835.GA9451@xor.obsecurity.org> Content-Type: text/plain Message-Id: <1118427576.27369.54212.camel@palm> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 10 Jun 2005 14:19:37 -0400 Content-Transfer-Encoding: 7bit Cc: "current@freebsd.org" Subject: Re: mutex still spinning while in DDB on UP machine X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2005 18:20:07 -0000 On Thu, 2005-06-09 at 14:38, Kris Kennaway wrote: > I've seen the following a couple of times recently on UP machines > running up-to-date current (the panic may not be important, I'm > referring to the behaviour of DDB): > > Fatal trap 12: page fault while in kernel mode > fault virtual address = 0x0 > fault code = supervisor write, page not present > instruction pointer = 0x20:0xc054cc77 > stack pointer = 0x28:0xd4222c9c > frame pointer = 0x28:0xd4222cb4 > code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, def32 1, gran 1 > processor eflags = interrupt enabled, resume, IOPL = 0 -----------------------------^^^^^^^^^^^^^^^^^ > current process = 37 (vnlru) > [thread pid 37 tid 100035 ] > Stopped at vnlru_free+0x87: movl %eax,0(%edx) > db> stray irq7 > stray irq7 > stray irq7 > stray irq7 > too many stray irq 7's: not logging anymore > > At this point, the keyboard only works sporadically (i.e. I have to > press keys multiple times for DDB to receive the input). > > show ktr shows a buffer full of: > > 530: UNLOCK (spin mutex) icu r = 0 at ../../../i386/isa/atpic.c:267 > 529: LOCK (spin mutex) icu r = 0 at ../../../i386/isa/atpic.c:265 > [ ..SNIP....] > and repeated show ktr indicates that it is still logging events > (i.e. the head of the buffer is now in a different place). This > suggests that the mutex is still spinning even though the system is in > DDB. > > Kris Kris, the following patch should help as it disables interrupts before entering the debugger. (amd64 probably has the same problems and I will take a look later today ) Could you give it a spin? I would like to check it in ASAP. Stephan Index: trap.c =================================================================== RCS file: /cvsroot/src/sys/i386/i386/trap.c,v retrieving revision 1.274 diff -u -r1.274 trap.c --- trap.c 30 May 2005 06:29:28 -0000 1.274 +++ trap.c 10 Jun 2005 18:11:01 -0000 @@ -823,8 +823,15 @@ } #ifdef KDB - if ((debugger_on_panic || kdb_active) && kdb_trap(type, 0, frame)) - return; + if (debugger_on_panic || kdb_active) { + register_t eflags; + eflags = intr_disable(); + if (kdb_trap(type, 0, frame)) { + intr_restore(eflags); + return; + } + intr_restore(eflags); + } #endif printf("trap number = %d\n", type); if (type <= MAX_TRAP_MSG)