NetBSD Problem Report #56739
From gson@gson.org Fri Mar 4 15:53:32 2022
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_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 9B2AF1A9239
for <gnats-bugs@gnats.NetBSD.org>; Fri, 4 Mar 2022 15:53:32 +0000 (UTC)
Message-Id: <20220304155325.40F35254381@guava.gson.org>
Date: Fri, 4 Mar 2022 17:53:25 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: Hang during boot since recent USB changes
X-Send-Pr-Version: 3.95
>Number: 56739
>Category: kern
>Synopsis: Hang during boot since recent USB changes
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 04 15:55:00 +0000 2022
>Closed-Date: Thu Mar 10 20:45:35 +0000 2022
>Last-Modified: Thu Mar 10 20:45:35 +0000 2022
>Originator: Andreas Gustafsson
>Release: NetBSD-current, source date 2022.03.03.06.12.11
>Organization:
>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:
My NetBSD-current testbed running on a physical i386 laptop hangs
while booting the INSTALL kernel, after printing the line
[ 3.4662759] ehci0: handing over full speed device on port 4 to uhci1
The device being handed over is an ualea(4).
The last known working version is source date 2022.03.02.19.32.15, and
the first known broken one is 2022.03.03.06.12.11. I have started an
automated bisection to narrow this down further.
Logs are at
https://www.gson.org/netbsd/bugs/build/i386-laptop/commits-2022.03.html#2022.03.03.06.12.11
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@netbsd.org, riastradh@NetBSD.org
Cc:
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Fri, 4 Mar 2022 21:20:54 +0200
Bisection narrows it down to this commit:
2022.03.03.06.12.11 riastradh src/sys/arch/mips/adm5120/dev/ahci.c 1.30
2022.03.03.06.12.11 riastradh src/sys/dev/ic/sl811hs.c 1.110
2022.03.03.06.12.11 riastradh src/sys/dev/usb/ehci.c 1.305
2022.03.03.06.12.11 riastradh src/sys/dev/usb/motg.c 1.40
2022.03.03.06.12.11 riastradh src/sys/dev/usb/ohci.c 1.321
2022.03.03.06.12.11 riastradh src/sys/dev/usb/uhci.c 1.311
2022.03.03.06.12.11 riastradh src/sys/dev/usb/usbdi.c 1.231
2022.03.03.06.12.11 riastradh src/sys/dev/usb/usbdivar.h 1.134
2022.03.03.06.12.11 riastradh src/sys/dev/usb/usbroothub.c 1.13
2022.03.03.06.12.11 riastradh src/sys/dev/usb/vhci.c 1.25
2022.03.03.06.12.11 riastradh src/sys/dev/usb/xhci.c 1.158
2022.03.03.06.12.11 riastradh src/sys/external/bsd/dwc2/dwc2.c 1.80
2022.03.03.06.12.11 riastradh src/sys/rump/dev/lib/libugenhc/ugenhc.c 1.31
--
Andreas Gustafsson, gson@gson.org
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Andreas Gustafsson <gson@gson.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Fri, 4 Mar 2022 20:19:53 +0000
Can you get into ddb when it hangs? If yes, can you share `ps' output
at ddb?
Does the hang happen only with ualea(4) or also with other USB
devices?
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@netbsd.org, riastradh@NetBSD.org
Cc:
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Fri, 4 Mar 2022 23:18:47 +0200
Taylor,
You asked (though not in this order):
> Does the hang happen only with ualea(4) or also with other USB
> devices?
I tried an old USB WiFi adapter. When I connect it directly to a USB
port on the laptop, it attaches to the EHCI controller and the machine
boots successfully:
[ 4.0162847] ural0 at uhub3 port 4
[ 4.0571843] ural0: Buffalo (0x0411) WLI-U2-KG54 (0x0066), rev 2.00/0.01, addr 2
[ 4.2562884] ural0: MAC/BBP RT2570 (rev 0x05), RF RT2526
But when I connect it via a full speed hub to force the use of the
UHCI companion controller, it hangs the same way as with the ualea,
after the message
[ 3.4862757] ehci0: handing over full speed device on port 4 to uhci1
So the problem appears not to be related to ualea, but to either UHCI
or the use of a companion controller.
> Can you get into ddb when it hangs? If yes, can you share `ps' output
> at ddb?
Yes. This is with the full speed hub and WiFi adapter:
db{0}> ps
PID LID S CPU FLAGS STRUCT LWP * NAME WAIT
1 1 3 0 0 c24fe240 init lbolt
0 115 3 0 200 c24fe500 npfgc0 npfgcw
0 114 3 0 200 c24edd00 rt_free rt_free
0 113 3 0 200 c24eda40 unpgc unpgc
0 112 3 0 200 c24ed780 key_timehandler key_timehandler
0 111 3 0 200 c24ed4c0 icmp6_wqinput/0 icmp6_wqinput
0 110 3 0 200 c24ed200 nd6_timer nd6_timer
0 109 3 0 200 c247ecc0 carp6_wqinput/0 carp6_wqinput
0 108 3 0 200 c247ea00 carp_wqinput/0 carp_wqinput
0 107 3 0 200 c247e740 icmp_wqinput/0 icmp_wqinput
0 106 3 0 200 c247c9c0 rt_timer rt_timer
0 105 3 0 200 c247c440 vmem_rehash vmem_rehash
0 104 3 0 200 c247c700 entbutler entropy
0 103 3 0 200 c247c180 usb3 usbevt
0 102 3 0 200 c246bc40 usb2 usbevt
0 101 3 0 200 c246b980 usb1 usbdly
0 100 3 0 200 c247cc80 usb0 usbevt
0 99 3 0 200 c247e1c0 acpibat0 acpibat0
0 98 3 0 200 c247e480 acpitz0 acpitz0
0 24 3 0 200 c246b6c0 atabus1 atainitq
0 23 3 0 200 c246b400 atabus0 atadrdy
0 22 3 0 200 c246b140 cardslot1 evexit
0 21 3 0 200 c2340c00 cardslot0 evexit
0 20 3 0 380 c2340940 fw0probe ieee1394
0 19 3 0 200 c2340680 usbtask-dr usbtsk
0 18 3 0 200 c23403c0 usbtask-hc usbtsk
0 17 3 0 200 c2340100 pms0 pmsreset
0 16 3 0 200 c222cbc0 apm0 apmev
0 15 3 0 200 c222c900 sysmon smtaskq
0 14 3 0 200 c222c640 pmfsuspend pmfsuspend
0 13 3 0 200 c222c380 pmfevent pmfevent
0 12 3 0 200 c222c0c0 sopendfree sopendfr
0 11 3 0 200 c221db80 iflnkst iflnkst
0 10 3 0 200 c221d8c0 nfssilly nfssilly
0 9 3 0 200 c221d600 vdrain vdrain
0 8 3 0 200 c221d340 modunload mod_unld
0 7 3 0 200 c221d080 xcall/0 xcall
0 6 1 0 200 c221bb40 softser/0
0 5 3 0 200 c221b880 softclk/0 tstile
0 4 1 0 200 c221b5c0 softbio/0
0 3 1 0 200 c221b300 softnet/0
0 > 2 1 0 201 c221b040 idle/0
0 0 3 0 200 c15909c0 swapper cfgmisc
--
Andreas Gustafsson, gson@gson.org
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Andreas Gustafsson <gson@gson.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Sat, 5 Mar 2022 07:01:01 +0000
> Date: Fri, 4 Mar 2022 23:18:47 +0200
> From: Andreas Gustafsson <gson@gson.org>
>
> > Can you get into ddb when it hangs? If yes, can you share `ps' output
> > at ddb?
>
> Yes. This is with the full speed hub and WiFi adapter:
>
> [...]
> 0 101 3 0 200 c246b980 usb1 usbdly
> [...]
> 0 5 3 0 200 c221b880 softclk/0 tstile
Thanks! These lines are the interesting ones. Can you get stack
traces for these threads?
bt/a c246b980
bt/a c221b880
(or whatever the addresses are for the processes stuck in `usbdly' and
`tstile' next time you boot)
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org, riastradh@NetBSD.org
Cc:
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Sat, 5 Mar 2022 09:21:24 +0200
Taylor R Campbell wrote:
> Thanks! These lines are the interesting ones. Can you get stack
> traces for these threads?
>
> bt/a c246b980
> bt/a c221b880
>
> (or whatever the addresses are for the processes stuck in `usbdly' and
> `tstile' next time you boot)
usbdly from a new boot:
db{0}> bt/a c246b980
trace: pid 0 lid 101 at 0xd942bd60
sleepq_block(1a,0,1a,0,d942bdd4,c05fbc47,c2348004,fa,12,200) at netbsd:sleepq_block+0xbf
usb_delay_ms(c2348004,fa,12,200,3,c2348004,0,d942be00,c0b3dd8d,808) at netbsd:usb_delay_ms+0x77
uhci_roothub_ctrl(c2348004,c2484122,0,ffffffff,84cea4,0,c2484122,0,c09ab1de,c215f040) at netbsd:uhci_roothub_ctrl+0xa55
roothub_ctrl_start(c24840f4,c0e7a8ea,c24840f4,c246b400,d942beac,c01020f3,c247d940,c09a0002,2,d942bed8) at netbsd:roothub_ctrl_start+0xe2
usbd_transfer(c24840f4,0,0,0,d942be8c,c246ba60,c15a6480,c215f040,d942beac,c09ab19f) at netbsd:usbd_transfer+0x272
usbd_do_request_len(c2481800,d942bed8,0,0,0,0,1388,d942bef0,c03afcf0,c2481800) at netbsd:usbd_do_request_len+0x101
usbd_do_request(c2481800,d942bed8,0,2,40323,2,551d3dfa,c2487700,c2481800,2) at netbsd:usbd_do_request+0x3f
usbd_reset_port(c2481800,2,c2487748,c215f040,3,0,c247b810,62e81e2b,1,101) at netbsd:usbd_reset_port+0x45
uhub_explore(c2481800,c2348268,0,c03afbae,33,0,c2348004,c2348238,d942bf9c,c03a9035) at netbsd:uhub_explore+0x5c0
usb_discover(c2348238,c2348268,1770,c01020f3,c2346ac0,c2346ac0,c03a8fbe,c246b980,0,c0102011) at netbsd:usb_discover+0xd7
usb_event_thread(c2346ac0,17bc000,17c7000,0,c01005a8,0,0,0,0,0) at netbsd:usb_event_thread+0x77
tstile from the same new boot:
db{0}> bt/a c221b880
trace: pid 0 lid 5 at 0xd874de5c
sleepq_block(0,0,c0ef2c9b,c1590db0,0,40,c097db62,c215f100,c15a8740,dc) at netbsd:sleepq_block+0x12b
turnstile_block(0,1,c2348268,c1590db0,c157d780,c221b040,c246b400,1,0,0) at netbsd:turnstile_block+0x2ef
mutex_vector_enter(c2348268,2,1,c0976423,2,2,10064,c05fa0e3,c2348cc0,c15a6480) at netbsd:mutex_vector_enter+0x138
uhci_poll_hub(c2348000,0,2,c2288000,3,c15a6484,c15a64dc,c2348000,100,d8740078) at netbsd:uhci_poll_hub+0x1a
callout_softclock(0,0,0,0,0,0,0,0,0,0) at netbsd:callout_softclock+0xa5
softint_dispatch(c221b040,2,0,0,0,0,d8750ff0,d8750f98,c221bb40,80050033) at netbsd:softint_dispatch+0xd0
Bad frame pointer: 0xc2288000
--
Andreas Gustafsson, gson@gson.org
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Andreas Gustafsson <gson@gson.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Sat, 5 Mar 2022 21:49:28 +0000
Thanks, I see the problem -- uhci_poll_hub takes the bus lock from
callout, but uhci_roothub_ctrl waits for a callout (via usb_delay_ms
-> kpause) while holding the bus lock.
Need to resolve this deadlock, perhaps by deferring uhci_poll_hub to a
USB task.
...Except I'm not sure it's kosher to do kpause under any lock that is
taken at IPL_SOFTSERIAL (a higher priority than IPL_SOFTCLOCK where
callouts run to wake kpause), and ~every USB HCI driver does that --
the bus lock is taken from softint context at IPL_SOFTSERIAL to
complete xfers, and the HCI drivers tend to use usb_delay_ms under the
bus lock for various things. Need to think more about that.
From: Andreas Gustafsson <gson@gson.org>
To: Taylor R Campbell <riastradh@NetBSD.org>, gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Wed, 9 Mar 2022 12:12:57 +0200
Taylor,
On March 5, you wrote:
> Need to resolve this deadlock, perhaps by deferring uhci_poll_hub to a
> USB task.
[...]
> Need to think more about that.
Any progress on this? I have now also seen a couple of hangs on my
amd64 bare metal testbed, and I'm wondering if they might be related.
Logs from those:
https://www.gson.org/netbsd/bugs/build/amd64-baremetal/commits-2022.03.html#2022.03.08.20.45.56
https://www.gson.org/netbsd/bugs/build/amd64-baremetal/commits-2022.03.html#2022.03.09.00.20.48
--
Andreas Gustafsson, gson@gson.org
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Andreas Gustafsson <gson@gson.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Wed, 9 Mar 2022 12:19:07 +0000
This is a multi-part message in MIME format.
--=_La7nkjIJilZyzQ04m7iYdJZjSuvrF8DG
Can you try the attached patch?
--=_La7nkjIJilZyzQ04m7iYdJZjSuvrF8DG
Content-Type: text/plain; charset="ISO-8859-1"; name="usbroothub"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="usbroothub.patch"
From 9aa011ffacd2e0f57490342446173233d6231ae9 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh@NetBSD.org>
Date: Wed, 9 Mar 2022 11:37:27 +0000
Subject: [PATCH] usb: Provisionally release bus lock around ubm_rhctrl.
This isn't quite correct, but it avoids a deadlock:
- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause
- softint waits for bus lock, holds up kpause wakeup
The deadlock is new since recent changes to hold the bus lock over
upm_start/upm_transfer. Making this change regresses to other
problems:
- *_suspend/resume and *_roothub_ctrl often touch the same portsc
registers
- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.
When the bus lock was held across both, a noop served here, but we
can't hold the bus lock across both, so that doesn't work.
However, these problems -- which we've had for a long time -- seem to
be less bad than the deadlock. So let's avoid the deadlock for now
and then work out another way to serialize suspend/resume/rhctrl and
aborts.
Candidate fix for PR kern/56739.
---
sys/arch/mips/adm5120/dev/ahci.c | 2 --
sys/dev/ic/sl811hs.c | 2 --
sys/dev/usb/ehci.c | 8 +++++++-
sys/dev/usb/motg.c | 2 --
sys/dev/usb/ohci.c | 2 --
sys/dev/usb/uhci.c | 2 --
sys/dev/usb/usbdivar.h | 2 +-
sys/dev/usb/usbroothub.c | 12 ++++++++++++
sys/dev/usb/xhci.c | 2 --
9 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/sys/arch/mips/adm5120/dev/ahci.c b/sys/arch/mips/adm5120/dev/a=
hci.c
index ca53af493e9b..7bc3a9fd0008 100644
--- a/sys/arch/mips/adm5120/dev/ahci.c
+++ b/sys/arch/mips/adm5120/dev/ahci.c
@@ -569,8 +569,6 @@ ahci_roothub_ctrl(struct usbd_bus *bus, usb_device_requ=
est_t *req,
=20
DPRINTF(D_TRACE, ("SLRCstart "));
=20
- KASSERT(bus->ub_polling || mutex_owned(bus->ub_lock));
-
len =3D UGETW(req->wLength);
value =3D UGETW(req->wValue);
index =3D UGETW(req->wIndex);
diff --git a/sys/dev/ic/sl811hs.c b/sys/dev/ic/sl811hs.c
index 2a10911f3066..76db51573d95 100644
--- a/sys/dev/ic/sl811hs.c
+++ b/sys/dev/ic/sl811hs.c
@@ -3195,8 +3195,6 @@ slhci_roothub_ctrl(struct usbd_bus *bus, usb_device_r=
equest_t *req,
uint8_t type;
int actlen =3D 0;
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
len =3D UGETW(req->wLength);
value =3D UGETW(req->wValue);
index =3D UGETW(req->wIndex);
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 5efa069a37af..4765b744d0e4 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1438,6 +1438,9 @@ ehci_activate(device_t self, enum devact act)
*
* Note that this power handler isn't to be registered directly; the
* bus glue needs to call out to it.
+ *
+ * XXX This should be serialized with ehci_roothub_ctrl's access to the
+ * portsc registers.
*/
bool
ehci_suspend(device_t dv, const pmf_qual_t *qual)
@@ -2369,7 +2372,10 @@ ehci_roothub_ctrl(struct usbd_bus *bus, usb_device_r=
equest_t *req,
=20
EHCIHIST_FUNC(); EHCIHIST_CALLED();
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
+ /*
+ * XXX This should be serialized with ehci_suspend/resume's
+ * access to the portsc registers.
+ */
=20
if (sc->sc_dying)
return -1;
diff --git a/sys/dev/usb/motg.c b/sys/dev/usb/motg.c
index 36da0575b148..aba2ab1b4090 100644
--- a/sys/dev/usb/motg.c
+++ b/sys/dev/usb/motg.c
@@ -806,8 +806,6 @@ motg_roothub_ctrl(struct usbd_bus *bus, usb_device_requ=
est_t *req,
=20
MOTGHIST_FUNC(); MOTGHIST_CALLED();
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
if (sc->sc_dying)
return -1;
=20
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index c55078e8217f..c13ec53b5688 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -2431,8 +2431,6 @@ ohci_roothub_ctrl(struct usbd_bus *bus, usb_device_re=
quest_t *req,
=20
OHCIHIST_FUNC(); OHCIHIST_CALLED();
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
if (sc->sc_dying)
return -1;
=20
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 99409084944f..fa80f49d6e6c 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -3589,8 +3589,6 @@ uhci_roothub_ctrl(struct usbd_bus *bus, usb_device_re=
quest_t *req,
=20
UHCIHIST_FUNC(); UHCIHIST_CALLED();
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
if (sc->sc_dying)
return -1;
=20
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h
index 5a5d94f26ccf..1be0236e49d2 100644
--- a/sys/dev/usb/usbdivar.h
+++ b/sys/dev/usb/usbdivar.h
@@ -51,7 +51,7 @@
* ubm_abortx x must not release/reacquire lock
* ubm_getlock - Called at attach time
* ubm_newdev - Will take lock
- * ubm_rhctrl x
+ * ubm_rhctrl -
*
* PIPE METHOD LOCK NOTES
* ----------------------- ------- -------------------------
diff --git a/sys/dev/usb/usbroothub.c b/sys/dev/usb/usbroothub.c
index 6425d9cf21c7..74d42266725e 100644
--- a/sys/dev/usb/usbroothub.c
+++ b/sys/dev/usb/usbroothub.c
@@ -549,7 +549,19 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
break;
}
=20
+ /*
+ * XXX This needs some mechanism for concurrent
+ * roothub_ctrl_abort to wait for ubm_rhctrl to finish. We
+ * can't use the bus lock because many ubm_rhctrl methods do
+ * usb_delay_ms and many bus locks are taken in softint
+ * context, leading to deadlock in the softclock needed to wake
+ * up usb_delay_ms.
+ */
+ if (!bus->ub_usepolling)
+ mutex_exit(bus->ub_lock);
actlen =3D bus->ub_methods->ubm_rhctrl(bus, req, buf, buflen);
+ if (!bus->ub_usepolling)
+ mutex_enter(bus->ub_lock);
if (actlen < 0)
goto fail;
=20
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 96663025878c..885bbc0af378 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -3856,8 +3856,6 @@ xhci_roothub_ctrl(struct usbd_bus *bus, usb_device_re=
quest_t *req,
=20
XHCIHIST_FUNC();
=20
- KASSERT(bus->ub_usepolling || mutex_owned(bus->ub_lock));
-
if (sc->sc_dying)
return -1;
=20
--=_La7nkjIJilZyzQ04m7iYdJZjSuvrF8DG--
From: Andreas Gustafsson <gson@gson.org>
To: Taylor R Campbell <riastradh@NetBSD.org>, gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/56739: Hang during boot since recent USB changes
Date: Wed, 9 Mar 2022 21:01:14 +0200
Taylor R Campbell wrote:
> Can you try the attached patch?
With the patch, the install succeeds, and the intalled system boots
and runs the ATF tests to completion.
--
Andreas Gustafsson, gson@gson.org
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56739 CVS commit: src/sys
Date: Wed, 9 Mar 2022 22:17:42 +0000
Module Name: src
Committed By: riastradh
Date: Wed Mar 9 22:17:41 UTC 2022
Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c
src/sys/dev/ic: sl811hs.c
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdivar.h usbroothub.c
xhci.c
Log Message:
usb: Provisionally release bus lock around ubm_rhctrl.
This isn't quite correct, but it avoids a deadlock:
- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause
- softint waits for bus lock, holds up kpause wakeup
The deadlock is new since recent changes to hold the bus lock over
upm_start/upm_transfer. Making this change regresses to other
problems:
- *_suspend/resume and *_roothub_ctrl often touch the same portsc
registers
- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.
When the bus lock was held across both, a noop served here, but we
can't hold the bus lock across both, so that doesn't work.
However, these problems -- which we've had for a long time -- seem to
be less bad than the deadlock. So let's avoid the deadlock for now
and then work out another way to serialize suspend/resume/rhctrl and
aborts.
Candidate fix for PR kern/56739.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/adm5120/dev/ahci.c
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/ic/sl811hs.c
cvs rdiff -u -r1.305 -r1.306 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/usb/usbdivar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/usbroothub.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/xhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Thu, 10 Mar 2022 20:45:35 +0000
State-Changed-Why:
Confirmed fixed. Thanks.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.