NetBSD Problem Report #52569

From gson@gson.org  Fri Sep 22 19:06:37 2017
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 052D47A0F3
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Sep 2017 19:06:37 +0000 (UTC)
Message-Id: <20170922190632.DCE57989281@guava.gson.org>
Date: Fri, 22 Sep 2017 22:06:32 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: Entering ddb using USB keyboard panics with "locking against myself"
X-Send-Pr-Version: 3.95

>Number:         52569
>Category:       kern
>Synopsis:       Entering ddb using USB keyboard panics with "locking against myself"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 22 19:10:00 +0000 2017
>Closed-Date:    Sun Sep 06 15:39:53 +0000 2020
>Last-Modified:  Sun Sep 06 15:39:53 +0000 2020
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2017.09.06.18.21.17 + patch from PR 52553
>Organization:

>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

After testing Nick's patch for PR 52553, I figured I'd try to
reproduce PR 52525 on the same machine by hitting control-alt-esc on
its USB keyboard.  This resulted in a panic and crash dump.  Examining
the crash dump shows:

  test# gdb /netbsd
  [...]
  (gdb) target kvm netbsd.3.core
  maybe_dump (howto=260) at /usr/src/sys/arch/i386/i386/machdep.c:757
  757             splx(s);
  (gdb) bt
  #0  maybe_dump (howto=260) at /usr/src/sys/arch/i386/i386/machdep.c:757
  #1  0xc011edb5 in cpu_reboot (howto=260, bootstr=0x0) at /usr/src/sys/arch/i386/i386/machdep.c:776
  #2  0xc0bf7c54 in vpanic (fmt=0xc13ab588 "lock error: %s: %s,%zu: %s: lock %p cpu %d lwp %p", ap=0xd8a5b700 "?/:\301(1:\301 \002") at /usr/src/sys/kern/subr_prf.c:342
  #3  0xc0bf7a86 in panic (fmt=0xc13ab588 "lock error: %s: %s,%zu: %s: lock %p cpu %d lwp %p") at /usr/src/sys/kern/subr_prf.c:258
  #4  0xc0bf00c6 in lockdebug_abort (func=0xc13a3128 <__func__.6155> "mutex_vector_enter", line=544, lock=0xc25e626c, ops=0xc16ace78 <mutex_adaptive_lockops>, 
      msg=0xc13a3081 "locking against myself") at /usr/src/sys/kern/subr_lockdebug.c:877
  #5  0xc0ba7dde in mutex_abort (func=0xc13a3128 <__func__.6155> "mutex_vector_enter", line=544, mtx=0xc25e626c, msg=0xc13a3081 "locking against myself") at /usr/src/sys/kern/kern_mutex.c:316
  #6  0xc0ba82dc in mutex_vector_enter (mtx=0xc25e626c) at /usr/src/sys/kern/kern_mutex.c:544
  #7  0xc06f2a90 in uhci_device_intr_start (xfer=0xc25fdd20) at /usr/src/sys/dev/usb/uhci.c:2752
  #8  0xc0457e58 in usbd_start_next (pipe=0xc261f248) at /usr/src/sys/dev/usb/usbdi.c:1043
  #9  0xc0457bac in usb_transfer_complete (xfer=0xc25fdd20) at /usr/src/sys/dev/usb/usbdi.c:986
  #10 0xc06f0037 in uhci_softintr (v=0xc25e600c) at /usr/src/sys/dev/usb/uhci.c:1423
  #11 0xc04580fc in usbd_set_polling (dev=0xc260b218, on=1) at /usr/src/sys/dev/usb/usbdi.c:1143
  #12 0xc0473cc8 in ukbd_cnpollc (v=0xc256a000, on=1) at /usr/src/sys/dev/usb/ukbd.c:997
  #13 0xc09f74aa in wskbd_cnpollc (dev=18446744073709551615, poll=1) at /usr/src/sys/dev/wscons/wskbd.c:1431
  #14 0xc09ef67c in wsdisplay_pollc (dev=12032, on=1) at /usr/src/sys/dev/wscons/wsdisplay.c:2257
  #15 0xc0123655 in cnpollc (on=1) at /usr/src/sys/dev/cons.c:359
  #16 0xc011abfd in kdb_trap (type=1, code=0, regs=0xd8a5ba04) at /usr/src/sys/arch/i386/i386/db_interface.c:248
  #17 0xc0122593 in trap (frame=0xd8a5ba04) at /usr/src/sys/arch/i386/i386/trap.c:313
  #18 0xc0116e8f in alltraps ()
  #19 0xd8a5ba04 in ?? ()
  #20 0xc011ad4e in cpu_Debugger () at /usr/src/sys/arch/i386/i386/db_interface.c:289
  #21 0xc09f7a62 in internal_command (sc=0xc261f748, type=0xd8a5babc, ksym=62496, ksym2=27) at /usr/src/sys/dev/wscons/wskbd.c:1591
  #22 0xc09f7e32 in wskbd_translate (id=0xc17404c0 <wskbd_console_data>, type=2, value=41) at /usr/src/sys/dev/wscons/wskbd.c:1719
  #23 0xc09f5fb5 in wskbd_input (dev=0xc25fe288, type=2, value=41) at /usr/src/sys/dev/wscons/wskbd.c:684
  #24 0xc04738af in ukbd_decode (sc=0xc256a000, ud=0xc256ae28) at /usr/src/sys/dev/usb/ukbd.c:849
  #25 0xc047337b in ukbd_delayed_decode (addr=0xc256a000) at /usr/src/sys/dev/usb/ukbd.c:714
  #26 0xc0bd7b68 in callout_softclock (v=0x0) at /usr/src/sys/kern/kern_timeout.c:738
  #27 0xc0bc6927 in softint_execute (si=0xd89ce074, l=0xc23a7540, s=2) at /usr/src/sys/kern/kern_softint.c:589
  #28 0xc0bc6c93 in softint_dispatch (pinned=0xc23a7d20, s=2) at /usr/src/sys/kern/kern_softint.c:871
  #29 0xc0100f3b in Xsoftintr ()
  #30 0xc23a7d20 in ?? ()

