NetBSD Problem Report #55243

From www@netbsd.org  Thu May  7 19:59:23 2020
Return-Path: <www@netbsd.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 C83801A9213
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  7 May 2020 19:59:23 +0000 (UTC)
Message-Id: <20200507195922.C04AF1A921E@mollari.NetBSD.org>
Date: Thu,  7 May 2020 19:59:22 +0000 (UTC)
From: hashikaw@mail.ru
Reply-To: hashikaw@mail.ru
To: gnats-bugs@NetBSD.org
Subject: panic at usb_transfer_complete() on raspberry pi 4
X-Send-Pr-Version: www-1.0

>Number:         55243
>Category:       kern
>Synopsis:       panic at usb_transfer_complete() on raspberry pi 4
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    skrll
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 07 20:00:00 +0000 2020
>Closed-Date:    Sat Apr 03 07:26:42 +0000 2021
>Last-Modified:  Sat Apr 03 07:26:42 +0000 2021
>Originator:     Kouichi Hashikawa
>Release:        9.0.56
>Organization:
>Environment:
NetBSD arm64 9.99.56 NetBSD 9.99.56 (GENERIC64) #0: Thu Apr 16 09:51:57 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
On raspberry pi 4, I connect SSD, lan at usb-c port.
Sometimes, panic at usb_transfer_complete().

[ 1559.4226995] panic: kernel diagnostic assertion "xfer == SIMPLEQ_FIRST(&pipe->up_queue)" failed: file "/home/source/ab/HEAD/src/sys/dev/usb/usbdi.c", line 1028 xfer 0xffff0000faf3c6d0 is not start of queue (0xffff0000faf3cac0 is at start)
[ 1559.4427001] cpu2: Begin traceback...
[ 1559.4427001] trace fp ffffc00060e27b20
[ 1559.4527004] fp ffffc00060e27b40 vpanic() at ffffc000004a7468 netbsd:vpanic+0x160
[ 1559.4527004] fp ffffc00060e27bb0 kern_assert() at ffffc000006e574c netbsd:kern_assert+0x5c
[ 1559.4627028] fp ffffc00060e27c40 usb_transfer_complete() at ffffc000000fd96c netbsd:usb_transfer_complete+0x3d4
[ 1559.4727015] fp ffffc00060e27c80 dwc2_softintr() at ffffc00000361aa8 netbsd:dwc2_softintr+0x1e8
[ 1559.4827020] fp ffffc00060e27ce0 usb_soft_intr() at ffffc000000f99ac netbsd:usb_soft_intr+0x24
[ 1559.4927023] fp ffffc00060e27d40 softint_dispatch() at ffffc00000474a1c netbsd:softint_dispatch+0xfc
[ 1559.5027032] fp ffffc00060dffcc0 cpu_switchto_softint() at ffffc00000085118 netbsd:cpu_switchto_softint+0x68
[ 1559.5127031] fp ffffc00060dffdf8 cpu_idle() at ffffc000000860d0 netbsd:cpu_idle+0x58
[ 1559.5227044] fp ffffc00060dffe40 idle_loop() at ffffc0000044ca64 netbsd:idle_loop+0x16c
[ 1559.5327042] fp 0000000000000000 cpu_mpstart() at ffffc00000001a10 netbsd:cpu_mpstart+0x144
[ 1559.5327042] cpu2: End traceback...

>How-To-Repeat:
systat vm, dmesg.

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->skrll
Responsible-Changed-By: skrll@NetBSD.org
Responsible-Changed-When: Fri, 08 May 2020 06:09:48 +0000
Responsible-Changed-Why:
Take


