Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/dwc2 Fix assertion failures triggered by us...



details:   https://anonhg.NetBSD.org/src/rev/4563812d8c7f
branches:  trunk
changeset: 996992:4563812d8c7f
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Feb 17 04:17:52 2019 +0000

description:
Fix assertion failures triggered by usbdi.c,v 1.182, when devices
are detached.

This is because xfers of USBD_NOT_STARTED can be removed from queue
in an invisible way to host controller drivers.

Discussed on tech-kern.

diffstat:

 sys/arch/mips/adm5120/dev/ahci.c |   7 ++++---
 sys/dev/ic/sl811hs.c             |   7 ++++---
 sys/dev/usb/ehci.c               |  11 ++++++-----
 sys/dev/usb/motg.c               |   7 ++++---
 sys/dev/usb/ohci.c               |   7 ++++---
 sys/dev/usb/uhci.c               |  12 +++++++-----
 sys/dev/usb/xhci.c               |   7 ++++---
 sys/external/bsd/dwc2/dwc2.c     |   7 ++++---
 8 files changed, 37 insertions(+), 28 deletions(-)

diffs (233 lines):

diff -r 3d1933d7af8b -r 4563812d8c7f sys/arch/mips/adm5120/dev/ahci.c
--- a/sys/arch/mips/adm5120/dev/ahci.c  Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/arch/mips/adm5120/dev/ahci.c  Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahci.c,v 1.16 2018/09/03 16:29:25 riastradh Exp $      */
+/*     $NetBSD: ahci.c,v 1.17 2019/02/17 04:17:52 rin Exp $    */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.16 2018/09/03 16:29:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.17 2019/02/17 04:17:52 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -491,7 +491,8 @@
        DPRINTF(D_MEM, ("SLfreex"));
 
 #ifdef DIAGNOSTIC