For a dmesg, see PR 52553.

>How-To-Repeat:

Hit control-alt-esc on a USB keyboard attached to a uhci controller
when running an i386 debug build.  You may also need to have some
other USB activity going on; running the test of PR 53553 seems to do
it.

>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Tue, 18 Sep 2018 02:57:32 +0000
State-Changed-Why:
this should be fixed in -current now.  can you check?


From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52569 (Entering ddb using USB keyboard panics with "locking against myself")
Date: Thu, 20 Sep 2018 11:51:31 +0300

 mrg@NetBSD.org wrote:
 > this should be fixed in -current now.  can you check?

 Blocking on 53621.
 -- 
 Andreas Gustafsson, gson@gson.org

From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52569 (Entering ddb using USB keyboard panics with "locking against myself")
Date: Fri, 21 Sep 2018 13:23:26 +0300

 > Blocking on 53621.

 Now I have found a work-around for 53621, but it needs userconf which
 I can't use with a USB keyboard because 41780.  And if I plug in both
 a PS/2 and a USB keyboard, I won't be able to enter ddb because 53599.
 -- 
 Andreas Gustafsson, gson@gson.org

From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52569 (Entering ddb using USB keyboard panics with "locking against myself")
Date: Fri, 21 Sep 2018 15:30:17 +0300

 mrg@NetBSD.org wrote:
 > this should be fixed in -current now.  can you check?

 I was finally able to work around all of 53621, 41780, and 53599
 by adding "userconf=disable sb0" to /boot.cfg.

 Running the "while true; do ifconfig athn0 down; ifconfig athn0 up; done"
 loop from PR 52553 and hitting ctrl-alt-esc on the USB keyboard still
 causes a panic, but the panic message is now "mutex_owned(&sc->sc_lock)"
 rather than "locking against myself":

 test# gdb /netbsd
 GNU gdb (GDB) 7.12
 Copyright (C) 2016 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "i486--netbsdelf".
 Type "show configuration" for configuration details.
 For bug reporting instructions, please see:
 <http://www.gnu.org/software/gdb/bugs/>.
 Find the GDB manual and other documentation resources online at:
 <http://www.gnu.org/software/gdb/documentation/>.
 For help, type "help".
 Type "apropos word" to search for commands related to "word"...
 Reading symbols from /netbsd...done.
 (gdb) target kvm netbsd.8.core
 0xc011b2b5 in cpu_reboot ()
 (gdb) bt
 #0  0xc011b2b5 in cpu_reboot ()
 #1  0xc0937140 in vpanic ()
 #2  0xc0d64c5f in kern_assert ()
 #3  0xc0596be6 in uhci_device_bulk_done ()
 #4  0xc039a357 in usb_transfer_complete ()
 #5  0xc059504c in uhci_softintr ()
 #6  0xc05976b1 in uhci_intr1 ()
 #7  0xc0597879 in uhci_poll ()
 #8  0xc03ae888 in ukbd_cngetc ()
 #9  0xc07a2377 in wskbd_cngetc ()
 #10 0xc0798f1f in wsdisplay_getc ()
 #11 0xc011dcf2 in cngetc ()
 #12 0xc06c51eb in db_readline ()
 #13 0xc06c5abf in db_read_line ()
 #14 0xc06c429e in db_command_loop ()
 #15 0xc06c7b2d in db_trap ()
 #16 0xc01172c6 in kdb_trap ()
 #17 0xc011cee3 in trap ()
 #18 0xc0114532 in alltraps ()
 #19 0xd85a0a70 in ?? ()
 #20 0xc07a2118 in wskbd_translate ()
 #21 0xc07a2549 in wskbd_input ()
 #22 0xc03aedfc in ukbd_decode ()
 #23 0xc091ae64 in callout_softclock ()
 #24 0xc090ea81 in softint_dispatch ()
 #25 0xc0100f2b in Xsoftintr ()
 #26 0xc1edcd20 in ?? ()
 Backtrace stopped: previous frame inner to this frame (corrupt stack?)
 (gdb) 

 test# crash -M netbsd.8.core
 Crash version 8.99.2, image version 8.99.25.
 WARNING: versions differ, you may not be able to examine this image.
 System panicked: kernel diagnostic assertion "mutex_owned(&sc->sc_lock)" failed: file "/tmp/bracket/build/2018.09.20.06.54.36-i386/src/sys/dev/usb/uhci.c", line 3332 
 Backtrace from time of crash is available.
 crash> bt
 _KERNEL_OPT_NARCNET(8,104,c011b2b5,8,c10e5959,0,104,c10543a4,d85a0740,d85a0724) at 0
 __kernel_end(104,0,c10543a4,d85a0740,c214a4c8,c2045008,c204526c,d85a0734,c0d64c5f,c10543a4) at d85a0740
 vpanic(c10543a4,d85a0740,d85a0764,c0596be6,c10543a4,c10542e3,c1098caa,c10ce6ac,d04,40016b4) at vpanic+0x142
 __x86_indirect_thunk_edx(c10543a4,c10542e3,c1098caa,c10ce6ac,d04,40016b4,4,c2128d00,0,10) at __x86_indirect_thunk_edx
 uhci_device_bulk_done(c2128d00,c214a608,1,10,d85a07a4,c03992d4,c2128dd0,5a0002,1,c214a4c8) at uhci_device_bulk_done+0x262
 usb_transfer_complete(c2128d00,1710,10,a,20,d85a07df,73,0,10,3131205b) at usb_transfer_complete+0xce
 uhci_softintr(c204500c,2020,2,1,3,c2045008,c2045270,d85a0894,d85a0854,c0597879) at uhci_softintr+0x282
 uhci_intr1(c2045270,2020,2,20,3,c209e000,d85a0890,d85a087c,c03ae888,c204500c) at uhci_intr1+0x1d3
 uhci_poll(c204500c,2,d85a087c,c1629000,0,d85a0890,d85a0894,d85a09c4,d85a08a0,c07a2377) at uhci_poll+0x7f
 ukbd_cngetc(c209e000,d85a0890,d85a0894,122e,7020,8,6,d85a08b0,c0798f1f,2f00) at ukbd_cngetc+0x10b
 wskbd_cngetc(2f00,0,d85a08c8,c011dcf2,2f00,0,c13d8f80,c13d8f80,d85a08fc,c06c51eb) at wskbd_cngetc+0xae
 wsdisplay_getc(2f00,0,c13d8f80,c13d8f80,d85a08fc,c06c51eb,c10e57d7,0,0,0) at wsdisplay_getc+0x27
 cngetc(c10e57d7,0,0,0,0,7,2,0,0,6) at cngetc+0x40
 db_readline(c13d8f80,78,d85a0940,c06c429e,1,868847dd,0,0,0,d85a0910) at db_readline+0x4e
 db_read_line(1,868847dd,0,0,0,d85a0910,d85a0940,6,d85a09c4,c06c426c) at db_read_line+0x1a
 db_command_loop(c0115b64,0,5,c134c8c1,1,d85a0a70,d85a09d0,c01172c6,1,0) at db_command_loop+0x86
 db_trap(1,0,0,d85a097c,0,c0590010,c13c0030,10,c0590010,c213f1a6) at db_trap+0xe0
 kdb_trap(1,0,d85a0a70,5,d859e2c0,202,b6bb466d,6,d85a0af0,c1304580) at kdb_trap+0xd4
 trap() at trap+0x495
 --- trap (number 1) ---
 breakpoint(c201d188,0,0,c091af2a,c202bca8,c091b645,c1eb001b,c08f9087,c0921df2,c2155888) at breakpoint+0x4
 wskbd_translate(c2155888,1,c2398e00,d85a0b40,c0143fa9,8,200007,d85a0b4a,d85a0b4a,c209e000) at wskbd_translate+0xb12
 wskbd_input(c2155888,2,29,c201401c,c2014008,c209e000,c209ee28,2,1e10029,d83b002c) at wskbd_input+0x4f
 ukbd_decode(c209e000,0,2,c2031e48,3,c1446184,c209e000,0,c14461e0,d8590074) at ukbd_decode+0x1b1
 callout_softclock(0,c090df50,d8590074,c0100400,1606000,1610010,30,c0100010,c1edc540,0) at callout_softclock+0x344
 softint_dispatch(c1edcd20,2,c87,5a061084,7fbfdfe7,eebffff1,d85a3ff0,d85a3f98,c1edc2a0,80050033) at softint_dispatch+0xc9
 Bad frame pointer: 0xc2031208

 -- 
 Andreas Gustafsson, gson@gson.org

