Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2005 14:19:37 -0400
From:      Stephan Uphoff <ups@tree.com>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        "current@freebsd.org" <current@freebsd.org>
Subject:   Re: mutex still spinning while in DDB on UP machine
Message-ID:  <1118427576.27369.54212.camel@palm>
In-Reply-To: <20050609183835.GA9451@xor.obsecurity.org>
References:  <20050609183835.GA9451@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1118427576.27369.54212.camel>