Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb ehci(4): Omit bus lock around ehci_suspend/resume.



details:   https://anonhg.NetBSD.org/src/rev/7302553a6f6a
branches:  trunk
changeset: 363397:7302553a6f6a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 09 22:18:13 2022 +0000

description:
ehci(4): Omit bus lock around ehci_suspend/resume.

This no longer serializes access to the portsc registers, also used
by ehci_roothub_ctrl, but it does pose a potential deadlock with
softints to wake usb_delay_ms.  So the bus lock doesn't help here,
and may cause deadlock.

diffstat:

 sys/dev/usb/ehci.c |  12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diffs (54 lines):

diff -r 982e452d3bbd -r 7302553a6f6a sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Wed Mar 09 22:17:41 2022 +0000
+++ b/sys/dev/usb/ehci.c        Wed Mar 09 22:18:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $ */
+/*     $NetBSD: ehci.c,v 1.307 2022/03/09 22:18:13 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.306 2022/03/09 22:17:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.307 2022/03/09 22:18:13 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1451,8 +1451,6 @@
 
        EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-       mutex_enter(&sc->sc_lock);
-
        for (i = 1; i <= sc->sc_noport; i++) {
                cmd = EOREAD4(sc, EHCI_PORTSC(i)) & ~EHCI_PS_CLEAR;
                if ((cmd & EHCI_PS_PO) == 0 && (cmd & EHCI_PS_PE) == EHCI_PS_PE)
@@ -1487,8 +1485,6 @@
        if (hcr != EHCI_STS_HCH)
                printf("%s: config timeout\n", device_xname(dv));
 
-       mutex_exit(&sc->sc_lock);
-
        return true;
 }
 
@@ -1501,8 +1497,6 @@
 
        EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-       mutex_enter(&sc->sc_lock);
-
        /* restore things in case the bios sucks */
        EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
        EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->sc_fldma, 0));
@@ -1548,8 +1542,6 @@
        if (hcr == EHCI_STS_HCH)
                printf("%s: config timeout\n", device_xname(dv));
 
-       mutex_exit(&sc->sc_lock);
-
        return true;
 }
 



Home | Main Index | Thread Index | Old Index