State-Changed-From-To: feedback->open
State-Changed-By: gson@NetBSD.org
State-Changed-When: Fri, 21 Sep 2018 12:37:03 +0000
State-Changed-Why:
Feedback provided.


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, gson@gson.org (Andreas Gustafsson)
Subject: re: kern/52569 (Entering ddb using USB keyboard panics with "locking against myself")
Date: Mon, 08 Oct 2018 15:11:27 +1100

 >  > Blocking on 53621.
 >  
 >  Now I have found a work-around for 53621, but it needs userconf which
 >  I can't use with a USB keyboard because 41780.  And if I plug in both
 >  a PS/2 and a USB keyboard, I won't be able to enter ddb because 53599.

 you can use userconf from /boot and boot.cfg.  that sounds
 like the only way to handle this today.

 41780 is likely never solveable.  boot -c needs to operate
 before any devices are configured, and usb kbd without legacy
 emulation absolutely needs devices configured and sort of
 running, before it can really work properly.

 ideally, multiple console devices would solve 53599, and there
 is some work in -current to begin to support it.


 .mrg.

State-Changed-From-To: open->feedback
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 07 Jul 2020 15:12:01 +0000
State-Changed-Why:
uhci.c:1.304


From: Andreas Gustafsson <gson@gson.org>
To: skrll@NetBSD.org
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/52569 (Entering ddb using USB keyboard panics with "locking against myself")
Date: Thu, 23 Jul 2020 13:01:23 +0300

 skrll@NetBSD.org wrote:
 > Synopsis: Entering ddb using USB keyboard panics with "locking against myself"
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: skrll@NetBSD.org
 > State-Changed-When: Tue, 07 Jul 2020 15:12:01 +0000
 > State-Changed-Why:
 > uhci.c:1.304

 I tried to test this on the Compaq Deskpro EN of the original PR,
 using a -current/i386 built from 2020.07.22.15.01.18 sources.

 Typing ctrl-alt-esc on the USB keyboard after booting to multi-user
 results in an immediate "i82489_icr_wait: busy" panic as reported in
 PR 52525, whether the "while true; do ifconfig athn0 down; ifconfig
 athn0 up; done" loop is running or not.

 This would suggest that the present PR is fixed, but because of 52525,
 it's hard to get a statistically significant sample of control-alt-esc
 behaviors as each test takes a long time to run with the crash and fsck.
 -- 
 Andreas Gustafsson, gson@gson.org

State-Changed-From-To: feedback->open
State-Changed-By: gson@NetBSD.org
State-Changed-When: Sun, 06 Sep 2020 14:05:04 +0000
State-Changed-Why:
Feedback was provided.


State-Changed-From-To: open->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sun, 06 Sep 2020 15:39:53 +0000
State-Changed-Why:
Consider closed as suggested.  Any further problems can be handled witha new PR.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.