-       if (xfer->ux_state != XFER_BUSY) {
+       if (xfer->ux_state != XFER_BUSY &&
+           xfer->ux_status != USBD_NOT_STARTED) {
                printf("ahci_freex: xfer=%p not busy, 0x%08x\n",
                        xfer, xfer->ux_state);
                return;
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/ic/sl811hs.c      Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $  */
+/*     $NetBSD: sl811hs.c,v 1.101 2019/02/17 04:17:52 rin Exp $        */
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.101 2019/02/17 04:17:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_slhci.h"
@@ -811,7 +811,8 @@
        slhci_mem_use(bus, -1);
 #endif
 #ifdef DIAGNOSTIC
-       if (xfer->ux_state != XFER_BUSY) {
+       if (xfer->ux_state != XFER_BUSY &&
+           xfer->ux_status != USBD_NOT_STARTED) {
                struct slhci_softc *sc = SLHCI_BUS2SC(bus);
                printf("%s: slhci_freex: xfer=%p not busy, %#08x halted\n",
                    SC_NAME(sc), xfer, xfer->ux_state);
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/usb/ehci.c        Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.265 2018/09/18 02:00:06 mrg Exp $ */
+/*     $NetBSD: ehci.c,v 1.266 2019/02/17 04:17:52 rin Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.265 2018/09/18 02:00:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.266 2019/02/17 04:17:52 rin Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1562,9 +1562,10 @@
        struct ehci_softc *sc = EHCI_BUS2SC(bus);
        struct ehci_xfer *ex __diagused = EHCI_XFER2EXFER(xfer);
 
-       KASSERTMSG(xfer->ux_state == XFER_BUSY, "xfer %p state %d\n", xfer,
-           xfer->ux_state);
-       KASSERT(ex->ex_isdone);
+       KASSERTMSG(xfer->ux_state == XFER_BUSY ||
+           xfer->ux_status == USBD_NOT_STARTED,
+           "xfer %p state %d\n", xfer, xfer->ux_state);
+       KASSERT(ex->ex_isdone || xfer->ux_status == USBD_NOT_STARTED);
 
 #ifdef DIAGNOSTIC
        xfer->ux_state = XFER_FREE;
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/usb/motg.c
--- a/sys/dev/usb/motg.c        Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/usb/motg.c        Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: motg.c,v 1.24 2019/01/22 06:39:24 skrll Exp $  */
+/*     $NetBSD: motg.c,v 1.25 2019/02/17 04:17:52 rin Exp $    */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.24 2019/01/22 06:39:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.25 2019/02/17 04:17:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -760,7 +760,8 @@
        struct motg_softc *sc = MOTG_BUS2SC(bus);
 
 #ifdef DIAGNOSTIC
-       if (xfer->ux_state != XFER_BUSY) {
+       if (xfer->ux_state != XFER_BUSY &&
+           xfer->ux_status != USBD_NOT_STARTED) {
                printf("motg_freex: xfer=%p not busy, 0x%08x\n", xfer,
                       xfer->ux_state);
        }
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/usb/ohci.c        Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.287 2018/09/16 20:21:56 mrg Exp $   */
+/*     $NetBSD: ohci.c,v 1.288 2019/02/17 04:17:52 rin Exp $   */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.287 2018/09/16 20:21:56 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.288 2019/02/17 04:17:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1083,7 +1083,8 @@
 {
        ohci_softc_t *sc = OHCI_BUS2SC(bus);
 
-       KASSERTMSG(xfer->ux_state == XFER_BUSY,
+       KASSERTMSG(xfer->ux_state == XFER_BUSY ||
+           xfer->ux_status == USBD_NOT_STARTED,
            "xfer=%p not busy, 0x%08x\n", xfer, xfer->ux_state);
 #ifdef DIAGNOSTIC
        xfer->ux_state = XFER_FREE;
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/usb/uhci.c        Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.287 2019/02/07 12:35:43 skrll Exp $ */
+/*     $NetBSD: uhci.c,v 1.288 2019/02/17 04:17:52 rin Exp $   */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.287 2019/02/07 12:35:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.288 2019/02/17 04:17:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -675,9 +675,11 @@
        struct uhci_softc *sc = UHCI_BUS2SC(bus);
        struct uhci_xfer *uxfer __diagused = UHCI_XFER2UXFER(xfer);
 
-       KASSERTMSG(xfer->ux_state == XFER_BUSY, "xfer %p state %d\n", xfer,
-           xfer->ux_state);
-       KASSERTMSG(uxfer->ux_isdone, "xfer %p not done\n", xfer);
+       KASSERTMSG(xfer->ux_state == XFER_BUSY ||
+           xfer->ux_status == USBD_NOT_STARTED,
+           "xfer %p state %d\n", xfer, xfer->ux_state);
+       KASSERTMSG(uxfer->ux_isdone || xfer->ux_status == USBD_NOT_STARTED,
+           "xfer %p not done\n", xfer);
 #ifdef DIAGNOSTIC
        xfer->ux_state = XFER_FREE;
 #endif
diff -r 3d1933d7af8b -r 4563812d8c7f sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/dev/usb/xhci.c        Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.105 2019/01/22 15:02:33 skrll Exp $ */
+/*     $NetBSD: xhci.c,v 1.106 2019/02/17 04:17:52 rin Exp $   */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.105 2019/01/22 15:02:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.106 2019/02/17 04:17:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2284,7 +2284,8 @@
        XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
 #ifdef DIAGNOSTIC
-       if (xfer->ux_state != XFER_BUSY) {
+       if (xfer->ux_state != XFER_BUSY &&
+           xfer->ux_status != USBD_NOT_STARTED) {
                DPRINTFN(0, "xfer=%#jx not busy, 0x%08jx",
                    (uintptr_t)xfer, xfer->ux_state, 0, 0);
        }
diff -r 3d1933d7af8b -r 4563812d8c7f sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c      Sun Feb 17 04:17:31 2019 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c      Sun Feb 17 04:17:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2.c,v 1.57 2019/01/22 15:02:34 skrll Exp $  */
+/*     $NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.57 2019/01/22 15:02:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $");
 
 #include "opt_usb.h"
 
@@ -235,7 +235,8 @@
        DPRINTFN(10, "\n");
 
 #ifdef DIAGNOSTIC
-       if (xfer->ux_state != XFER_BUSY) {
+       if (xfer->ux_state != XFER_BUSY &&
+           xfer->ux_status != USBD_NOT_STARTED) {
                DPRINTF("xfer=%p not busy, 0x%08x\n", xfer, xfer->ux_state);
        }
        xfer->ux_state = XFER_FREE;



Home | Main Index | Thread Index | Old Index