Re: mutex still spinning while in DDB on UP machine

From: Stephan Uphoff <ups_at_tree.com>
Date: Fri, 10 Jun 2005 14:19:37 -0400
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
_at__at_ -823,8 +823,15 _at__at_
        }
 
 #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)
Received on Fri Jun 10 2005 - 16:20:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:36 UTC