Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb xhci(4): Resume commands even if USBSTS.SRE is set.



details:   https://anonhg.NetBSD.org/src/rev/bf6ded12e015
branches:  trunk
changeset: 370049:bf6ded12e015
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Sep 13 10:15:28 2022 +0000

description:
xhci(4): Resume commands even if USBSTS.SRE is set.

Commands might not work after this but let's at least not deadlock --
give them an opportunity to time out or fail.

XXX Maybe set sc_dying here to skip the timeout.

diffstat:

 sys/dev/usb/xhci.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 291b1c8694e7 -r bf6ded12e015 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Sep 13 10:14:43 2022 +0000
+++ b/sys/dev/usb/xhci.c        Tue Sep 13 10:15:28 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.169 2022/09/01 18:09:45 riastradh Exp $     */
+/*     $NetBSD: xhci.c,v 1.170 2022/09/13 10:15:28 riastradh Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.169 2022/09/01 18:09:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.170 2022/09/13 10:15:28 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1103,17 +1103,22 @@
                goto out;
        }
 
-       /* Resume command issuance.  */
+       /* Success!  */
+       ok = true;
+
+out:   /*
+        * Resume command issuance.  If the hardware failed to resume,
+        * well, tough -- deadlocking because everything is held up on
+        * the suspension, with no opportunity to detach, isn't better
+        * than timing out waiting for dead hardware.
+        */
        mutex_enter(&sc->sc_lock);
        KASSERT(sc->sc_suspender);
        sc->sc_suspender = NULL;
        cv_broadcast(&sc->sc_cmdbusy_cv);
        mutex_exit(&sc->sc_lock);
 
-       /* Success!  */
-       ok = true;
-
-out:   mutex_exit(&sc->sc_rhlock);
+       mutex_exit(&sc->sc_rhlock);
        return ok;
 }
 



Home | Main Index | Thread Index | Old Index