From: Kouichi Hashikawa <hashikaw@mail.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/55243: panic at usb_transfer_complete() on raspberry pi 4
Date: Fri, 15 May 2020 06:48:42 +0900

 --Apple-Mail-99698F4D-D406-421F-A1F2-01B193C1FDE1
 Content-Type: text/plain;
 	charset=utf-8
 Content-Transfer-Encoding: quoted-printable

 I think this is usb lan=E2=80=99s problem.
 I applied following patch, I don=E2=80=99t encounter problem.
 But, I don=E2=80=99t know this patch is correct...
 =20
 --------
 --- src/sys/external/bsd/dwc2/dwc2.c-1.73       2020-04-06 05:59:38.00000000=
 0 +0900
 +++ src/sys/external/bsd/dwc2/dwc2.c    2020-05-15 06:35:54.199752917 +0900
 @@ -335,6 +335,11 @@
          */
         mutex_spin_enter(&hsotg->lock);
         TAILQ_FOREACH_SAFE(dxfer, &sc->sc_complete, xnext, next) {
 +
 +               if (!dxfer->xfer.ux_pipe->up_repeat &&
 +                   &dxfer->xfer !=3D SIMPLEQ_FIRST(&dxfer->xfer.ux_pipe->up=
 _queue))
 +                       continue;
 +
                 if (!usbd_xfer_trycomplete(&dxfer->xfer))
                         /*
                          * The hard interrput handler decided to

 --------

 --=20
 Kouichi Hashikawa <hashikaw@mail.ru>


 --Apple-Mail-99698F4D-D406-421F-A1F2-01B193C1FDE1
 Content-Type: text/html;
 	charset=utf-8
 Content-Transfer-Encoding: quoted-printable

 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
 utf-8"></head><body dir=3D"auto"><div style=3D"-webkit-text-size-adjust: aut=
 o;">I think this is usb lan=E2=80=99s problem.</div><div style=3D"-webkit-te=
 xt-size-adjust: auto;">I applied following patch, I don=E2=80=99t encounter p=
 roblem.</div><div style=3D"-webkit-text-size-adjust: auto;">But, I don=E2=80=
 =99t know this patch is correct...</div><div style=3D"-webkit-text-size-adju=
 st: auto;">&nbsp;</div><div style=3D"-webkit-text-size-adjust: auto;">------=
 --</div><div style=3D"-webkit-text-size-adjust: auto;">--- src/sys/external/=
 bsd/dwc2/dwc2.c-1.73&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2020-04-06 05:59:38=
 .000000000 +0900</div><div style=3D"-webkit-text-size-adjust: auto;">+++ src=
 /sys/external/bsd/dwc2/dwc2.c&nbsp;&nbsp;&nbsp;&nbsp;<a href=3D"tel:2020-05-=
 15" dir=3D"ltr" x-apple-data-detectors=3D"true" x-apple-data-detectors-type=3D=
 "telephone" x-apple-data-detectors-result=3D"1" style=3D"color: currentcolor=
 ;">2020-05-15</a>&nbsp;06:35:54.199752917 +0900<br>@@ -335,6 +335,11 @@<br>&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp; mutex_spin_enter(&amp;hsotg-&gt;lock);<br>&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAILQ_FOREACH_SAFE(dxfer, &amp;sc-&gt;sc_compl=
 ete, xnext, next) {<br>+<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!dxfer-&gt;xfer.ux_pipe-&gt;up_rep=
 eat &amp;&amp;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;dxfer-&gt;xfer !=3D=
  SIMPLEQ_FIRST(&amp;dxfer-&gt;xfer.ux_pipe-&gt;up_queue))<br>+&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue;<br>+<br>&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=
 f (!usbd_xfer_trycomplete(&amp;dxfer-&gt;xfer))<br>&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * The hard interrput handler decided to=
 </div><div style=3D"-webkit-text-size-adjust: auto;"><br>--------</div><br><=
 div dir=3D"ltr"><span style=3D"background-color: rgba(255, 255, 255, 0);">--=
 &nbsp;</span><div><span style=3D"background-color: rgba(255, 255, 255, 0);">=
 Kouichi Hashikawa &lt;hashikaw@mail.ru&gt;</span></div></div><div dir=3D"ltr=
 "><br></div></body></html>=

 --Apple-Mail-99698F4D-D406-421F-A1F2-01B193C1FDE1--

State-Changed-From-To: open->feedback
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sun, 28 Mar 2021 09:14:53 +0000
State-Changed-Why:
Should be fixed (at least the workaround should avoid this).


From: Kouichi Hashikawa <hashikaw@mail.ru>
To: gnats-bugs@netbsd.org
Cc: skrll@netbsd.org, gnats-admin@netbsd.org
Subject: Re: kern/55243 (panic at usb_transfer_complete() on raspberry pi 4)
Date: Sat, 3 Apr 2021 02:43:23 +0900

 > State-Changed-Why:
 > Should be fixed (at least the workaround should avoid this).

 I think think this problem is fixed. Thank you!

 -- 
 Kouichi Hashikawa

State-Changed-From-To: feedback->closed
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Sat, 03 Apr 2021 07:26:42 +0000
State-Changed-Why:
Fixed (well, workaround applied)


>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.