Bug 202541

Summary: xhci_hcd 0000:15:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state
Product: Drivers Reporter: Bernhard (bernhard.gebetsberger)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: NEW ---    
Severity: high CC: antdev66, b.cortooms, biopsin, danny.j.smith, dion, doug16k, dront78, ehoffman, erickperez, eugene, fgrim, gandalf, github, grsfdhj, himanshu.xt, jacobbrett+kernel.org, jernej.jakob, jg.staffel, jim, k.j.vanmierlo, koparebu, lists, luke-jr+linuxbugs, martijn, mathias.nyman, matt, mgs.kernel, mlkcampion, oyvind, qbarnes, R.E.Wolff, raulvior.bcn, sandro.stross, sapier, shyam-sundar.s-k, stf_xl, stuart.alan.small, stulluk, t.clastres, tisaak, viniciuspython, wgh, ZeroBeat
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: >= 4.20 Tree: Mainline
Regression: Yes
Attachments: dmesg output before reboot
dmesg output after reboot
rt2x00_revert_4.20_changes.patch
Patch adding doorbell tracing
Dmesg log and trace file
Logs after flushing endpoint
Patch handling halted endpoints at completion of stop endpoint command
Logs after applying the patch
Logs after applying the patch
Patch v2 1/2 handling halted endpoints at completion of stop endpoint command
Patch v2 2/2 handling halted endpoints at completion of stop endpoint command
Patch from Nyman's rewrite_halt_stop_handling branch
rt2800usb_no_soft_retry.patch
rt2800usb_no_soft_retry_v2.patch
0001-usb-xhci-do-not-perform-Soft-Retry-for-some-xHCI-hos.patch
asmedia_subsytem_quirks.patch
Dmesg of a Toshiba USB 3.0 HDD connected to USB 3.0 front port and back port.
Dmesg of a OnePlus 7 Pro connecting in USB 3.1 gen1 mode. No errors.
xhci no soft retry for Intel xhci 8086:06ed and 8086:31a8

Description Bernhard 2019-02-09 16:41:04 UTC
After upgrading to the 4.20 Kernel(was using 4.19 previously) my usb wifi stick doesn´t work until I reboot the system. This issue happens every time I start my pc(only when the system was shut down, it doesn´t happen after rebooting). The wifi driver in use is rt2800usb. I tried restarting the NetworkManager, but this didn´t change anything.
Comment 1 Stanislaw Gruszka 2019-03-10 10:39:39 UTC
Hmm, that's strange perhaps this is some USB host problem. Please provide dmesg of your system.
Comment 2 Bernhard 2019-03-10 11:51:19 UTC
Created attachment 281677 [details]
dmesg output before reboot
Comment 3 Bernhard 2019-03-10 11:51:46 UTC
Created attachment 281679 [details]
dmesg output after reboot
Comment 4 Stanislaw Gruszka 2019-03-10 13:59:34 UTC
We have this xhci_hcd warning on bad case:

 xhci_hcd 0000:15:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state

Not sure where it come from. But I notice you are using AMD IOMMU which we have troubles with with different drivers. 

You could try to disable iommu via kerenl boot parameter and check if that improve things. You could also try test this patch if possible:
https://bugzilla.kernel.org/attachment.cgi?id=281675

If none of that helps I will prepare some rt2800 patches to see if this not caused by some of v4.19 .. v4.20 rt2800 commits:

0240564430c0 rt2800: flush and txstatus rework for rt2800mmio
adf26a356f13 rt2x00: use different txstatus timeouts when flushing
5022efb50f62 rt2x00: do not check for txstatus timeout every time on tasklet
0b0d556e0ebb rt2800mmio: use txdone/txstatus routines from lib
5c656c71b1bf rt2800: move usb specific txdone/txstatus routines to rt2800lib
f483039cf51a rt2x00: use simple_read_from_buffer()

But I would rather suspect problem introduced in AMD IOMMU or usb/xhci drivers.
Comment 5 Bernhard 2019-03-10 22:32:28 UTC
I tried disabling iommu, and I also compiled the 4.20.15 kernel from source with that patch applied, but the wifi didn´t work in both cases either.
Comment 6 Stanislaw Gruszka 2019-03-11 14:18:25 UTC
Created attachment 281711 [details]
rt2x00_revert_4.20_changes.patch

Please test this patch and report if it makes problem gone or not.
Comment 7 Bernhard 2019-03-11 14:51:47 UTC
The problem is still there after applying that patch.
Comment 8 Stanislaw Gruszka 2019-03-11 15:22:06 UTC
You need to report this bug usb maintainers. I'm changing the topic and component, but USB bugs should be reported directly to mailing list.
Comment 9 Stanislaw Gruszka 2019-03-11 15:22:50 UTC
Please send bug report to  linux-usb@vger.kernel.org
Comment 10 Michael 2019-04-05 19:46:31 UTC
I can confirm this issue. Also I can confirm that other USB devices are effected, too (mostly if plugged into an USB3 port).
For example:
ID 7392:7710 Edimax Technology Co., Ltd (mt7601u)
WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

dmesg doesn't show IOMMU warnings, so I assume it is a problem introduced in usb/xhci driver.
Comment 11 Bernhard 2019-04-06 02:00:56 UTC
(In reply to Michael from comment #10)
> I can confirm this issue. Also I can confirm that other USB devices are
> effected, too (mostly if plugged into an USB3 port).
> For example:
> ID 7392:7710 Edimax Technology Co., Ltd (mt7601u)
> WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
> 
> dmesg doesn't show IOMMU warnings, so I assume it is a problem introduced in
> usb/xhci driver.

I think this affects only a specific hardware configuration(I've tried using my wifi stick on a different machine and it worked without problems).
Which hardware are you using? Maybe there are some parts we have in common.

My hardware configuration:
CPU: AMD Ryzen 3 2200G, Motherboard: MSI B350 PC MATE
GPU: AMD Radeon RX 580 8GB
Comment 12 Michael 2019-04-06 07:40:43 UTC
@ Bernhard
The parts we have in common : AMD RYZEN

AMD RYZEN 1700 MSI X370 KRAIT, MSI AERO GTX1080Ti, 5.0.6-arch1-1-ARCH (system was also affected by IOMMU issue - but that is fixed)

Affected USB WiFi devices (tested):
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter (ALFA AWUS036NH - rt2800usb)
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter (ipTime/ zioncom  - rt2800usb)
ID 7392:7710 Edimax Technology Co., Ltd (mt7601u)
ID 7392:a812 Edimax Technology Co., Ltd (Edimax EW-7811USC - rtl88xxau)
ID 148f:761a Ralink Technology, Corp. MT7610U ("Archer T2U" 2.4G+5G WLAN Adapter  - mt76x0)
ID 0b05:17d1 ASUSTek Computer, Inc. AC51 802.11a/b/g/n/ac Wireless Adapter [Mediatek MT7610U] 
ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
I'm sure there are more.

After he has fixed some driver / IOMMU issues, Stanislaw has found out, that it possibly could be a xhci/driver issue. I share his opinion.

You can read more about the issues here:
https://github.com/ZerBea/hcxdumptool/issues/42
and the fixed IOMMU issue here:
https://bugzilla.kernel.org/show_bug.cgi?id=202241
Comment 13 Stanislaw Gruszka 2019-04-06 08:47:54 UTC
FTR: I think those two commits could help:

commit 6cbcf596934c8e16d6288c7cc62dfb7ad8eadf15
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Mar 22 17:50:15 2019 +0200

    xhci: Fix port resume done detection for SS ports with LPM enabled

commit d92f2c59cc2cbca6bfb2cc54882b58ba76b15fd4
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Fri Mar 22 17:50:17 2019 +0200

    xhci: Don't let USB3 ports stuck in polling state prevent suspend

Also I'm not sure if if issue was reported to proper maintainer. If not and problem is not already fixed on latest upstream, either bisection will be needed to precede with this bug or fill properly informative bug report to proper maintainer.
Comment 14 Michael 2019-04-06 09:27:40 UTC
@ Stanislaw, thanks for additional information.

@ Bernhard, ‎have you already sent this bug report to linux-usb mailing list?

can we change affected kernel version from 4.20 to >= 4.20, because 5.0.6 is affected, too?
Comment 15 Bernhard 2019-04-06 10:15:17 UTC
Yes, I already sent this to the mailing list, but I got no response unfortunately.

I've changed the affected kernel version btw.
Comment 16 Michael 2019-04-06 10:28:05 UTC
@ Bernhard, thanks for your answer. So there is no need for me to report this issue, too.
Comment 17 Bernhard 2019-04-06 11:31:23 UTC
I just tried the two patches Stanislaw mentioned, but the problem is still there.
Comment 18 Michael 2019-04-06 11:57:00 UTC
Tried them, too, some days ago, but the didn't solve the issue.
Just downloaded 5.1rc3, but I don't expect a working driver (usb/host), inside.
Comment 19 Michael 2019-04-06 22:36:40 UTC
Tested an ASUS X555U (Intel i5-6200 - 5.0.6-arch1-1-ARCH) and that system is affected, if the device is plugged into one of the USB3 ports. The device is working, if plugged into the USB2 port.
Comment 20 Bernhard 2019-04-07 01:15:44 UTC
I just tried replacing the xhci_ring.c file with the version from the 4.19 kernel, that solved the problem. Then I started patching the code until the problem occurs again. 
The change in the function "static int process_bulk_intr_td" is causing the problem, it's part of this patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/drivers/usb/host/xhci-ring.c?id=9703fc8caf36ac65dca1538b23dd137de0b53233
Comment 21 Stanislaw Gruszka 2019-04-07 08:17:17 UTC
Berna(In reply to Bernhard from comment #20)
> I just tried replacing the xhci_ring.c file with the version from the 4.19
> kernel, that solved the problem. Then I started patching the code until the
> problem occurs again. 
> The change in the function "static int process_bulk_intr_td" is causing the
> problem, it's part of this patch:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/
> drivers/usb/host/xhci-ring.c?id=9703fc8caf36ac65dca1538b23dd137de0b53233

Good findings, great. This seems to be part of 

commit f8f80be501aa2f10669585c3e328fad079d8cb3a
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Thu Sep 20 19:13:37 2018 +0300

    xhci: Use soft retry to recover faster from transaction errors

Just add information you found in the posted linux-usb email and CC "Mathias Nyman <mathias.nyman@linux.intel.com>" to make sure he is aware of the problem.
Comment 22 Michael 2019-04-07 09:08:51 UTC
The issue isn't fixed in 5.1rc3, so it look's like Mathias Nyman isn't aware of the problem, yet.
Comment 23 Michael 2019-05-20 08:04:25 UTC
Still present in 5.1.2
Comment 24 Michael 2019-06-08 19:24:48 UTC
This issue is really funny:
running
D 0b05:17d1 ASUSTek Computer, Inc. AC51 802.11a/b/g/n/ac Wireless Adapter [Mediatek MT7610U]

on kernel
$ uname -r
5.1.7-arch1-1-ARCH

will spam the log after the know WARN
43163.034783] mt76x0u 1-10.2:1.0 wlp3s0f0u10u2: renamed from wlan0
[43163.351656] usb 1-10.2: USB disconnect, device number 6
[43163.352176] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

with tons of failed vendor requests:
[43160.683383] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3dc failed:-71
[43160.813398] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3e0 failed:-71
[43160.943415] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3e4 failed:-71
[43161.073440] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3e8 failed:-71
[43161.203439] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3ec failed:-71
[43161.333458] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3f0 failed:-71
[43161.463468] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3f4 failed:-71
[43161.593561] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3f8 failed:-71
[43161.723502] mt76x0u 1-10.2:1.0: vendor request req:06 off:c3fc failed:-71
[43161.853512] mt76x0u 1-10.2:1.0: vendor request req:06 off:108c failed:-71
....
Comment 25 Michael 2019-06-09 17:59:30 UTC
If the same device is connected to an Intel Core I5-6200 system (USB3 port), the log looks different to the AMD RYZEN system.

[  204.231872] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.231901] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.231940] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.231980] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232020] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232188] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232226] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232275] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232304] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.232345] mt76x0u 1-1:1.0: rx urb failed: -71
[  204.233284] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[  204.233291] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
[  204.263427] mt76x0u 1-1:1.0: TX DMA did not stop
[  207.596726] mt76x0u 1-1:1.0: Warning: MAC TX did not stop!
[  209.650050] mt76x0u 1-1:1.0: Warning: MAC RX did not stop!
[  209.651133] mt76x0u 1-1:1.0: RX DMA did not stop

Also I noticed some changes in xhci-ring.c between 5.1.7 and 5.2_rc4. Maybe they'll fix the problem. I didn't tested it, yet.
Comment 26 Bernhard 2019-06-09 18:12:43 UTC
I already tried the 5.2-rc3 kernel and the problem isn't fixed yet. There were no changes in the xhci driver between rc3 and rc4, so it's very unlikely that the problem doesn't occur in the 5.2-rc4 kernel.
Comment 27 Michael 2019-06-09 18:23:33 UTC
Thanks for the information. I skipped 5.2rc1 ... rc3.

But with your information, there is no real need for me to run some more tests.

Unfortunately it looks like the issue is back ported to older kernel versions (4.19), because I got some issue reports here, too:
https://github.com/ZerBea/hcxdumptool/issues/57

and 90% of my devices doesn't work any longer.
Comment 28 Bernhard 2019-06-09 18:41:16 UTC
When did it get back ported? I'm on 4.19.48 and haven't had a problem with this version...
Comment 29 Michael 2019-06-09 19:46:43 UTC
It's just a guess, because of this post:
https://github.com/ZerBea/hcxdumptool/issues/57#issuecomment-483964293

But it looks like the device was working before that post. 
I cant test it, because I have not such a device.

I tested a TP-LINK Archer T2UH and this device is not working on 4.19.46 arm (Raspberry Pi).
Comment 30 Michael 2019-06-09 19:48:54 UTC
Yes, rt2800usb is working fine on 4.19.46.
Comment 31 Michael 2019-06-10 07:44:05 UTC
hcxdumptool running on kernel 4.19.46 arm doesn't receive packets on several different devices. In this case:
ID 0b05:17d1 ASUSTek Computer, Inc. AC51 802.11a/b/g/n/ac Wireless Adapter [Mediatek MT7610U]
INFO: cha=1, rx=0, rx(dropped)=0, tx=18, err=0, aps=0 (0 in range)

while a few other devices still working
INFO: cha=1, rx=805, rx(dropped)=0, tx=93, err=0, aps=29 (21 in range)

BTW:
I'm running/testing only devices on which driver support monitor mode and packet injection.

Very interesting on that arm kernel is that dmesg doesn't show any WARNs.
Comment 32 Michael 2019-06-20 16:07:12 UTC
Still no fix?
$ uname -r
5.1.11-arch1-1-ARCH

and most of the USB devices WiFI, BLUETOOTH,....) are still not working:
32942.700591] usb 1-10.4: new full-speed USB device number 7 using xhci_hcd
[32944.721410] usb 1-10.4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=52.76
[32944.721412] usb 1-10.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[32945.069015] Bluetooth: hci0: hardware error 0x37

How about kernel 5.2?
Comment 33 Michael 2019-06-21 07:32:33 UTC
Some USB card readers are also affected (connected to USB 3 port):

$ uname -r
5.1.12-arch1-1-ARCH

[ 3510.100114] usb 2-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[ 3510.134121] usb 2-2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 0.02
[ 3510.134126] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3510.134128] usb 2-2: Product: Intenso Ultra Line  
[ 3510.134130] usb 2-2: Manufacturer: ALCOR          
...
[ 5129.997608] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
[ 5130.218618] sd 9:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[ 5130.218631] sd 9:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 20 c3 c0 00 00 20 00
[ 5130.218637] print_req_error: I/O error, dev sdb, sector 2147264 flags 80700

I really wonder why that issue hasn't been fixed, yet, because many, many devices are affected.
Comment 34 Bernhard 2019-06-21 13:57:28 UTC
The list of changes for 5.2-rc6 contains this two commits:

Mathias Nyman (2):
      usb: xhci: Don't try to recover an endpoint if port is in error state.
      xhci: detect USB 3.2 capable host controllers correctly

I think this could be the fix for this issue.
Comment 35 Michael 2019-06-21 14:40:50 UTC
Great, thanks for the information. The issue is really ugly, because many USB devices are affected (hdd, card reader, bleutooth, wlan, ... - this list is long)
I'll check 5.2-rc6.
Comment 36 Bernhard 2019-06-24 00:53:47 UTC
Just tried 5.2-rc6, but unfortunately I still have the same issue.
Comment 37 Michael 2019-06-24 06:27:32 UTC
Thanks for the information. I tested 5.2-rc6, too. Even an USB 3.0 HDD isn't working.
Comment 38 Michael 2019-07-11 08:32:59 UTC
Now running mainline kernel 5.2 and the issue still exists.
Tested on this device:
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
but the same applies to many other devices, too

dmesg after plug in the device:

[75.482165] usb 1-2: new high-speed USB device number 6 using xhci_hcd
[75.639236] usb 1-2: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[75.639238] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[75.639239] usb 1-2: Product: 802.11 n WLAN
[75.639240] usb 1-2: Manufacturer: Ralink
[75.639241] usb 1-2: SerialNumber: 1.0
[75.952611] usb 1-2: reset high-speed USB device number 6 using xhci_hcd
[76.107232] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[76.120228] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 0005 detected
[76.121079] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[76.130873] usbcore: registered new interface driver rt2800usb
[76.194447] audit: type=1130 audit(1562833499.983:49): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[76.195313] rt2800usb 1-2:1.0 wlp0s20f0u2: renamed from wlan0
[76.216178] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[76.241382] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[76.544022] ieee80211 phy1: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0404 with error -71
[77.562305] ieee80211 phy1: rt2800_wait_csr_ready: Error - Unstable hardware
[77.562316] ieee80211 phy1: rt2800usb_set_device_state: Error - Device failed to enter state 4 (-5)
...
followed by this message on access to the interface:
[341.598563] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[341.598573] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
Comment 39 Michael 2019-07-11 08:57:33 UTC
BTW:
The tested device is an ALFA AWUS036NH and I really can't see "Unstable hardware" here.
Comment 40 Bernhard 2019-07-11 11:23:41 UTC
I don't really think the problem is caused by the WIFI stick itself, maybe the cause is the xHCI controller from the motherboard? We're both using a 300-series AM4 board(even the same brand), so we probably have the same controller.

Btw. I've already tried the git snapshot from 5.3-rc1, problem isn't fixed there either.
Comment 41 Michael 2019-07-11 11:43:46 UTC
No, I don't think it's the controller. I'm running three different systems here:
RYZEN 1700, MSI X370 KRAIT
INTEL I5-6200U, ASUS X555U (notebook)
INTEL i7-3930K, ASUS P9X79
and all of them running into the same issue. Also, not all of the testing devices are affected. Some devices are still working as expected (for example TENDA W311U+), while others failed epically (ALFA AWUSH036NH). The same applies to several bluetooth devices.
Absolutely new (and really funny) is the error message "Unstable hardware" on 5.2.
Comment 42 Michael 2019-07-11 13:46:59 UTC
And 5.2 makes things more worse. Most of my adapters are not working.

EDIMAX EW-7711UAN V2
ID 7392:7710 Edimax Technology Co., Ltd

[  228.451035] usb 1-2: new high-speed USB device number 53 using xhci_hcd
[  228.629543] usb 1-2: New USB device found, idVendor=7392, idProduct=7710, bcdDevice= 0.00
[  228.629548] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  228.629550] usb 1-2: Product: Edimax Wi-Fi
[  228.629552] usb 1-2: Manufacturer: MediaTek
[  228.629554] usb 1-2: SerialNumber: 1.0
[  228.779827] usb 1-2: reset high-speed USB device number 53 using xhci_hcd
[  229.037761] mt7601u 1-2:1.0: ASIC revision: 76010001 MAC revision: 76010500
[  229.064654] mt7601u 1-2:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____
[  230.045089] mt7601u 1-2:1.0: EEPROM ver:0d fae:00
[  230.055724] mt7601u 1-2:1.0: EEPROM country region 01 (channels 1-13)
[  230.763955] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[  231.084339] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[  231.404311] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[  231.724294] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[  232.044298] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[  232.044301] mt7601u 1-2:1.0: Error: mt7601u_mcu_wait_resp timed out
[  232.044485] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[  232.046810] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[  232.197641] mt7601u 1-2:1.0: Vendor request req:07 off:0080 failed:-71
[  232.347631] mt7601u 1-2:1.0: Vendor request req:02 off:0080 failed:-71
[  232.497630] mt7601u 1-2:1.0: Vendor request req:02 off:0080 failed:-71
[  232.497675] mt7601u: probe of 1-2:1.0 failed with error -110


LOGILINK WL0150
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

[  527.994013] usb 1-2: new high-speed USB device number 86 using xhci_hcd
[  528.238517] usb 1-2: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[  528.238519] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  528.238521] usb 1-2: Product: 802.11 n WLAN
[  528.238522] usb 1-2: Manufacturer: Ralink
[  528.238523] usb 1-2: SerialNumber: 1.0
[  528.495914] usb 1-2: reset high-speed USB device number 86 using xhci_hcd
[  528.747058] ieee80211 phy81: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[  529.426163] ieee80211 phy81: rt2x00_set_rf: Info - RF chipset 5370 detected
[  529.432544] ieee80211 phy81: Selected rate control algorithm 'minstrel_ht'
[  529.433131] usbcore: registered new interface driver rt2800usb
[  529.447058] audit: type=1130 audit(1562850994.757:43): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  529.447260] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[  534.453471] audit: type=1131 audit(1562850999.761:44): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  560.993915] ieee80211 phy81: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  561.000105] ieee80211 phy81: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[  599.002238] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.


Delock Bluetooth USB :
ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady

[ 1641.910015] usb 1-2: new full-speed USB device number 94 using xhci_hcd
[ 1642.126667] usb 1-2: device descriptor read/64, error -71
[ 1644.002791] usb 1-2: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=52.76
[ 1644.002795] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 1644.002798] usb 1-2: Product: BT2.0
[ 1644.026094] audit: type=1130 audit(1562852109.344:79): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1644.286731] Bluetooth: hci0: hardware error 0x37


Logilink Bluetooth USB
ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady

[ 1641.910015] usb 1-2: new full-speed USB device number 94 using xhci_hcd
[ 1642.126667] usb 1-2: device descriptor read/64, error -71
[ 1644.002791] usb 1-2: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=52.76
[ 1644.002795] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 1644.002798] usb 1-2: Product: BT2.0
[ 1644.026094] audit: type=1130 audit(1562852109.344:79): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1644.286731] Bluetooth: hci0: hardware error 0x37

Also funny this error message, here: "hardware error".


DL-Link DBT-122 Bluetooth USB
ID 07d1:f101 D-Link System DBT-122 Bluetooth

[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady

The device list of not working devices is long....
Comment 43 Michael 2019-07-11 13:51:21 UTC
Sorry, copy and paste error of the last dmesg log. Due to several tests, dmesg log was flooded by warnings and error messages.
I'll stop the tests and will wait for next LTS kernel.
Comment 44 Michael 2019-07-12 06:25:29 UTC
BTW:
For me the issue started at this point:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=x86/build&id=72a9c673636b779e370983fea08e40f97039b981
when the Linux kernel's default i386/x86_64 kernel configurations shiped with USB 3.0 support enabled (CONFIG_USB_XHCI_HCD).
Comment 45 Stanislaw Gruszka 2019-07-19 10:32:02 UTC
Looks like there was requested a debug tracing, what was ignored:

https://lore.kernel.org/linux-usb/520462de-9a7f-d3f3-2cce-e4be045cf8b2@linux.intel.com/
Comment 46 Bernhard 2019-07-19 11:31:44 UTC
I didn't ignore it, I sent it to Mathias Nyman only, and not to the whole mailing list("Send output to me" didn't sound like I should send it to the whole mailing list but idk). I have to admit that the first traces weren't really useful though, when I ran the commands he told me the traces started too late(because the error happens immediately after system startup, so when I run this commands after startup the important part is missing). 

Then he gave me instructions how to enable tracing at startup, which only resulted in this error: [ 0.172042] Failed to enable trace event: xhci-hcd
and the tracing file was empty afterwards. 

Just about one week ago I had another idea how I could get it working, and it actually worked. The solution was to just unplug the wifi stick at boot, then enable tracing and plug in the stick again(I don't know why I didn't try that a few months ago tbh). I've sent the two files(dmesg and tracing) to Mathias Nyman again, but this time he didn't respond(I've sent the mail on July 11th). 

Should I send the whole tracing file and dmesg log to the mailing list instead? What is the preferred way to send files that are too big for an e-mail(tracing is around 17.6MB in size)?
Comment 47 Stanislaw Gruszka 2019-07-22 07:54:20 UTC
Bernhard, thanks for the update and provide debug data to the maintainer.

I think you should ping him on mailing list and ask if anything else need to be provided or how to precede otherwise. Maybe we can we just revert the patch?

This issue is annoying and I see more users entering it (and blaming mt76x0u or rt2800usb drivers). It should not be hard to fix since is regression (commit causing it is known) and is reproducible.

Please also point that changes in process_bulk_intr_td() are main cause of the problem as stated in comment 20.
Comment 48 Michael 2019-07-29 17:12:12 UTC
This issue is blaming nearly everything (like this SAMSUNG Galaxy S3):

[34385.294067] usb 1-2: new high-speed USB device number 6 using xhci_hcd
[34385.465017] usb 1-2: New USB device found, idVendor=18d1, idProduct=4ee7, bcdDevice= 2.26
[34385.465022] usb 1-2: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[34385.465025] usb 1-2: Product: GT-I9300
[34385.465028] usb 1-2: Manufacturer: samsung
...
[35074.182055] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Comment 49 Michael 2019-08-24 07:03:55 UTC
Bernhard, running my RYZEN for some days and noticed that tha xhci issue also 
affected the USB keyboard and the USB mouse:


At this time, the system is allready running for 2 days:
Aug 24 08:38:41.665376 tux1 kernel: usb 1-12: new low-speed USB device number 19 using xhci_hcd
Aug 24 08:38:42.001609 tux1 kernel: usb 1-12: New USB device found, idVendor=046a, idProduct=0011, bcdDevice= 1.00
Aug 24 08:38:42.001850 tux1 kernel: usb 1-12: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Aug 24 08:38:42.098291 tux1 kernel: hid-generic 0003:046A:0011.0003: input,hidraw0: USB HID v1.11 Keyboard [HID 046a:0011] on usb-0000:03:00.0-12/input0
Aug 24 08:38:43.631091 tux1 kernel: usb 1-12: input irq status -75 received
Aug 24 08:38:43.631384 tux1 kernel: usb usb1-port12: disabled by hub (EMI?), re-enabling...
Aug 24 08:38:43.631409 tux1 kernel: usb 1-12: USB disconnect, device number 19
Aug 24 08:38:44.025057 tux1 kernel: usb 1-12: new low-speed USB device number 20 using xhci_hcd
Aug 24 08:38:44.361600 tux1 kernel: usb 1-12: New USB device found, idVendor=046a, idProduct=0011, bcdDevice= 1.00
Aug 24 08:38:44.361839 tux1 kernel: usb 1-12: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Aug 24 08:38:44.401604 tux1 kernel: input: HID 046a:0011 as /devices/pci0000:00/0000:00:01.3/0000:03:00.0/usb1/1-12/1-12:1.0/0003:046A:0011.0004/input/input18
Aug 24 08:38:44.458277 tux1 kernel: hid-generic 0003:046A:0011.0004: input,hidraw0: USB HID v1.11 Keyboard [HID 046a:0011] on usb-0000:03:00.0-12/input0
Aug 24 08:38:49.031776 tux1 kernel: usb 1-12: input irq status -75 received
Aug 24 08:38:49.032082 tux1 kernel: usb usb1-port12: disabled by hub (EMI?), re-enabling...
Aug 24 08:38:49.032099 tux1 kernel: usb 1-12: USB disconnect, device number 20
Aug 24 08:38:49.425365 tux1 kernel: usb 1-12: new low-speed USB device number 21 using xhci_hcd
Aug 24 08:39:04.905175 tux1 kernel: usb 1-12: device descriptor read/64, error -110
Aug 24 08:39:20.478280 tux1 kernel: usb 1-12: device descriptor read/64, error -110
Aug 24 08:39:20.774967 tux1 kernel: usb 1-12: new low-speed USB device number 22 using xhci_hcd
Aug 24 08:39:36.331757 tux1 kernel: usb 1-12: device descriptor read/64, error -110
Aug 24 08:39:51.838723 tux1 kernel: usb 1-12: device descriptor read/64, error -110
Aug 24 08:39:51.945370 tux1 kernel: usb usb1-port12: attempt power cycle
Aug 24 08:39:52.588394 tux1 kernel: usb 1-12: new low-speed USB device number 23 using xhci_hcd
Aug 24 08:39:57.415723 tux1 kernel: usb 1-12: Device not responding to setup address.
Aug 24 08:40:02.448295 tux1 kernel: usb 1-12: Device not responding to setup address.
Aug 24 08:40:02.655042 tux1 kernel: usb 1-12: device not accepting address 23, error -71
Aug 24 08:40:02.778269 tux1 kernel: usb 1-12: new low-speed USB device number 24 using xhci_hcd
Aug 24 08:40:07.604975 tux1 kernel: usb 1-12: Device not responding to setup address.
Aug 24 08:40:12.638751 tux1 kernel: usb 1-12: Device not responding to setup address.
Aug 24 08:40:12.845561 tux1 kernel: usb 1-12: device not accepting address 24, error -71
Aug 24 08:40:12.845696 tux1 kernel: usb usb1-port12: unable to enumerate USB device

At this time only hard power off will help.

I got rid of that and reverted the ugly xhci patch. Will now see if that will solve the xhci issue.
Comment 50 Bernhard 2019-08-24 11:40:45 UTC
Was one of the affected USB devices plugged in and you rebooted to get the wifi working? Or did that happen even without the device plugged in?

I've noticed once that even after if I rebooted my system to get wifi working, my external HDD didn't work after plugging it in, so I had to reboot again to get that working... 

I'm just using the LTS kernel right now, which works fine for me, but because of that bug I'm kinda limited when choosing a distribution since most distros don't offer different kernel versions and I don't really want to recompile my kernel every time.
Comment 51 Michael 2019-08-24 12:27:45 UTC
No, it happened without a warning. Keyboard LED flashed some times, according to the device descriptor errors. This was the first time I noticed something like that and only on the RYZEN machine.
We talked about that xhci issue in other (git) threads, too:
https://github.com/aircrack-ng/rtl8812au/issues/376#issuecomment-522169478

BTW:
LTS kernel (4.19) still working fine here, too. In my opinion xhci host is unstable since 4.20. I noticed that everytime, when testing/improving a driver.
Comment 52 Michael 2019-08-24 14:04:56 UTC
I noticed the same behavior. Not on an USB hdd, but on an USB ram:

This is an INTENSO USB 2 ALU LINE 64 GB USB stick:

[ 1032.600762] usb 1-11.4: new high-speed USB device number 15 using xhci_hcd
[ 1032.626487] hub 1-11:1.0: hub_ext_port_status failed (err = -71)
[ 1032.629487] usb 1-11-port4: cannot reset (err = -71)
[ 1032.632491] usb 1-11-port4: cannot reset (err = -71)
[ 1032.635486] usb 1-11-port4: cannot reset (err = -71)
[ 1032.638482] usb 1-11-port4: cannot reset (err = -71)
[ 1032.638483] usb 1-11-port4: Cannot enable. Maybe the USB cable is bad?

The stick is ok plugged in on another port:
[ 1465.770379] usb 1-11.4: USB disconnect, device number 23
[ 1708.302214] usb 1-2: new high-speed USB device number 24 using xhci_hcd
[ 1708.471933] usb 1-2: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.ff
[ 1708.471938] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1708.471940] usb 1-2: Product: Intenso Alu Line
[ 1708.471943] usb 1-2: Manufacturer: 6989
[ 1708.471945] usb 1-2: SerialNumber: 21F84CE8
[ 1708.479111] usb-storage 1-2:1.0: USB Mass Storage device detected

re-plugged in on 1-11-port4:
[ 1776.661289] usb 1-11.4: new high-speed USB device number 25 using xhci_hcd
[ 1776.810678] usb 1-11.4: New USB device found, idVendor=058f, idProduct=6387, bcdDevice= 1.ff
[ 1776.810684] usb 1-11.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1776.810687] usb 1-11.4: Product: Intenso Alu Line
[ 1776.810691] usb 1-11.4: Manufacturer: 6989
[ 1776.810694] usb 1-11.4: SerialNumber: 21F84CE8
[ 1776.817710] usb-storage 1-11.4:1.0: USB Mass Storage device detected


That leads me to the assumption that the xhci host is unstable, at least in combination with my controller:


[    1.325164] xhci_hcd 0000:03:00.0: hcc params 0x0200ef81 hci version 0x110 quirks 0x0000000008000410
[    1.325319] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.02
[    1.325321] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.325322] usb usb1: Product: xHCI Host Controller
[    1.325323] usb usb1: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.325323] usb usb1: SerialNumber: 0000:03:00.0
[    1.325428] hub 1-0:1.0: USB hub found
[    1.325443] hub 1-0:1.0: 14 ports detected
[    1.325922] xhci_hcd 0000:03:00.0: xHCI Host Controller
[    1.325925] xhci_hcd 0000:03:00.0: new USB bus registered, assigned bus number 2
[    1.325927] xhci_hcd 0000:03:00.0: Host supports USB 3.1 Enhanced SuperSpeed
[    1.325958] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.325974] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.02
[    1.325976] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.325977] usb usb2: Product: xHCI Host Controller
[    1.325978] usb usb2: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.325979] usb usb2: SerialNumber: 0000:03:00.0
[    1.326046] hub 2-0:1.0: USB hub found
[    1.326057] hub 2-0:1.0: 8 ports detected
[    1.326289] usb: port power management may be unreliable
[    1.326451] xhci_hcd 0000:25:00.0: xHCI Host Controller
[    1.326454] xhci_hcd 0000:25:00.0: new USB bus registered, assigned bus number 3
[    1.381302] xhci_hcd 0000:25:00.0: hcc params 0x0200ef81 hci version 0x110 quirks 0x0000000000000010
[    1.381657] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.02
[    1.381658] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.381658] usb usb3: Product: xHCI Host Controller
[    1.381659] usb usb3: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.381660] usb usb3: SerialNumber: 0000:25:00.0
[    1.381737] hub 3-0:1.0: USB hub found
[    1.381744] hub 3-0:1.0: 2 ports detected
[    1.381830] xhci_hcd 0000:25:00.0: xHCI Host Controller
[    1.381832] xhci_hcd 0000:25:00.0: new USB bus registered, assigned bus number 4
[    1.381834] xhci_hcd 0000:25:00.0: Host supports USB 3.0 SuperSpeed
[    1.381863] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.381878] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.02
[    1.381880] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.381880] usb usb4: Product: xHCI Host Controller
[    1.381881] usb usb4: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.381882] usb usb4: SerialNumber: 0000:25:00.0
[    1.381941] hub 4-0:1.0: USB hub found
[    1.381947] hub 4-0:1.0: 2 ports detected
[    1.382075] xhci_hcd 0000:27:00.3: xHCI Host Controller
[    1.382077] xhci_hcd 0000:27:00.3: new USB bus registered, assigned bus number 5
[    1.382170] xhci_hcd 0000:27:00.3: hcc params 0x0270f665 hci version 0x100 quirks 0x0000000000000410
[    1.382268] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.02
[    1.382269] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.382270] usb usb5: Product: xHCI Host Controller
[    1.382271] usb usb5: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.382272] usb usb5: SerialNumber: 0000:27:00.3
[    1.382335] hub 5-0:1.0: USB hub found
[    1.382341] hub 5-0:1.0: 4 ports detected
[    1.382498] xhci_hcd 0000:27:00.3: xHCI Host Controller
[    1.382500] xhci_hcd 0000:27:00.3: new USB bus registered, assigned bus number 6
[    1.382501] xhci_hcd 0000:27:00.3: Host supports USB 3.0 SuperSpeed
[    1.382512] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.382527] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.02
[    1.382528] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.382529] usb usb6: Product: xHCI Host Controller
[    1.382530] usb usb6: Manufacturer: Linux 5.2.9-arch1-1-ARCH xhci-hcd
[    1.382531] usb usb6: SerialNumber: 0000:27:00.3
Comment 53 Michael 2019-09-07 10:19:48 UTC
tested another USB controller (at this time 3.1) and the results are even worse than on USB 3.0:
USB controller: Advanced Micro Devices, Inc. [AMD] X370 Series Chipset USB 3.1 xHCI Controller (rev 02)
and
TENDA W311U+
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
This device is one of the few that work on an USB 3.0 controller 
Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) 

but it failed epically on USB 3.1:
[ 1213.285622] rt2800usb 5-3.1.2:1.0 wlp39s0f3u3u1u2: renamed from wlan0
[ 1218.918384] ieee80211 phy6: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[ 1218.918427] ieee80211 phy6: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[ 1219.222282] device wlp39s0f3u3u1u2 entered promiscuous mode
[ 1220.797413] rt2800usb_tx_sta_fifo_read_completed: 186 callbacks suppressed
[ 1220.797417] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797452] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797531] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797611] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797692] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797772] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797851] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.797931] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.798011] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.798091] ieee80211 phy6: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71
[ 1220.814661] xhci_hcd 0000:27:00.3: WARN Cannot submit Set TR Deq Ptr
[ 1220.814663] xhci_hcd 0000:27:00.3: A Set TR Deq Ptr command is pending.
[ 1221.378769] ieee80211 phy6: rt2x00queue_flush_queue: Warning - Queue 0 failed to flush
[ 1221.409201] device wlp39s0f3u3u1u2 left promiscuous mode


I really hope it will be fixed until we reach next LTS-KERNEL.
Comment 54 Michael 2019-09-07 10:40:39 UTC
and more and more devices are affected:
https://github.com/dresden-elektronik/deconz-rest-plugin/issues/1640
Comment 55 Michael 2019-09-08 09:09:09 UTC
@  Stanislaw Gruszka
We once talked about a rt2800usb issue (rt2800usb stops receiving) here:
https://bugzilla.kernel.org/show_bug.cgi?id=202243#c19

Now, I'm not sure, if it is related to this xhci issue or not, because I get it sometimes on kernel 4.19, too.

After doing setsockopt PACKET_MR_PROMISC:
https://github.com/ZerBea/hcxdumptool/blob/master/hcxdumptool.c#L5513

dmesg will show this warning (in this case running an USB 2.0 controller):
[ 1687.106514] device wlp3s0f0u2 entered promiscuous mode
[ 1687.106551] audit: type=1700 audit(1567932110.523:46): dev=wlp3s0f0u2 prom=256 old_prom=0 auid=1000 uid=0 gid=0 ses=2
[ 1718.525815] ieee80211 phy0: rt2x00queue_flush_queue: Warning - Queue 14 failed to flush
[ 1718.558846] device wlp3s0f0u2 left promiscuous mode
[ 1718.558888] audit: type=1700 audit(1567932141.974:47): dev=wlp3s0f0u2 prom=0 old_prom=256 auid=1000 uid=0 gid=0 ses=2

The adapter stops working until it is plugged out and plugged in again:
[ 1722.950110] usb 1-2: USB disconnect, device number 5

If you think it is not related to this issue, I can open a new rt2800usb issue.
Comment 56 Koen 2019-09-22 12:02:02 UTC
Hi,

a google search led me here. I'm getting the same error on my Lenovo Thinkpad X220 running Kubuntu 19.04. Everytime I plug in an USB memory stick or a SD card I get the following messages in dmesg:

[ 9649.078958] xhci_hcd 0000:05:00.0: WARN Cannot submit Set TR Deq Ptr
[ 9649.078966] xhci_hcd 0000:05:00.0: A Set TR Deq Ptr command is pending.

Linux koen-ThinkPad-X220 5.0.0-29-generic #31-Ubuntu SMP Thu Sep 12 13:05:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Koen
Comment 57 Doug Gale 2019-09-23 22:24:32 UTC
Got this issue on 5.0.0-29-generic, host hardware is Ryzen 2700X on B350 chipset (Asus Prime B350-Plus).

USB Device is Samsung Galaxy A5, Model SM-A520W, Android 8.0

[57460.411327] usb 1-4.1.4: USB disconnect, device number 10
[57460.411566] xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[57460.685963] usb 1-4.1.4: new high-speed USB device number 11 using xhci_hcd
[57460.830379] usb 1-4.1.4: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= 4.00
[57460.830382] usb 1-4.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[57460.830383] usb 1-4.1.4: Product: SAMSUNG_Android
[57460.830385] usb 1-4.1.4: Manufacturer: SAMSUNG
[57460.830386] usb 1-4.1.4: SerialNumber: **withheld**

doug@doug-dt:~$ sudo lspci -s 2:0.0 -vvvvvv
[sudo] password for doug: 
02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 300 Series Chipset USB 3.1 xHCI Controller (rev 02) (prog-if 30 [XHCI])
	Subsystem: ASMedia Technology Inc. 300 Series Chipset USB 3.1 xHCI Controller

I have this kernel parameter to prevent other USB issues: usbcore.autosuspend=-1

Linux doug-dt 5.0.0-29-generic #31~18.04.1-Ubuntu SMP Thu Sep 12 18:29:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Comment 58 Michael 2019-09-24 06:30:55 UTC
This issue still exists on
$ uname -r
5.3.1-arch1-1-ARCH

Sep 24 08:14:00.374050 tux1 kernel: device wlp3s0f0u2 entered promiscuous mode
Sep 24 08:14:39.757848 tux1 kernel: xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Sep 24 08:14:39.758158 tux1 kernel: xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Sep 24 08:14:39.770950 tux1 kernel: mt7601u 1-2:1.0: Warning: TX DMA did not stop!

xhci host is running completely instable after receiving the first warning: 
WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state
Ignoring this warning, the whole system freezes. At this time only a "hard" power off will help.

BTW:
Shouldn't we increase importance (next kernel will be LTS - and this issue will reach the major distributions).
Comment 59 Bernhard 2019-09-24 14:04:54 UTC
I have noticed that I don't get that error("WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state") anymore, even though I still have the same USB issues(maybe something in the rt2800usb driver changed, idk). I've even tried applying all the patches in the "for-usb-linus" branch from Mathias Nyman's git repo - but I still have the same issue. 

Maybe more people should send a message to the usb kernel mailing list(linux-usb@vger.kernel.org)? I didn't get a response the last time but maybe they will address this issue if they see that more users are affected by this regression. 

BTW @Michael:
There is a commit in the for-usb-linus branch that could fix the system freezes you've encountered: https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/commit/?h=for-usb-linus&id=750ed908bbb57153c75b79c50135e7cc94feb4a5
Comment 60 Michael 2019-09-24 14:40:26 UTC
@Bernhard.
Thanks. I'll check it. Also thanks for setting prio to high.
Until the system freezes, I receive the funniest warnings from the xhci system: bad cable, bad device, firmware not loaded,... 

"WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" depend also on the device:
Running a 
148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
I got no "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state"

Running
148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
I got the warning.

Both of them using the rt2800usb driver.

That and the different warnings let me assume, the xhci host is running completely instable, especially when hcxdumptool doing high workload.
Comment 61 Michael 2019-09-26 11:31:27 UTC
It seems that the commit is working - no freeze, up to now.
Comment 62 Michael 2019-09-27 17:40:26 UTC
Nop, doesn't work as expected. No freezes, but:

[ 2914.285601] ieee80211 phy77: Atheros AR9271 Rev:1
[ 2914.286229] ath9k_htc 1-3:1.0 wlp0s20f0u3: renamed from wlan0
[ 2914.389748] usb 1-3: USB disconnect, device number 83
[ 2914.749819] ath: phy77: Failed to wakeup in 500us
[ 2914.760221] ath: phy77: Failed to wakeup in 500us
[ 2914.770309] ath: phy77: Failed to wakeup in 500us
[ 2914.780411] ath: phy77: Failed to wakeup in 500us
[ 2915.283332] usb 1-3: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[ 2915.531824] usb 1-3: ath9k_htc: Firmware - ath9k_htc/htc_9271-1.4.0.fw download failed
[ 2915.532206] usb 1-3: ath9k_htc: USB layer deinitialized
[ 2928.339410] ------------[ cut here ]------------
[ 2928.339505] WARNING: CPU: 1 PID: 704 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[ 2928.339506] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath nfnetlink_queue nfnetlink_log nfnetlink ccm uas usb_storage rt2800usb rt2x00usb rt2800lib rt2x00lib fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo snd_soc_skl videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 snd_soc_hdac_hda snd_hda_codec_hdmi videobuf2_common snd_hda_ext_core videodev snd_soc_skl_ipc snd_hda_codec_realtek rtsx_usb_ms memstick mc snd_soc_sst_ipc x86_pkg_temp_thermal snd_soc_sst_dsp r8169 intel_powerclamp snd_soc_acpi_intel_match snd_soc_acpi coretemp snd_soc_core kvm_intel snd_hda_codec_generic ledtrig_audio realtek snd_compress rtl8821ae ac97_bus kvm libphy irqbypass snd_pcm_dmaengine ipmi_devintf btcoexist ipmi_msghandler crct10dif_pclmul crc32_pclmul i915 rtl_pci rtlwifi mac80211 ghash_clmulni_intel joydev cfg80211 mousedev aesni_intel mei_hdcp libarc4 iTCO_wdt aes_x86_64 i2c_hid crypto_simd snd_hda_intel i2c_algo_bit cryptd asus_nb_wmi iTCO_vendor_support
.....

At this time xhci crashed TP-LINK TL722WN v1.
And that device worked, before...
xhci is still running completely unstable and the delivered warnings are unpredictable.
Comment 63 Vinicius 2019-10-01 02:47:09 UTC
Just providing some information that could be helpful to debug the issue. It is also affecting me.

Kernel version:
# uname -a
Linux arch 5.3.1-arch1-1-ARCH #1 SMP PREEMPT Sat Sep 21 11:33:49 UTC 2019 x86_64 GNU/Linux

Hardware specs: AMD Ryzen 5 2400G

The issue happens when I plug in an Alfa AWUS036NH (148f:3070 Ralink Technology, Corp. RT2870/RT3070) - It uses the module rt2800usb

Below you can find my dmesg output when I plug in the Alfa device:

---
[ 1130.410091] usb 1-10: new high-speed USB device number 5 using xhci_hcd
[ 1130.653103] usb 1-10: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[ 1130.653108] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1130.653111] usb 1-10: Product: 802.11 n WLAN
[ 1130.653113] usb 1-10: Manufacturer: Ralink
[ 1130.653114] usb 1-10: SerialNumber: 1.0
[ 1130.864470] usb 1-10: reset high-speed USB device number 5 using xhci_hcd
[ 1131.110058] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[ 1131.788103] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 0005 detected
[ 1131.794331] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[ 1131.833798] rt2800usb 1-10:1.0 wlp1s0f0u10: renamed from wlan0
[ 1131.834234] audit: type=1130 audit(1569896348.109:56): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 1131.867763] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[ 1131.867797] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[ 1136.117228] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 1136.840084] audit: type=1131 audit(1569896353.117:57): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
---


I don't know if this is useful, but I do have another USB WiFi that uses another module but doesn't trigger the issue when I plug in:
lsusb output: 2357:010c TP-Link TL-WN722N v2

Below is the dmesg output when I plug in the TP-LINK:

---
[ 1697.619576] usb 1-7: new high-speed USB device number 9 using xhci_hcd
[ 1697.846601] usb 1-7: New USB device found, idVendor=2357, idProduct=010c, bcdDevice= 0.00
[ 1697.846603] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1697.846605] usb 1-7: Product: 802.11n NIC
[ 1697.846606] usb 1-7: Manufacturer: Realtek
[ 1697.846607] usb 1-7: SerialNumber: 00E04C0001
[ 1697.858603] Chip Version Info: CHIP_8188E_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0)
[ 1698.262531] r8188eu 1-7:1.0 wlp1s0f0u7: renamed from wlan0
[ 1711.847379] MAC Address = c0:25:e9:1f:5c:3c
[ 1712.075372] R8188EU: indicate disassoc
---

Additionally, I see the warning when I plug in a Samsung Galaxy S5 device, but the warning appears only when I select certain "USB modes" in Android. Below you can see the dmesg log for each one of the USB modes:

--- dmesg log for "No data transfer" USB mode ---
[ 2523.666729] usb 1-7: USB disconnect, device number 32
[ 2524.157919] usb 1-7: new high-speed USB device number 33 using xhci_hcd
[ 2524.402980] usb 1-7: New USB device found, idVendor=18d1, idProduct=4ee7, bcdDevice= 2.32
[ 2524.402985] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2524.402987] usb 1-7: Product: SAMSUNG_Android
[ 2524.402989] usb 1-7: Manufacturer: SAMSUNG
[ 2524.402991] usb 1-7: SerialNumber: 19a6e4d5


--- dmesg log for "PTP" USB mode ---
[ 2529.713679] usb 1-7: USB disconnect, device number 33
[ 2529.714018] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 2530.207346] usb 1-7: new high-speed USB device number 34 using xhci_hcd
[ 2530.452843] usb 1-7: New USB device found, idVendor=04e8, idProduct=6866, bcdDevice= 2.32
[ 2530.452847] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2530.452850] usb 1-7: Product: SAMSUNG_Android
[ 2530.452852] usb 1-7: Manufacturer: SAMSUNG
[ 2530.452854] usb 1-7: SerialNumber: 19a6e4d5


--- dmesg log for "USB Tethering" USB mode ---
[ 2533.697810] usb 1-7: USB disconnect, device number 34
[ 2533.698156] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 2534.183649] usb 1-7: new high-speed USB device number 35 using xhci_hcd
[ 2534.430728] usb 1-7: New USB device found, idVendor=04e8, idProduct=6864, bcdDevice= 2.32
[ 2534.430730] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2534.430732] usb 1-7: Product: SAMSUNG_Android
[ 2534.430733] usb 1-7: Manufacturer: SAMSUNG
[ 2534.430734] usb 1-7: SerialNumber: 19a6e4d5
[ 2534.464706] rndis_host 1-7:1.0: rndis media connect
[ 2534.510921] rndis_host 1-7:1.0 usb0: register 'rndis_host' at usb-0000:01:00.0-7, RNDIS device, 6e:36:5a:07:cd:06
[ 2534.552158] rndis_host 1-7:1.0 enp1s0f0u7: renamed from usb0
[ 2534.641284] audit: type=1130 audit(1569897751.028:73): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'


--- dmesg log for "File Transfer" USB mode ---
[ 2536.996343] usb 1-7: USB disconnect, device number 35
[ 2536.996703] rndis_host 1-7:1.0 enp1s0f0u7: unregister 'rndis_host' usb-0000:01:00.0-7, RNDIS device
[ 2536.997131] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 2537.014124] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 2537.500061] usb 1-7: new high-speed USB device number 36 using xhci_hcd
[ 2537.754684] usb 1-7: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= 4.00
[ 2537.754688] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2537.754690] usb 1-7: Product: SAMSUNG_Android
[ 2537.754691] usb 1-7: Manufacturer: SAMSUNG
[ 2537.754692] usb 1-7: SerialNumber: 19a6e4d5



I hope these logs can help you to debug the issue.
Comment 64 Bernhard 2019-10-01 12:55:04 UTC
@Vinicius
Which motherboard do you have? 

Maybe the issue is related to 300-series motherboards...
Comment 65 Vinicius 2019-10-02 00:36:58 UTC
My motherboard is a Biostar B350GT3.
Comment 66 Bernhard 2019-10-03 12:14:08 UTC
I've sent another mail to the kernel usb mailing list, this time I got a response. I sent them kernel debugging logs/traces from xhci, unfortunately I have one of the devices where the error "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state." doesn't get shown anymore, which makes it harder to find the cause for the problem.

@Michael
Could you do the following steps, upload the dmesg log and trace file somewhere and post the link to the files here(or send them directly to the mailing list yourself, if you prefer that)? When using one of the devices where the error gets shown obviously.


1. start the PC with an affected kernel, but without the affected device plugged in, then run the following commands as root
2. mount -t debugfs none /sys/kernel/debug
3. echo 'module xhci_hcd =p' >/sys/kernel/debug/dynamic_debug/control
4. echo 'module usbcore =p' >/sys/kernel/debug/dynamic_debug/control
5. echo 81920 > /sys/kernel/debug/tracing/buffer_size_kb
6. echo 1 > /sys/kernel/debug/tracing/events/xhci-hcd/enable
7. Plug in the affected device
8. Send output of dmesg and the /sys/kernel/debug/tracing/trace file(upload them somewhere, especially the trace file will be big)

Thanks in advance
Comment 67 Michael 2019-10-03 15:08:46 UTC
Here it goes:
https://www.sendspace.com/file/413hlj

ALFA AWUS036NH connected to USB 3.x port running stress test using hcxdumptool.
Comment 68 Michael 2019-10-05 12:07:06 UTC
If the error occurred once, xhci will be unusable for all other devices:

[20480.414467] usb 1-2: new full-speed USB device number 6 using xhci_hcd
[20480.717690] usb 1-2: New USB device found, idVendor=1546, idProduct=01a7, bcdDevice= 1.00
[20480.717695] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[20480.717698] usb 1-2: Product: u-blox 7 - GPS/GNSS Receiver
[20480.717700] usb 1-2: Manufacturer: u-blox AG - www.u-blox.com
[20480.726485] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
[20480.760327] audit: type=1130 audit(1570274963.323:75): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=gpsdctl@ttyACM0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[20486.732259] usb 1-2: USB disconnect, device number 6
[20486.746846] audit: type=1131 audit(1570274969.310:76): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=gpsdctl@ttyACM0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[20487.027593] usb 1-2: new full-speed USB device number 7 using xhci_hcd
[20487.244298] usb 1-2: device descriptor read/64, error -71
[20487.540954] usb 1-2: device descriptor read/64, error -71
[20487.837571] usb 1-2: new full-speed USB device number 8 using xhci_hcd
[20487.991378] usb 1-2: device descriptor read/64, error -71
[20488.287616] usb 1-2: device descriptor read/64, error -71
[20488.394301] usb usb1-port2: attempt power cycle
[20489.037910] usb 1-2: new full-speed USB device number 9 using xhci_hcd
[20489.065424] usb 1-2: Device not responding to setup address.
[20489.271605] usb 1-2: Device not responding to setup address.
[20489.477900] usb 1-2: device not accepting address 9, error -71
Comment 69 Bernhard 2019-10-13 01:45:31 UTC
Good News!
After reading a bit in the xhci spec sheet I've figured out what the problem is. I've already created a patch and sent it to the mailing list, so it will hopefully be fixed in 5.4.

If you want to see or try the patch, you can find it here: https://marc.info/?l=linux-usb&m=157092844415047
Comment 70 Bernhard 2019-10-14 10:16:58 UTC
Nevermind, I've misunderstood something in the xhci spec sheet, apparently the xhci slot id isn't the same as the "TT Hub slot id".
Comment 71 Mathias Nyman 2019-10-15 14:50:55 UTC
Created attachment 285501 [details]
Patch adding doorbell tracing

Patch that adds even more tracing, this will show if xhci driver
correctly rings endpoint doorbell to start endpoint after soft retry
Comment 72 Bernhard 2019-10-15 18:25:33 UTC
Created attachment 285505 [details]
Dmesg log and trace file

Not sure how useful the logs from my device are, because the error "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" only gets shown after unplugging the device, but it looks like the error messages are mostly the same.

There are still some differences compared to Michaels device though:
Dmesg from him(the one I've also sent to the mailing list):
[   96.789306] xhci_hcd 0000:03:00.0: Resetting device with slot ID 4
[   96.789313] xhci_hcd 0000:03:00.0: // Ding dong!
[   96.791053] xhci_hcd 0000:03:00.0: Completed reset device command.
[   96.791111] xhci_hcd 0000:03:00.0: Successful reset device command.

compared to mine:
[   91.777887] xhci_hcd 0000:15:00.0: Resetting device with slot ID 4
[   91.777892] xhci_hcd 0000:15:00.0: // Ding dong!
[   91.777940] xhci_hcd 0000:15:00.0: Completed reset device command.
[   91.777950] xhci_hcd 0000:15:00.0: Can't reset device (slot ID 4) in default state
[   91.777951] xhci_hcd 0000:15:00.0: Not freeing device rings.
[   91.777956] xhci_hcd 0000:15:00.0: // Ding dong!
Comment 73 Michael 2019-10-16 09:12:30 UTC
Some times the warning doesn't appear. Instead the the driver crashed:
$ dmidecode
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: X555UB

$ cat /proc/cpuinfo
model name	: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz

device connected to USB 3:

[10799.155340] usb 1-2: reset high-speed USB device number 12 using xhci_hcd
[10799.310446] ieee80211 phy5: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[10799.364982] ieee80211 phy5: rt2x00_set_rf: Info - RF chipset 0005 detected
[10799.365842] ieee80211 phy5: Selected rate control algorithm 'minstrel_ht'
[10799.412456] rt2800usb 1-2:1.0 wlp0s20f0u2: renamed from wlan0
[10799.432236] ieee80211 phy5: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[10799.432263] ieee80211 phy5: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[10799.728051] ieee80211 phy5: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0404 with error -71
[10800.745185] ieee80211 phy5: rt2800_wait_csr_ready: Error - Unstable hardware
[10800.745197] ieee80211 phy5: rt2800usb_set_device_state: Error - Device failed to enter state 4 (-5)
...
[11237.887923] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[11237.887929] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.

xhci is unstable - not the hardware.


The same device, connected to the same notebook, but to a USB 2 port:
[11243.042957] usb 1-3: reset high-speed USB device number 13 using xhci_hcd
[11243.197261] ieee80211 phy6: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[11243.251969] ieee80211 phy6: rt2x00_set_rf: Info - RF chipset 0005 detected
[11243.253036] ieee80211 phy6: Selected rate control algorithm 'minstrel_ht'
[11243.272919] rt2800usb 1-3:1.0 wlp0s20f0u3: renamed from wlan0
[11243.293056] ieee80211 phy6: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[11243.293082] ieee80211 phy6: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
Comment 74 Bernhard 2019-10-16 10:58:18 UTC
@Michael 
Could you apply the patch from Mathias(comment 71) to the kernel, enable xhci tracing(steps in comment 66), and upload the dmesg and trace file?
The patch adds more tracing which will make it easier to find the exact issue.
Comment 75 Mathias Nyman 2019-10-17 15:01:06 UTC
@Bernhard

Logs with added tracing show that driver does ring the endpoint doorbell, so
host controller should start processing the pending requests. Endpoint is
in stopped state as it should after endpoint reset, before we ring the doorbell.

So this part looks like hardware isn't doing its part.

when class driver starts cancelling transfer requests after some timeout time, we can see that the endpoint is in halted state. Host controller didn't issue any
event when endpoint turned into halted state. so driver is unaware of this state.

There is also a bug in the driver how the error is handled later. After the timeout, when class driver starts cancelling transfers, and xhci driver tries to stop the endpoint to cancel tranfers, it sohuld react to the context state error,
and check endpoint state, and handle the halted endpoint p
Driver should react to this, it should detect and handle the halted endpoint before attempting to set a new dequeue pointer. Now it just bluntly tries to set
a new dequeue pointer, and fails.

Details:
* We get a transaction error event, for transfer request (TRB) at 0xf61a0000

96.985254: xhci_handle_event: EVENT: TRB 00000000f61a0000 status 'USB Transaction Error' len 3860 slot 4 ep 3 type 'Transfer Event' flags e:C
96.985262: xhci_handle_transfer: BULK: Buffer 00000000ff32b04c length 3860 TD size 0 intr 0 type 'Normal' flags b:i:I:c:s:I:e:C

* We issue a Reset endpoint command to resolve the halted endpoint
 (move endpoint from halted to stopped state)

96.985264: xhci_queue_trb: CMD: Reset Endpoint Command: ctx 0000000000000000 slot 4 ep 3 flags C
96.985265: xhci_inc_enq: CMD 0000000090dd7572: enq 0x00000000fff7e550(0x00000000fff7e000) deq 0x00000000fff7e540(0x00000000fff7e000) segs 1 
96.985266: xhci_ring_host_doorbell: Ring doorbell for Command Ring 0 
96.985268: xhci_inc_deq: EVENT 000000005715d3fc: enq 0x00000000fff7c000(0x00000000fff7c000) deq 0x00000000fff7c4a0(0x00000000fff7c000) segs 1 

* Reset endpoint command successfully, endpoint state is now "stopped"

96.985395: xhci_handle_event: EVENT: TRB 00000000fff7e540 status 'Success' len 0 slot 4 ep 0 type 'Command Completion Event' flags e:C
96.985396: xhci_handle_command: CMD: Reset Endpoint Command: ctx 0000000000000000 slot 4 ep 3 flags C
96.985397: xhci_handle_cmd_reset_ep: State stopped mult 1 max P. Streams 0 interval 125 us max ESIT payload 0 CErr 3 Type Bulk IN burst 0 maxp 512 deq 00000000f61a0001 avg \
trb len 0

* We ring the doorbell, xHC hardware should start processing events on ring,

96.985402: xhci_ring_ep_doorbell: Ring doorbell for Slot 4 ep1in 

* but nothing happends, this endpoint i silent until class driver starts cancelling Transfers ~25 seconds later

122.813121: xhci_urb_dequeue: ep1in-bulk: urb 00000000790ce3f7 pipe 3221259648 slot 4 length 0/3860 sgs 0/0 stream 0 flags 00010200
122.813134: xhci_dbg_cancel_urb: Cancel URB 00000000790ce3f7, dev 4, ep 0x81, starting at offset 0xf61a07f0

* stop the endpoint to cancel the pending transfers
 
122.813137: xhci_queue_trb: CMD: Stop Ring Command: slot 4 sp 0 ep 3 flags C
122.813137: xhci_inc_enq: CMD 0000000090dd7572: enq 0x00000000fff7e560(0x00000000fff7e000) deq 0x00000000fff7e550(0x00000000fff7e000) segs 1 
122.813138: xhci_ring_host_doorbell: Ring doorbell for Command Ring 0 
122.813141: xhci_urb_dequeue: ep1in-bulk: urb 000000009d35e579 pipe 3221259648 slot 4 length 0/3860 sgs 0/0 stream 0 flags 00010200

* Stop endpoit fails with "Context State Error"
 Endpoint is halted, not stopped, but driver doesn't handle this    

122.813605: xhci_handle_event: EVENT: TRB 00000000fff7e550 status 'Context State Error' len 0 slot 4 ep 0 type 'Command Completion Event' flags e:c
122.813606: xhci_handle_command: CMD: Stop Ring Command: slot 4 sp 0 ep 3 flags C
122.813606: xhci_handle_cmd_stop_ep: State halted mult 1 max P. Streams 0 interval 125 us max ESIT payload 0 CErr 3 Type Bulk IN burst 0 maxp 512 deq 00000000f61a0001

* Driver tries to queue new dequeue pointer anyway

122.813605: xhci_handle_event: EVENT: TRB 00000000fff7e550 status 'Context State Error' len 0 slot 4 ep 0 type 'Command Completion Event' flags e:c
122.813606: xhci_handle_command: CMD: Stop Ring Command: slot 4 sp 0 ep 3 flags C
122.813606: xhci_handle_cmd_stop_ep: State halted mult 1 max P. Streams 0 interval 125 us max ESIT payload 0 CErr 3 Type Bulk IN burst 0 maxp 512 deq 00000000f61a0001

* setting new dequeue pointer fails, endpoint is still halted

122.813820: xhci_handle_event: EVENT: TRB 00000000fff7e560 status 'Context State Error' len 0 slot 4 ep 0 type 'Command Completion Event' flags e:c
122.813820: xhci_handle_command: CMD: Set TR Dequeue Pointer Command: deq 00000000f61a0011 stream 0 slot 4 ep 3 flags C
122.813821: xhci_handle_cmd_set_deq: RS 00000 high-speed Ctx Entries 12 MEL 0 us Port# 8/0 [TT Slot 0 Port# 0 TTT 0 Intr 0] Addr 4 State configured
122.813821: xhci_handle_cmd_set_deq_ep: State halted mult 1 max P. Streams 0 interval 125 us max ESIT payload 0 CErr 3 Type Bulk IN burst 0 maxp 512 deq 00000000f61a0001
Comment 76 Mathias Nyman 2019-10-17 15:10:39 UTC
you could try to flush the endpoint ringing PCI write, and see if it helps
starting the endpint, but I don't have high hopes for this, a PCI write should
be flushed anyway, especially in 25 seconds.

maybe also add trace to re-read the endpoint state after flushing pci write:
(untested)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index e74518e7de6a..20e209b64551 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -408,6 +408,7 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
        trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id));
 
        writel(DB_VALUE(ep_index, stream_id), db_addr);
+       readl(db_addr);
        /* The CPU has better things to do at this point than wait for a
         * write-posting flush.  It'll get there soon enough.
         */
@@ -1176,6 +1177,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
        /* if this was a soft reset, then restart */
        if ((le32_to_cpu(trb->generic.field[3])) & TRB_TSP)
                ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
+
+       trace_xhci_handle_cmd_reset_ep(ep_ctx);
 }
Comment 77 Bernhard 2019-10-17 19:27:14 UTC
Created attachment 285527 [details]
Logs after flushing endpoint

I've applied the patch, but it seems like the endpoint doesn't get started even after flushing the endpoint.
Comment 78 Michael 2019-10-18 06:37:57 UTC
@Bernhard, can't do further going tests at the moment, because I'm on vacation until November.
Comment 79 Mathias Nyman 2019-10-29 16:17:25 UTC
Created attachment 285709 [details]
Patch handling halted endpoints at completion of stop endpoint command

Patch to handle a context state error at stop endpoint completion
where a endpoint TRB processing had a error/stall, and hardware halted the
endpoint just before completing normal stop endpoint command.

This won't fix the initial issue about endpoint not restarting after
soft retry, but it should resolve the flood of "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" messages

Code is completely untested as I can't trigger this codepath manually.
It requires hardware halting a endpoint just before completing a stop
endpoint command
Comment 80 Bernhard 2019-10-30 03:22:06 UTC
Created attachment 285713 [details]
Logs after applying the patch

After applying the patch the "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" messages are indeed gone, and the issue is (as expected) still there.
Comment 81 Mathias Nyman 2019-10-30 09:28:39 UTC
(In reply to Bernhard from comment #80)
> Created attachment 285713 [details]
> Logs after applying the patch

Did you by mistake attach some old logs?
Comment 82 Bernhard 2019-10-30 12:59:58 UTC
Created attachment 285717 [details]
Logs after applying the patch

Yes, looks like I've uploaded the zip file from the wrong folder. The new file should be the right one.
Comment 83 Michael 2019-10-30 18:42:43 UTC
The "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" doesn't flood the log file. The message appear only if the device is disconnected (after xhci died):

Connected the device:
[42407.193511] usb 1-2: ath9k_htc: USB layer deinitialized
[42410.956671] usb 1-2: new high-speed USB device number 9 using xhci_hcd
[42411.214091] usb 1-2: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice= 1.08
[42411.214095] usb 1-2: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[42411.214098] usb 1-2: Product: USB2.0 WLAN
[42411.214100] usb 1-2: Manufacturer: ATHEROS
[42411.214102] usb 1-2: SerialNumber: 12345
[42411.232116] usb 1-2: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested
[42412.308181] usb 1-2: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size: 51008
[42412.558320] ath9k_htc 1-2:1.0: ath9k_htc: HTC initialized with 33 credits
[42412.784721] ath9k_htc 1-2:1.0: ath9k_htc: FW Version: 1.4
[42412.784724] ath9k_htc 1-2:1.0: FW RMW support: On
[42412.784726] ath: EEPROM regdomain: 0x809c
[42412.784727] ath: EEPROM indicates we should expect a country code
[42412.784728] ath: doing EEPROM country->regdmn map search
[42412.784729] ath: country maps to regdmn code: 0x52
[42412.784730] ath: Country alpha2 being used: CN
[42412.784731] ath: Regpair used: 0x52
[42412.788460] ieee80211 phy2: Atheros AR9271 Rev:1
[42412.791852] ath9k_htc 1-2:1.0 wlp3s0f0u2: renamed from wlan0

and everything is looking fine.

after running the device for a few minutes
[42445.806367] device wlp3s0f0u2 entered promiscuous mode

we receive the first indication that xhci died
[42911.706734] ath: phy2: Unable to set channel

and the device stops working. There are absolutely no other error messages, shwon by dmesg or the running application (in this case hcxdumptool).

Now we disconnect the device and got the final warning:
[43082.759737] usb 1-2: USB disconnect, device number 9
[43082.760434] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[43082.760607] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[43082.764275] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[43082.784722] device wlp3s0f0u2 left promiscuous mode

At this point xhci is dead. No other device connected to the same port is working.
Comment 84 Mathias Nyman 2019-10-31 09:02:56 UTC
(In reply to Michael from comment #83)
> The "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state"
> doesn't flood the log file. The message appear only if the device is
> disconnected (after xhci died):
> 

Could you take full logs and traces of this:

mount -t debugfs none /sys/kernel/debug
echo 'module xhci_hcd =p' >/sys/kernel/debug/dynamic_debug/control
echo 'module usbcore =p' >/sys/kernel/debug/dynamic_debug/control
echo 81920 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/xhci-hcd/enable
< Trigger the issue >
Send output of dmesg
Send content of /sys/kernel/debug/tracing/trace

In Bernhards case there were issues both with hardware not starting the
ring after soft retry, and software not handling context state error when stopping an endpoint. Second issue can be fixed in driver.
Comment 85 Michael 2019-10-31 09:35:59 UTC
I try to trigger it. That isn't so easy, because different devices showing different behavior and the occurrence of the issue is totally random. Sometimes it happens immediately after connecting the device and sometimes it happens after a while or heavy stressing the device.

BTW:
mount -t debugfs none /sys/kernel/debug
is done by default here.
Comment 86 Michael 2019-10-31 09:55:57 UTC
I'm doing several runs, using different devices. So we have the chance to compare them against each other.
Comment 87 Michael 2019-10-31 10:16:24 UTC
Here go.
https://www.sendspace.com/file/8ybhnk

Unfortunately it looks like this stress test was to heavy for dmesg's ringbuffer.
Comment 88 Michael 2019-11-01 13:17:38 UTC
After several tests, I assume that this warning:
"rt2x00queue_flush_queue: Warning - Queue 14 failed to flush"
is also related to the xhci issue. I don't think that the issue is related to powermanagement (https://bugzilla.kernel.org/show_bug.cgi?id=61621), because pwrmgt is disabled, here.


affected: rt2800usb
[ 7384.825764] usb 1-2: new high-speed USB device number 8 using xhci_hcd
[ 7385.069208] usb 1-2: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[ 7385.069211] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7385.069214] usb 1-2: Product: 802.11 n WLAN
[ 7385.069216] usb 1-2: Manufacturer: Ralink
[ 7385.069217] usb 1-2: SerialNumber: 1.0
[ 7385.280539] usb 1-2: reset high-speed USB device number 8 using xhci_hcd
[ 7385.526260] ieee80211 phy3: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[ 7386.204480] ieee80211 phy3: rt2x00_set_rf: Info - RF chipset 0005 detected
[ 7386.210679] ieee80211 phy3: Selected rate control algorithm 'minstrel_ht'
[ 7386.227147] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[ 7386.227812] audit: type=1130 audit(1572610437.724:150): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 7387.737404] ieee80211 phy3: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[ 7387.737440] ieee80211 phy3: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
Comment 89 Michael 2019-11-02 07:55:40 UTC
The bad thing on this issue is that it isn't detectable by an application, while the device is plugged in. The device doesn't start or stops working without any warning. The application says every thing is fine and dmesg showing absolutely no warning.
Only when the device is plugged out, we get a bunch of warnings, depending on the device (tested on INTEL and AMD systems):
"WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state"
"rt2x00queue_flush_queue: Warning - Queue 14 failed to flush"
"rx urb failed: -71"
"A Set TR Deq Ptr command is pending."
and more (bad cable, hardware error, ....).


BTW:
I'm running kernel 4.19.80 in parallel and every thing is fine here. This issue appeared for the first time on 4.20.
Comment 90 Mathias Nyman 2019-11-04 09:36:02 UTC
Seems that it was a known issue that xHCI on AMD platforms can fail to restart an endpoint if it wasn't running when the stop command was issued. This also applies to Berhards case where the endpoint stop command raced with an error halting the endpoint.
See patch:

commit 28a2369f7d72ece55089f33e7d7b9c1223673cc3
Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Date:   Thu Jul 20 14:48:28 2017 +0300

    usb: xhci: Issue stop EP command only when the EP state is running
    
    on AMD platforms with SNPS 3.1 USB controller if stop endpoint command is
    issued the controller does not respond, when the EP is not in running
    state. HW completes the command execution and reports
    "Context State Error" completion code. This is as per the spec. However
    HW on receiving the second command additionally marks EP to Flow control
    state in HW which is RTL bug. This bug causes the HW not to respond
    to any further doorbells that are rung by the driver. This makes the EP
    to not functional anymore and causes gross functional failures.
    
    As a workaround, not to hit this problem, it's better to check the EP state
    and issue a stop EP command only when the EP is in running state.
    
    As a sidenote, even with this patch there is still a possibility of
    triggering the RTL bug if the context state races with the stop endpoint
    command as described in xHCI spec 4.6.9
    
    [code simplification and reworded sidenote in commit message -Mathias]
    Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
    Signed-off-by: Nehal Shah <Nehal-bakulchandra.Shah@amd.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Does anybody have a link to that errata?
Comment 91 Michael 2019-11-04 09:42:59 UTC
I can't confirm that, because this issue happens on all platforms if the device is connected to an USB 3 port:
RYZEN 1700, MSI X370 KRAIT
INTEL I5-6200U, ASUS X555U (notebook)
INTEL i7-3930K, ASUS P9X79
Comment 92 Michael 2019-11-04 09:52:22 UTC
The only systems which are running without this issue are my Raspberry Pi's:
$ uname -r
4.19.80-2-ARCH
Comment 93 Michael 2019-11-05 10:56:05 UTC
Generating a lot of traffic on the socket, causes xhci to die very early.

Here it happened on an AMD RYZEN system, running hcxdumptool:
[ 8316.184018] device wlp3s0f0u2 entered promiscuous mode
[ 8372.392206] ath: phy0: Unable to remove monitor interface at idx: 0
[ 8374.525500] ath: phy0: Unable to remove station entry for monitor mode
[ 8381.692889] usb 1-2: USB disconnect, device number 5
[ 8381.693576] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or 

and here on an INTEL notebook running NetworkManager:
[  166.174157] usb 1-1: new high-speed USB device number 8 using xhci_hcd
[  166.330703] usb 1-1: New USB device found, idVendor=148f, idProduct=761a, bcdDevice= 1.00
[  166.330713] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  166.330719] usb 1-1: Product: WiFi
[  166.330725] usb 1-1: Manufacturer: MediaTek
[  166.330729] usb 1-1: SerialNumber: 1.0
[  166.458249] usb 1-1: reset high-speed USB device number 8 using xhci_hcd
[  166.607874] usb 1-1: ASIC revision: 76100002 MAC revision: 76502000
[  167.669762] usb 1-1: EEPROM ver:02 fae:01
[  203.846465] mt76u_complete_rx: 13 callbacks suppressed
[  203.846479] usb 1-1: rx urb failed: -71
[  203.846552] usb 1-1: rx urb failed: -71
[  203.846614] usb 1-1: rx urb failed: -71
[  203.846667] usb 1-1: rx urb failed: -71
[  203.846712] usb 1-1: rx urb failed: -71
[  203.846799] usb 1-1: rx urb failed: -71
[  203.846874] usb 1-1: rx urb failed: -71
[  203.846924] usb 1-1: rx urb failed: -71
[  203.846998] usb 1-1: rx urb failed: -71
[  203.847069] usb 1-1: rx urb failed: -71
[  203.848249] usb 1-1: USB disconnect, device number 8
[  203.850032] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[  203.850040] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
Comment 94 Michael 2019-11-06 13:02:11 UTC
Running really heavy traffic, first xhci caused the driver to crash, than the whole system crashed:
System: ASUS X555UB (INTEL)

[ 1564.588784] mt7601u 1-2:1.0: Error: TSSI upper saturation
[ 1614.221860] ------------[ cut here ]------------
[ 1614.221923] WARNING: CPU: 1 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[ 1614.221924] Modules linked in: nfnetlink_queue nfnetlink_log nfnetlink uas usb_storage ccm mt7601u hid_generic usbhid fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev snd_soc_skl x86_pkg_temp_thermal intel_powerclamp snd_soc_hdac_hda coretemp mc kvm_intel snd_hda_ext_core rtl8821ae snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp snd_soc_acpi_intel_match snd_soc_acpi kvm btcoexist snd_soc_core snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic joydev ledtrig_audio snd_compress mousedev ac97_bus snd_pcm_dmaengine irqbypass rtsx_usb_ms rtl_pci r8169 memstick rtlwifi i915 btusb mac80211 btrtl ipmi_devintf realtek ipmi_msghandler libphy i2c_algo_bit cfg80211 btbcm crct10dif_pclmul drm_kms_helper crc32_pclmul btintel ghash_clmulni_intel snd_hda_intel drm bluetooth snd_hda_codec libarc4 aesni_intel asus_nb_wmi snd_hda_core asus_wmi intel_gtt aes_x86_64
[ 1614.221947]  intel_rapl_msr agpgart ecdh_generic crypto_simd sparse_keymap i2c_hid cryptd rfkill iTCO_wdt mei_hdcp hid snd_hwdep glue_helper syscopyarea ecc sysfillrect iTCO_vendor_support sysimgblt fb_sys_fops snd_pcm pcspkr intel_cstate intel_uncore mxm_wmi intel_rapl_perf input_leds elan_i2c tpm_crb snd_timer tpm_tis snd tpm_tis_core tpm int3403_thermal soundcore intel_xhci_usb_role_switch evdev i2c_i801 roles processor_thermal_device mei_me mei rng_core idma64 mac_hid intel_lpss_pci intel_lpss intel_rapl_common int340x_thermal_zone intel_soc_dts_iosf intel_pch_thermal int3400_thermal acpi_thermal_rel asus_wireless wmi ac battery sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb sr_mod cdrom sd_mod serio_raw atkbd ahci libps2 libahci libata xhci_pci crc32c_intel scsi_mod xhci_hcd i8042 serio
[ 1614.221975] CPU: 1 PID: 0 Comm: swapper/1 Tainted: P        W  OE     5.3.8-arch1-1 #1
[ 1614.221976] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[ 1614.221993] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[ 1614.221994] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 40 a1 d1 b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 7b c1 c0 e8 b7 53 4f d1 <0f> 0b 48 89 ef e8 7f 28 b4 d1 e9 d1 5b fb ff 48 c7 c7 60 7b c1 c0
[ 1614.221995] RSP: 0018:ffffa50840120e10 EFLAGS: 00010246
[ 1614.221996] RAX: 0000000000000024 RBX: ffff92206bc407a0 RCX: 0000000000000000
[ 1614.221997] RDX: 0000000000000000 RSI: ffff92207ba97708 RDI: 00000000ffffffff
[ 1614.221998] RBP: ffff922034510400 R08: 0000000000001137 R09: 0000000000000001
[ 1614.221998] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 1614.221999] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[ 1614.222000] FS:  0000000000000000(0000) GS:ffff92207ba80000(0000) knlGS:0000000000000000
[ 1614.222000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1614.222001] CR2: 00007f87cc12e000 CR3: 00000001d180a001 CR4: 00000000003606e0
[ 1614.222002] Call Trace:
[ 1614.222005]  <IRQ>
[ 1614.222010]  ? __mod_zone_page_state+0x66/0xa0
[ 1614.222014]  ? kmem_cache_free_bulk+0x2e1/0x450
[ 1614.222025]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[ 1614.222028]  tasklet_action_common.isra.0+0x4a/0xb0
[ 1614.222031]  __do_softirq+0x114/0x332
[ 1614.222033]  irq_exit+0xd4/0xf0
[ 1614.222034]  do_IRQ+0xbb/0x130
[ 1614.222037]  common_interrupt+0xf/0xf
[ 1614.222038]  </IRQ>
[ 1614.222041] RIP: 0010:cpuidle_enter_state+0xc4/0x480
[ 1614.222042] Code: e8 41 d6 9b ff 80 7c 24 0f 00 74 17 9c 58 0f 1f 44 00 00 f6 c4 02 0f 85 93 03 00 00 31 ff e8 a3 6b a2 ff fb 66 0f 1f 44 00 00 <45> 85 e4 0f 88 be 02 00 00 49 63 cc 4c 2b 6c 24 10 48 8d 04 49 48
[ 1614.222042] RSP: 0018:ffffa508400cbe68 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffda
[ 1614.222044] RAX: ffff92207ba80000 RBX: ffffffff932bcd60 RCX: 000000000000001f
[ 1614.222044] RDX: 0000000000000000 RSI: 00000000355556ca RDI: 0000000000000000
[ 1614.222045] RBP: ffff92207bab4200 R08: 00000177d71e2c19 R09: 0000000000001373
[ 1614.222046] R10: ffff92207baa9784 R11: ffff92207baa9764 R12: 0000000000000004
[ 1614.222046] R13: 00000177d71e2c19 R14: 0000000000000004 R15: ffff92207a148000
[ 1614.222049]  ? cpuidle_enter_state+0x9f/0x480
[ 1614.222051]  cpuidle_enter+0x29/0x40
[ 1614.222053]  do_idle+0x1de/0x260
[ 1614.222055]  cpu_startup_entry+0x19/0x20
[ 1614.222058]  start_secondary+0x185/0x1d0
[ 1614.222060]  secondary_startup_64+0xa4/0xb0
[ 1614.222062] ---[ end trace dee13b04de319021 ]---
[ 1614.222429] ------------[ cut here ]------------
Comment 95 Mathias Nyman 2019-11-08 14:43:07 UTC
Michael, I've been looking at the traces and can't find anything xhci related in your logs that could cause this. xhci isn't dying, crashig or causing other drivers to crash in the above logs either. It doesn't seem related to Bernhards case. 

Have you tried bisecting what patch causes the problems between 4.19 and 4.20 kernels?

The "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" is related to unplugging of the device. In short, while unplugging the device we get a transaction error for each running endpoint before the hub thread notices the disconnect, so xhci driver tries to recover the endpoint before everything is tore down and returned for the device. It's should be harmless at this stage.

There are several disconnect events initiated by device, or then actual physical
disconnect, could be related to firmware loading?

Traces also show many bulk-in urbs being queued but none completed until cancel at disconnect. so we are waiting 49 seconds to get data from the device before disconnect.

URB b2383f4 TRB is queued from ep4in, waiting for data from device:

  13714.468994: xhci_urb_enqueue: ep4in-bulk: urb 000000000b2383f4 pipe 3221360512 slot 14 length 0/4096 sgs 1/1 stream 0 flags 00040200
  13714.468996: xhci_queue_trb: BULK: Buffer 00000000ff5df000 length 4096 TD size 0 intr 0 type 'Normal' flags b:i:I:c:s:I:e:c
  13714.468996: xhci_inc_enq: BULK 0000000096dfdec9: enq 0x00000000feaec010(0x00000000feaec000) deq 0x00000000feaec000(0x00000000feaec000) segs 2 stream 0 free_trbs 508 bounce 512\

49 seconds later transaction error on ep4in on disconnect:

   13763.472759: xhci_handle_event: EVENT: TRB 00000000feaec000 status 'USB Transaction Error' len 4096 slot 14 ep 9 type 'Transfer Event' flags e:c
   ...   
   13763.472787: xhci_handle_event: EVENT: TRB 000000000a000000 status 'Success' len 0 slot 0 ep 0 type 'Port Status Change Event' flags e:c
   13763.472792: xhci_handle_port_status: port-1: Powered Not-connected Disabled Link:RxDetect PortSpeed:0 Change: CSC Wake: 

After this urb b2383f4 is canceled and given back:

  13763.474221: xhci_urb_dequeue: ep4in-bulk: urb 000000000b2383f4 pipe 3221360512 slot 14 length 0/4096 sgs 1/1 stream 0 flags 00040200
  13763.474225: xhci_dbg_cancel_urb: Cancel URB 000000000b2383f4, dev 2, ep 0x84, starting at offset 0xfeaec000
   ...
   13763.474673: xhci_urb_giveback: ep4in-bulk: urb 000000000b2383f4 pipe 3221360512 slot 14 length 0/4096 sgs 1/1 stream 0 flags 00040200
Comment 96 Michael 2019-11-08 15:24:58 UTC
Mathias, it is really hard to find the cause of that issue. dmesg is showing nothing until something crashed. I'm not able to detect the cause:
https://bugzilla.kernel.org/show_bug.cgi?id=202541#c89
At this point, I know:
- the driver stops working (independent of the driver - rt2800usb as well as mt76) 
- no warning, no error message)
- the system became instable (AMD as well as INTEL)
- kernel 4.20 up to 5.3

It is very unlikely that the driver caused this, because it doesn't happen on USB2 and it happens on different drivers and different systems.

I can try to bisect to identify the patch, but that will take a while.
Comment 97 Michael 2019-11-08 15:47:33 UTC
"WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" only appeared when something went wrong.
If everything's fine and I plug out the device, this warning is not shown.

Here are the results from another device
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
running on an INTEL system.

dmesg output if everything is ok:
[14492.749187] usb 1-1: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[14492.749197] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14492.749203] usb 1-1: Product: 802.11 n WLAN
[14492.749208] usb 1-1: Manufacturer: Ralink
[14492.749213] usb 1-1: SerialNumber: 1.0
[14492.881097] usb 1-1: reset high-speed USB device number 20 using xhci_hcd
[14493.035766] ieee80211 phy11: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[14493.090480] ieee80211 phy11: rt2x00_set_rf: Info - RF chipset 0005 detected
[14493.091489] ieee80211 phy11: Selected rate control algorithm 'minstrel_ht'
[14493.113656] rt2800usb 1-1:1.0 wlp0s20f0u1: renamed from wlan0
[14493.116525] audit: type=1130 audit(1573227592.687:137): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[14493.141430] ieee80211 phy11: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[14493.141456] ieee80211 phy11: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[14498.126056] audit: type=1131 audit(1573227597.697:138): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[14506.300174] usb 1-1: USB disconnect, device number 20
[14506.463603] audit: type=1130 audit(1573227606.037:139): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'


demsg if the device stops working and something went wrong:
[14565.489976] usb 1-1: new high-speed USB device number 21 using xhci_hcd
[14565.648114] usb 1-1: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[14565.648124] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14565.648130] usb 1-1: Product: 802.11 n WLAN
[14565.648135] usb 1-1: Manufacturer: Ralink
[14565.648140] usb 1-1: SerialNumber: 1.0
[14565.773934] usb 1-1: reset high-speed USB device number 21 using xhci_hcd
[14565.927986] ieee80211 phy12: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[14565.982385] ieee80211 phy12: rt2x00_set_rf: Info - RF chipset 0005 detected
[14565.983295] ieee80211 phy12: Selected rate control algorithm 'minstrel_ht'
[14566.002249] rt2800usb 1-1:1.0 wlp0s20f0u1: renamed from wlan0
[14566.004829] audit: type=1130 audit(1573227665.577:141): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[14566.018308] ieee80211 phy12: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[14566.018335] ieee80211 phy12: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[14571.010706] audit: type=1131 audit(1573227670.584:142): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[14576.147069] ------------[ cut here ]------------
[14576.147136] WARNING: CPU: 1 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.147137] Modules linked in: rt2800usb rt2x00usb rt2800lib rt2x00lib ath9k_htc ath9k_common ath9k_hw ath mt76x0u mt76x0_common mt76x02_usb mt76_usb mt76x02_lib mt76 ccm fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops snd_soc_skl videobuf2_v4l2 snd_soc_hdac_hda videobuf2_common snd_hda_ext_core videodev snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp mc snd_soc_acpi_intel_match snd_soc_acpi snd_hda_codec_hdmi snd_hda_codec_realtek rtsx_usb_ms rtl8821ae snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_codec_generic memstick ledtrig_audio r8169 x86_pkg_temp_thermal intel_powerclamp coretemp btcoexist rtl_pci joydev kvm_intel rtlwifi realtek mousedev i915 libphy btusb btrtl btbcm btintel kvm mac80211 ipmi_devintf bluetooth ipmi_msghandler i2c_algo_bit irqbypass snd_hda_intel drm_kms_helper snd_hda_codec drm cfg80211 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_core asus_nb_wmi asus_wmi
[14576.147158]  aesni_intel intel_gtt libarc4 snd_hwdep intel_rapl_msr agpgart snd_pcm aes_x86_64 crypto_simd mei_hdcp syscopyarea cryptd sparse_keymap i2c_hid ecdh_generic sysfillrect glue_helper iTCO_wdt sysimgblt rfkill iTCO_vendor_support fb_sys_fops intel_cstate intel_uncore ecc intel_rapl_perf mxm_wmi snd_timer snd intel_xhci_usb_role_switch input_leds pcspkr soundcore roles elan_i2c tpm_crb evdev processor_thermal_device tpm_tis intel_rapl_common tpm_tis_core mei_me int3403_thermal tpm int340x_thermal_zone mac_hid i2c_i801 mei rng_core intel_soc_dts_iosf intel_pch_thermal idma64 intel_lpss_pci intel_lpss int3400_thermal acpi_thermal_rel wmi asus_wireless ac battery sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb hid_generic usbhid hid sr_mod cdrom sd_mod ahci serio_raw libahci atkbd libps2 libata xhci_pci crc32c_intel scsi_mod xhci_hcd i8042 serio
[14576.147187] CPU: 1 PID: 0 Comm: swapper/1 Tainted: P        W  OE     5.3.8-arch1-1 #1
[14576.147187] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[14576.147203] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.147205] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 40 8e f1 b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 7b 94 c0 e8 b7 53 3c f1 <0f> 0b 48 89 ef e8 7f 28 a1 f1 e9 d1 5b fb ff 48 c7 c7 60 7b 94 c0
[14576.147206] RSP: 0018:ffffab7a00120e10 EFLAGS: 00010246
[14576.147207] RAX: 0000000000000024 RBX: ffff9656387207a0 RCX: 0000000000000000
[14576.147207] RDX: 0000000000000000 RSI: 00000000000000f6 RDI: 00000000ffffffff
[14576.147208] RBP: ffff965615251400 R08: 0000000000000d40 R09: 0000000000000001
[14576.147209] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[14576.147209] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[14576.147210] FS:  0000000000000000(0000) GS:ffff96563ba80000(0000) knlGS:0000000000000000
[14576.147211] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[14576.147211] CR2: 00005642ee566100 CR3: 000000019b00a001 CR4: 00000000003606e0
[14576.147212] Call Trace:
[14576.147214]  <IRQ>
[14576.147219]  ? __mod_zone_page_state+0x66/0xa0
[14576.147222]  ? _raw_spin_unlock_irqrestore+0x20/0x40
[14576.147224]  ? kmem_cache_free_bulk+0x2e1/0x450
[14576.147234]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[14576.147237]  tasklet_action_common.isra.0+0x4a/0xb0
[14576.147239]  __do_softirq+0x114/0x332
[14576.147241]  irq_exit+0xd4/0xf0
[14576.147242]  do_IRQ+0xbb/0x130
[14576.147245]  common_interrupt+0xf/0xf
[14576.147246]  </IRQ>
[14576.147248] RIP: 0010:cpuidle_enter_state+0xc4/0x480
[14576.147249] Code: e8 41 d6 9b ff 80 7c 24 0f 00 74 17 9c 58 0f 1f 44 00 00 f6 c4 02 0f 85 93 03 00 00 31 ff e8 a3 6b a2 ff fb 66 0f 1f 44 00 00 <45> 85 e4 0f 88 be 02 00 00 49 63 cc 4c 2b 6c 24 10 48 8d 04 49 48
[14576.147250] RSP: 0018:ffffab7a000cbe68 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffda
[14576.147251] RAX: ffff96563ba80000 RBX: ffffffffb2ebcd60 RCX: 000000000000001f
[14576.147252] RDX: 0000000000000000 RSI: 00000000355556ca RDI: 0000000000000000
[14576.147252] RBP: ffff96563bab4200 R08: 00000d41c610ca50 R09: 0000000000000000
[14576.147253] R10: ffff96563baa9784 R11: ffff96563baa9764 R12: 0000000000000008
[14576.147254] R13: 00000d41c610ca50 R14: 0000000000000008 R15: ffff96563a149ec0
[14576.147256]  ? cpuidle_enter_state+0x9f/0x480
[14576.147258]  cpuidle_enter+0x29/0x40
[14576.147260]  do_idle+0x1de/0x260
[14576.147262]  cpu_startup_entry+0x19/0x20
[14576.147265]  start_secondary+0x185/0x1d0
[14576.147267]  secondary_startup_64+0xa4/0xb0
[14576.147269] ---[ end trace 6c01ee4ff02c47b6 ]---
[14576.147743] ------------[ cut here ]------------
[14576.147775] WARNING: CPU: 1 PID: 272 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.147775] Modules linked in: rt2800usb rt2x00usb rt2800lib rt2x00lib ath9k_htc ath9k_common ath9k_hw ath mt76x0u mt76x0_common mt76x02_usb mt76_usb mt76x02_lib mt76 ccm fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops snd_soc_skl videobuf2_v4l2 snd_soc_hdac_hda videobuf2_common snd_hda_ext_core videodev snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp mc snd_soc_acpi_intel_match snd_soc_acpi snd_hda_codec_hdmi snd_hda_codec_realtek rtsx_usb_ms rtl8821ae snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_codec_generic memstick ledtrig_audio r8169 x86_pkg_temp_thermal intel_powerclamp coretemp btcoexist rtl_pci joydev kvm_intel rtlwifi realtek mousedev i915 libphy btusb btrtl btbcm btintel kvm mac80211 ipmi_devintf bluetooth ipmi_msghandler i2c_algo_bit irqbypass snd_hda_intel drm_kms_helper snd_hda_codec drm cfg80211 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_core asus_nb_wmi asus_wmi
[14576.147791]  aesni_intel intel_gtt libarc4 snd_hwdep intel_rapl_msr agpgart snd_pcm aes_x86_64 crypto_simd mei_hdcp syscopyarea cryptd sparse_keymap i2c_hid ecdh_generic sysfillrect glue_helper iTCO_wdt sysimgblt rfkill iTCO_vendor_support fb_sys_fops intel_cstate intel_uncore ecc intel_rapl_perf mxm_wmi snd_timer snd intel_xhci_usb_role_switch input_leds pcspkr soundcore roles elan_i2c tpm_crb evdev processor_thermal_device tpm_tis intel_rapl_common tpm_tis_core mei_me int3403_thermal tpm int340x_thermal_zone mac_hid i2c_i801 mei rng_core intel_soc_dts_iosf intel_pch_thermal idma64 intel_lpss_pci intel_lpss int3400_thermal acpi_thermal_rel wmi asus_wireless ac battery sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb hid_generic usbhid hid sr_mod cdrom sd_mod ahci serio_raw libahci atkbd libps2 libata xhci_pci crc32c_intel scsi_mod xhci_hcd i8042 serio
[14576.147809] CPU: 1 PID: 272 Comm: systemd-journal Tainted: P        W  OE     5.3.8-arch1-1 #1
[14576.147809] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[14576.147823] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.147824] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 40 8e f1 b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 7b 94 c0 e8 b7 53 3c f1 <0f> 0b 48 89 ef e8 7f 28 a1 f1 e9 d1 5b fb ff 48 c7 c7 60 7b 94 c0
[14576.147825] RSP: 0000:ffffab7a00120e10 EFLAGS: 00010246
[14576.147826] RAX: 0000000000000024 RBX: ffff9656387207a0 RCX: 0000000000000000
[14576.147827] RDX: 0000000000000000 RSI: ffff96563ba97708 RDI: 00000000ffffffff
[14576.147827] RBP: ffff965615251300 R08: 0000000000000d6c R09: 0000000000000001
[14576.147828] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[14576.147828] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[14576.147829] FS:  00007f875aea1840(0000) GS:ffff96563ba80000(0000) knlGS:0000000000000000
[14576.147830] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[14576.147830] CR2: 00007f875a305a58 CR3: 0000000276ed8003 CR4: 00000000003606e0
[14576.147831] Call Trace:
[14576.147832]  <IRQ>
[14576.147834]  ? __mod_zone_page_state+0x66/0xa0
[14576.147837]  ? kmem_cache_free_bulk+0x2e1/0x450
[14576.147846]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[14576.147848]  tasklet_action_common.isra.0+0x4a/0xb0
[14576.147850]  __do_softirq+0x114/0x332
[14576.147851]  irq_exit+0xd4/0xf0
[14576.147853]  do_IRQ+0xbb/0x130
[14576.147855]  common_interrupt+0xf/0xf
[14576.147855]  </IRQ>
[14576.147856] RIP: 0033:0x7f875c37bc23
[14576.147858] Code: 89 df ff 15 df 0b 24 00 85 c0 78 53 4c 8b 54 24 38 49 8b 42 38 48 85 c0 0f 85 f9 00 00 00 49 89 6a 28 48 83 c0 01 49 83 c7 01 <49> 89 42 38 4d 39 fc 75 aa 48 83 7c 24 08 00 74 0d 48 8b 44 24 28
[14576.147858] RSP: 002b:00007ffe369e9c20 EFLAGS: 00010202 ORIG_RAX: ffffffffffffffda
[14576.147859] RAX: 00000000000001ef RBX: 0000556fa6ff9890 RCX: 0000000000000000
[14576.147860] RDX: 0000000000000006 RSI: 00007f875c4b43fc RDI: 00007f87585160f0
[14576.147860] RBP: 000000000150d740 R08: 0000000000001608 R09: 0000556fa6ff8350
[14576.147861] R10: 00007f875a305a20 R11: 00000000000038f0 R12: 0000000000000009
[14576.147862] R13: 00007f8759bae740 R14: 00007ffe369e9c58 R15: 0000000000000007
[14576.147863] ---[ end trace 6c01ee4ff02c47b7 ]---
[14576.147981] ------------[ cut here ]------------
[14576.148004] WARNING: CPU: 1 PID: 272 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.148004] Modules linked in: rt2800usb rt2x00usb rt2800lib rt2x00lib ath9k_htc ath9k_common ath9k_hw ath mt76x0u mt76x0_common mt76x02_usb mt76_usb mt76x02_lib mt76 ccm fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops snd_soc_skl videobuf2_v4l2 snd_soc_hdac_hda videobuf2_common snd_hda_ext_core videodev snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp mc snd_soc_acpi_intel_match snd_soc_acpi snd_hda_codec_hdmi snd_hda_codec_realtek rtsx_usb_ms rtl8821ae snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_codec_generic memstick ledtrig_audio r8169 x86_pkg_temp_thermal intel_powerclamp coretemp btcoexist rtl_pci joydev kvm_intel rtlwifi realtek mousedev i915 libphy btusb btrtl btbcm btintel kvm mac80211 ipmi_devintf bluetooth ipmi_msghandler i2c_algo_bit irqbypass snd_hda_intel drm_kms_helper snd_hda_codec drm cfg80211 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_core asus_nb_wmi asus_wmi
[14576.148018]  aesni_intel intel_gtt libarc4 snd_hwdep intel_rapl_msr agpgart snd_pcm aes_x86_64 crypto_simd mei_hdcp syscopyarea cryptd sparse_keymap i2c_hid ecdh_generic sysfillrect glue_helper iTCO_wdt sysimgblt rfkill iTCO_vendor_support fb_sys_fops intel_cstate intel_uncore ecc intel_rapl_perf mxm_wmi snd_timer snd intel_xhci_usb_role_switch input_leds pcspkr soundcore roles elan_i2c tpm_crb evdev processor_thermal_device tpm_tis intel_rapl_common tpm_tis_core mei_me int3403_thermal tpm int340x_thermal_zone mac_hid i2c_i801 mei rng_core intel_soc_dts_iosf intel_pch_thermal idma64 intel_lpss_pci intel_lpss int3400_thermal acpi_thermal_rel wmi asus_wireless ac battery sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb hid_generic usbhid hid sr_mod cdrom sd_mod ahci serio_raw libahci atkbd libps2 libata xhci_pci crc32c_intel scsi_mod xhci_hcd i8042 serio
[14576.148034] CPU: 1 PID: 272 Comm: systemd-journal Tainted: P        W  OE     5.3.8-arch1-1 #1
[14576.148034] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[14576.148047] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[14576.148049] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 40 8e f1 b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 7b 94 c0 e8 b7 53 3c f1 <0f> 0b 48 89 ef e8 7f 28 a1 f1 e9 d1 5b fb ff 48 c7 c7 60 7b 94 c0
[14576.148049] RSP: 0018:ffffab7a00120e10 EFLAGS: 00010246
[14576.148050] RAX: 0000000000000024 RBX: ffff9656387207a0 RCX: 0000000000000000
[14576.148051] RDX: 0000000000000000 RSI: 0000000000000086 RDI: 00000000ffffffff
[14576.148051] RBP: ffff9655c18b8f00 R08: 0000000000000d91 R09: 0000000000000001
[14576.148052] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[14576.148052] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[14576.148053] FS:  00007f875aea1840(0000) GS:ffff96563ba80000(0000) knlGS:0000000000000000
[14576.148054] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[14576.148055] CR2: 00007f875a045e10 CR3: 0000000276ed8003 CR4: 00000000003606e0
[14576.148055] Call Trace:
[14576.148056]  <IRQ>
[14576.148058]  ? __mod_zone_page_state+0x66/0xa0
[14576.148060]  ? kmem_cache_free_bulk+0x2e1/0x450
[14576.148070]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[14576.148071]  tasklet_action_common.isra.0+0x4a/0xb0
[14576.148073]  __do_softirq+0x114/0x332
[14576.148074]  irq_exit+0xd4/0xf0
[14576.148075]  do_IRQ+0xbb/0x130
[14576.148077]  common_interrupt+0xf/0xf
[14576.148078]  </IRQ>
[14576.148080] RIP: 0010:devkmsg_poll+0x6f/0xa0
[14576.148081] Code: 80 00 49 8b 04 24 45 31 e4 48 3b 05 6b a0 7d 01 72 1e 48 c7 c7 0c 06 4b b3 e8 8d ab 80 00 e8 e8 3d 00 00 fb 66 0f 1f 44 00 00 <44> 89 e0 41 5c c3 48 3b 05 54 a0 7d 01 45 19 e4 41 83 e4 0a 41 83
[14576.148082] RSP: 0018:ffffab7a002a7d40 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffda
[14576.148083] RAX: 0000000080000000 RBX: ffff965636f9e870 RCX: 0000000000000000
[14576.148083] RDX: 0000000000000001 RSI: ffffab7a002a7d88 RDI: 00000000ffffffff
[14576.148084] RBP: ffffab7a002a7d88 R08: 0000000000000000 R09: 0000000000000000
[14576.148084] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000041
[14576.148085] R13: ffffab7a002a7de0 R14: ffffab7a002a7dc8 R15: ffffab7a002a7e78
[14576.148088]  ep_item_poll.isra.0+0x3f/0xb0
[14576.148090]  ep_send_events_proc+0xeb/0x1f0
[14576.148092]  ? balance_dirty_pages_ratelimited+0x102/0x4c0
[14576.148093]  ? ep_read_events_proc+0xe0/0xe0
[14576.148095]  ep_scan_ready_list.constprop.0+0xa3/0x1f0
[14576.148097]  ep_poll+0x118/0x4b0
[14576.148099]  do_epoll_wait+0xb0/0xd0
[14576.148100]  __x64_sys_epoll_wait+0x1a/0x20
[14576.148102]  do_syscall_64+0x5f/0x1c0
[14576.148104]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[14576.148105] RIP: 0033:0x7f875c6bf60e
[14576.148106] Code: 10 89 7c 24 0c 89 4c 24 1c e8 2e 65 f8 ff 44 8b 54 24 1c 8b 54 24 18 41 89 c0 48 8b 74 24 10 8b 7c 24 0c b8 e8 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 2c 44 89 c7 89 44 24 0c e8 5e 65 f8 ff 8b 44
[14576.148107] RSP: 002b:00007ffe369ec500 EFLAGS: 00000293 ORIG_RAX: 00000000000000e8
[14576.148108] RAX: ffffffffffffffda RBX: 0000556fa6ff3d90 RCX: 00007f875c6bf60e
[14576.148108] RDX: 0000000000000030 RSI: 00007ffe369ec530 RDI: 0000000000000008
[14576.148109] RBP: 00007ffe369ec870 R08: 0000000000000000 R09: 0000000000000030
[14576.148109] R10: 00000000ffffffff R11: 0000000000000293 R12: 00007ffe369ec530
[14576.148110] R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000001
[14576.148111] ---[ end trace 6c01ee4ff02c47b8 ]---
[14577.298535] usb 1-1: USB disconnect, device number 21
[14577.299850] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[14577.299857] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
[14577.425685] audit: type=1130 audit(1573227676.997:143): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'


If we assume the driver is ok (we can do this, because it happens on different drivers) the cause must be located within xhci (USB host).
Comment 98 Bernhard 2019-11-08 16:09:18 UTC
(In reply to Michael from comment #96)
> I can try to bisect to identify the patch, but that will take a while.

Tbh I would try reverting the commit that caused the problem for me first, just to make sure you're not spending multiple hours bisecting this issue and then find out that you're affected by the same commit.
Comment 99 Michael 2019-11-08 16:40:52 UTC
Bernhard, that will be great. I'm not at home and my ASUS notebook is really too slow to perform a bisect.
Comment 100 Michael 2019-11-09 10:57:02 UTC
@Bernhard, @Mathias
I'm not sure anymore if the issue is related to xhci, because of the lates WARNINGs and traces.
I tested a PCIe card
Network controller: Realtek Semiconductor Co., Ltd. RTL8821AE 802.11ac PCIe Wireless Network Adapter
and running into similar issues:
12506.901197] wlp3s0: deauthenticating from 00:24:d4:9e:e8:c4 by local choice (Reason: 3=DEAUTH_LEAVING)
[12506.902535] ------------[ cut here ]------------
[12506.902589] WARNING: CPU: 1 PID: 15941 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[12506.902590] Modules linked in: nfnetlink_queue nfnetlink_log nfnetlink mt7601u ccm fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc snd_soc_skl snd_soc_hdac_hda snd_hda_ext_core snd_soc_skl_ipc snd_soc_sst_ipc rtsx_usb_ms snd_soc_sst_dsp rtl8821ae snd_soc_acpi_intel_match x86_pkg_temp_thermal memstick snd_soc_acpi intel_powerclamp btcoexist coretemp r8169 kvm_intel snd_soc_core rtl_pci rtlwifi snd_hda_codec_hdmi snd_compress ac97_bus kvm mac80211 snd_hda_codec_realtek ipmi_devintf ipmi_msghandler snd_pcm_dmaengine snd_hda_codec_generic irqbypass ledtrig_audio cfg80211 realtek libphy joydev mousedev iTCO_wdt i915 iTCO_vendor_support crct10dif_pclmul crc32_pclmul libarc4 ghash_clmulni_intel btusb btrtl aesni_intel btbcm btintel bluetooth aes_x86_64 snd_hda_intel snd_hda_codec crypto_simd cryptd i2c_algo_bit i2c_hid glue_helper drm_kms_helper asus_nb_wmi intel_rapl_msr
[12506.902624]  asus_wmi drm sparse_keymap mei_hdcp snd_hda_core intel_cstate mxm_wmi intel_uncore intel_rapl_perf intel_gtt agpgart ecdh_generic snd_hwdep pcspkr rfkill syscopyarea snd_pcm sysfillrect ecc sysimgblt fb_sys_fops tpm_crb input_leds snd_timer elan_i2c tpm_tis tpm_tis_core snd int3403_thermal tpm i2c_i801 evdev rng_core soundcore processor_thermal_device intel_rapl_common mac_hid idma64 intel_xhci_usb_role_switch int340x_thermal_zone roles intel_soc_dts_iosf mei_me int3400_thermal mei acpi_thermal_rel intel_pch_thermal intel_lpss_pci intel_lpss asus_wireless wmi battery ac sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb hid_generic usbhid hid sr_mod cdrom sd_mod serio_raw atkbd libps2 ahci libahci libata xhci_pci crc32c_intel i8042 xhci_hcd scsi_mod serio
[12506.902660] CPU: 1 PID: 15941 Comm: Netlink Monitor Tainted: P        W  OE     5.3.8-arch1-1 #1
[12506.902661] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[12506.902684] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[12506.902687] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 10 77 dc b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 ab eb c0 e8 b7 23 25 dc <0f> 0b 48 89 ef e8 7f f8 89 dc e9 d1 5b fb ff 48 c7 c7 60 ab eb c0
[12506.902688] RSP: 0000:ffffb624c0120e10 EFLAGS: 00010246
[12506.902690] RAX: 0000000000000024 RBX: ffff8ee22cae07a0 RCX: 0000000000000000
[12506.902691] RDX: 0000000000000000 RSI: ffff8ee23ba97708 RDI: 00000000ffffffff
[12506.902692] RBP: ffff8ee1ab8b8400 R08: 00000000000014eb R09: 0000000000000001
[12506.902692] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[12506.902694] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[12506.902695] FS:  00007f27b8866700(0000) GS:ffff8ee23ba80000(0000) knlGS:0000000000000000
[12506.902696] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[12506.902697] CR2: 00005599e0bfe008 CR3: 00000002417b6002 CR4: 00000000003606e0
[12506.902699] Call Trace:
[12506.902702]  <IRQ>
[12506.902707]  ? __mod_zone_page_state+0x66/0xa0
[12506.902712]  ? kmem_cache_free_bulk+0x2e1/0x450
[12506.902730]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[12506.902734]  tasklet_action_common.isra.0+0x4a/0xb0
[12506.902737]  __do_softirq+0x114/0x332
[12506.902740]  irq_exit+0xd4/0xf0
[12506.902742]  do_IRQ+0xbb/0x130
[12506.902746]  common_interrupt+0xf/0xf
[12506.902747]  </IRQ>
[12506.902749] RIP: 0033:0x55b7f9be923d
[12506.902751] Code: 0f 84 9e 00 00 00 48 8b 10 48 83 e2 fe 48 09 ca 48 89 56 08 48 89 30 48 8b 4e 08 48 83 e1 fe 74 09 48 8b 51 08 f6 c2 01 75 06 <48> 89 4e 08 59 c3 48 83 e2 fe 48 89 51 08 48 8b 4e 08 48 89 ca 48
[12506.902752] RSP: 002b:00007f27b8864a10 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffda
[12506.902754] RAX: 00007f27a6800770 RBX: 00007f27a6201628 RCX: 0000000000000000
[12506.902755] RDX: 0000000000000001 RSI: 00007f27a6201628 RDI: 0000000000000000
[12506.902755] RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f27c3f0a3b6
[12506.902756] R10: 0000000000000000 R11: 0000000000000000 R12: 00007f27c8e00110
[12506.902757] R13: 00007f27a6800f80 R14: 00000000ffffffff R15: 00007f27a5d01100
[12506.902760] ---[ end trace 934096102c096064 ]---
[12506.990611] audit: type=1131 audit(1573296338.199:239): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=wpa_supplicant comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[12507.259354] ------------[ cut here ]------------
[12507.259405] WARNING: CPU: 1 PID: 16380 at net/mac80211/rx.c:804 ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[12507.259406] Modules linked in: nfnetlink_queue nfnetlink_log nfnetlink mt7601u ccm fuse nls_iso8859_1 nls_cp437 vfat fat nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc snd_soc_skl snd_soc_hdac_hda snd_hda_ext_core snd_soc_skl_ipc snd_soc_sst_ipc rtsx_usb_ms snd_soc_sst_dsp rtl8821ae snd_soc_acpi_intel_match x86_pkg_temp_thermal memstick snd_soc_acpi intel_powerclamp btcoexist coretemp r8169 kvm_intel snd_soc_core rtl_pci rtlwifi snd_hda_codec_hdmi snd_compress ac97_bus kvm mac80211 snd_hda_codec_realtek ipmi_devintf ipmi_msghandler snd_pcm_dmaengine snd_hda_codec_generic irqbypass ledtrig_audio cfg80211 realtek libphy joydev mousedev iTCO_wdt i915 iTCO_vendor_support crct10dif_pclmul crc32_pclmul libarc4 ghash_clmulni_intel btusb btrtl aesni_intel btbcm btintel bluetooth aes_x86_64 snd_hda_intel snd_hda_codec crypto_simd cryptd i2c_algo_bit i2c_hid glue_helper drm_kms_helper asus_nb_wmi intel_rapl_msr
[12507.259436]  asus_wmi drm sparse_keymap mei_hdcp snd_hda_core intel_cstate mxm_wmi intel_uncore intel_rapl_perf intel_gtt agpgart ecdh_generic snd_hwdep pcspkr rfkill syscopyarea snd_pcm sysfillrect ecc sysimgblt fb_sys_fops tpm_crb input_leds snd_timer elan_i2c tpm_tis tpm_tis_core snd int3403_thermal tpm i2c_i801 evdev rng_core soundcore processor_thermal_device intel_rapl_common mac_hid idma64 intel_xhci_usb_role_switch int340x_thermal_zone roles intel_soc_dts_iosf mei_me int3400_thermal mei acpi_thermal_rel intel_pch_thermal intel_lpss_pci intel_lpss asus_wireless wmi battery ac sg crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 rtsx_usb_sdmmc mmc_core rtsx_usb hid_generic usbhid hid sr_mod cdrom sd_mod serio_raw atkbd libps2 ahci libahci libata xhci_pci crc32c_intel i8042 xhci_hcd scsi_mod serio
[12507.259466] CPU: 1 PID: 16380 Comm: sudo Tainted: P        W  OE     5.3.8-arch1-1 #1
[12507.259466] Hardware name: ASUSTeK COMPUTER INC. X555UB/X555UB, BIOS X555UB.301 02/20/2017
[12507.259483] RIP: 0010:ieee80211_rx_napi.cold+0xc/0x67 [mac80211]
[12507.259485] Code: 38 48 81 c1 70 04 00 00 48 81 c6 38 01 00 00 e8 0a 10 77 dc b8 01 00 00 00 e9 26 4b fb ff 48 c7 c7 60 ab eb c0 e8 b7 23 25 dc <0f> 0b 48 89 ef e8 7f f8 89 dc e9 d1 5b fb ff 48 c7 c7 60 ab eb c0
[12507.259485] RSP: 0000:ffffb624c0120e10 EFLAGS: 00010246
[12507.259486] RAX: 0000000000000024 RBX: ffff8ee22cae07a0 RCX: 0000000000000000
[12507.259487] RDX: 0000000000000000 RSI: ffff8ee23ba97708 RDI: 00000000ffffffff
[12507.259488] RBP: ffff8ee1ab8b8b00 R08: 0000000000001511 R09: 0000000000000001
[12507.259488] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[12507.259489] R13: 0000000000000001 R14: 0000000000000006 R15: 0000000000000000
[12507.259490] FS:  00007fe70c78b740(0000) GS:ffff8ee23ba80000(0000) knlGS:0000000000000000
[12507.259491] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[12507.259491] CR2: 00007fe70ca9c1b0 CR3: 00000001f9502001 CR4: 00000000003606e0
[12507.259492] Call Trace:
[12507.259494]  <IRQ>
[12507.259499]  ? __mod_zone_page_state+0x66/0xa0
[12507.259502]  ? kmem_cache_free_bulk+0x2e1/0x450
[12507.259512]  ieee80211_tasklet_handler+0xbc/0xd0 [mac80211]
[12507.259515]  tasklet_action_common.isra.0+0x4a/0xb0
[12507.259517]  __do_softirq+0x114/0x332
[12507.259519]  irq_exit+0xd4/0xf0
[12507.259521]  do_IRQ+0xbb/0x130
[12507.259524]  common_interrupt+0xf/0xf
[12507.259524]  </IRQ>
[12507.259527] RIP: 0010:__do_page_fault+0x12c/0x4f0
[12507.259528] Code: a9 ff ff ff 7f 0f 85 cf 01 00 00 48 85 db 0f 84 c6 01 00 00 41 f6 84 24 88 00 00 00 03 0f 84 4a 01 00 00 fb 66 0f 1f 44 00 00 <41> bf 54 00 00 00 0f 1f 44 00 00 44 89 f8 48 89 e9 83 c8 01 83 e1
[12507.259529] RSP: 0000:ffffb624c4a2fec8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffffda
[12507.259530] RAX: 0000000080000000 RBX: ffff8ee21a601980 RCX: 0000000000000000
[12507.259530] RDX: 00007fe70ca9c1b0 RSI: 0000000000000000 RDI: ffffb624c4a2ff58
[12507.259531] RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000
[12507.259531] R10: 0000000000000000 R11: 0000000000000000 R12: ffffb624c4a2ff58
[12507.259532] R13: 00007fe70ca9c1b0 R14: 00007fe70ca9c000 R15: 0000000000000000
[12507.259535]  do_page_fault+0x31/0x130
[12507.259536]  page_fault+0x3e/0x50
[12507.259538] RIP: 0033:0x7fe70c9a190d
[12507.259539] Code: 64 48 8b 04 25 28 00 00 00 48 89 44 24 38 31 c0 8b 05 b7 a8 0f 00 85 c0 0f 8e af 02 00 00 83 c0 01 83 f8 64 0f 8f 53 01 00 00 <89> 05 9d a8 0f 00 80 3d 16 87 0f 00 00 0f 84 a3 02 00 00 48 8b 05
[12507.259540] RSP: 002b:00007ffc8325d380 EFLAGS: 00010287
[12507.259540] RAX: 000000000000000a RBX: 000055b4c6e1fc80 RCX: 0000000000000400
[12507.259541] RDX: 000055b4c6e1fcb0 RSI: 000055b4c6e1fc80 RDI: 000055b4c6e15740
[12507.259541] RBP: 0000000000000400 R08: 00007ffc8325d418 R09: 0000000000000041
[12507.259542] R10: 0000000000000000 R11: 00007fe70ca96a40 R12: 000055b4c6e1fc80
[12507.259543] R13: 000055b4c6e15740 R14: 000055b4c6e1fcb0 R15: 0000000000000000
[12507.259544] ---[ end trace 934096102c096065 ]---
[12507.907345] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
[12516.922094] audit: type=1131 audit(1573296348.129:240): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

And we have a simliar bug report regarding an ATHEROS driver, here:
https://bugzilla.kernel.org/show_bug.cgi?id=198701

So if it is really a driver issue and not related to xhci, we have this issue on rt2800usb, mt76 and ath9k_htc.
Comment 101 Michael 2019-11-13 10:33:24 UTC
Here is a new log (dmesg and trace):
https://www.sendspace.com/file/hy2puw

Device: ALFA AWUS036NH
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter

The device is connected and entered promiscuous mode
[76538.089897] xhci_hcd 0000:03:00.0: Waiting for status stage event
[76541.048223] xhci_hcd 0000:03:00.0: Transfer error for slot 23 ep 2 on endpoint
[76541.048233] xhci_hcd 0000:03:00.0: // Ding dong!
[76541.048356] xhci_hcd 0000:03:00.0: Ignoring reset ep completion code of 1
[76542.194353] device wlp3s0f0u2 entered promiscuous mode
...
we do not receive data via AF_PACKET socket.
...
[76542.194385] audit: type=1700 audit(1573639400.432:141): dev=wlp3s0f0u2 prom=256 old_prom=0 auid=1000 uid=0 gid=0 ses=2
[76554.680919] xhci_hcd 0000:03:00.0: Cancel URB 00000000e8c9ee79, dev 2, ep 0x81, starting at offset 0xff05d000
[76554.680929] xhci_hcd 0000:03:00.0: // Ding dong!

I can't find anything that caused it, except of the transfer error at 76541.048223.

If we connect the device to an USB2 port, everything is fine:
https://www.sendspace.com/file/azoa4a
we receive data via AF_PACKET socket.
The device is working as expected.
Comment 102 Michael 2019-12-04 08:14:03 UTC
Still present in kernel 5.4:
https://github.com/ZerBea/hcxdumptool/issues/80#issuecomment-561525525
Comment 103 Michael 2020-02-08 10:46:48 UTC
Still present running

$ uname -r
5.5.2-arch1-1

[16300.890097] mt76x0u 5-3.1.2:1.0: ASIC revision: 76100002 MAC revision: 76502000
[16301.239555] mt76x0u 5-3.1.2:1.0: EEPROM ver:02 fae:01
[16301.578393] ieee80211 phy6: Selected rate control algorithm 'minstrel_ht'
[16301.595805] mt76x0u 5-3.1.2:1.0 wlp39s0f3u3u1u2: renamed from wlan0
[16316.881303] device wlp39s0f3u3u1u2 entered promiscuous mode
[16316.881347] audit: type=1700 audit(1581158632.980:189): dev=wlp39s0f3u3u1u2 prom=256 old_prom=0 auid=1000 uid=0 gid=0 ses=2
[16316.882150] mt76x0u 5-3.1.2:1.0: tx urb failed: -71
[16316.882187] mt76u_complete_rx: 1989 callbacks suppressed
[16316.882190] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882227] mt76x0u 5-3.1.2:1.0: tx urb failed: -71
[16316.882267] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882346] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882426] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882505] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882586] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882666] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882745] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882825] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.882905] mt76x0u 5-3.1.2:1.0: rx urb failed: -71
[16316.911559] usb 5-3.1.2: USB disconnect, device number 8
[16316.911980] xhci_hcd 0000:27:00.3: WARN Cannot submit Set TR Deq Ptr
[16316.911982] xhci_hcd 0000:27:00.3: A Set TR Deq Ptr command is pending.
[16316.921294] mt76x0u 5-3.1.2:1.0: mac specific condition occurred
[16316.948240] device wlp39s0f3u3u1u2 left promiscuous mode
Comment 104 Michael 2020-02-08 11:06:05 UTC
From now on this USB port is unusable.
E.g. connecting an USB memory stick to the same USB port
ID 13fe:6300 Kingston Technology Company Inc. USB DISK 3.0

spams dmesg log:
[16924.494936] usb 1-2: device descriptor read/8, error -71
[16924.625947] usb 1-2: device descriptor read/8, error -71
[16925.060354] usb 1-2: new high-speed USB device number 10 using xhci_hcd
[16925.339024] usb 1-2: device descriptor read/8, error -71
[16925.439343] usb usb2-port2: config error
[16925.469057] usb 1-2: device descriptor read/8, error -71
[16925.573848] usb usb1-port2: attempt power cycle
[16926.217012] usb 1-2: new high-speed USB device number 11 using xhci_hcd
[16926.890380] usb 1-2: device descriptor read/64, error -71
[16927.837037] usb 1-2: device descriptor read/64, error -71
[16928.067117] usb 1-2: new high-speed USB device number 12 using xhci_hcd
[16928.390350] usb usb2-port2: config error
[16928.783690] usb 1-2: device descriptor read/64, error -71
[16929.730336] usb 1-2: device descriptor read/64, error -71


I noticed this behavior only on AMD RYZEN systems.
Comment 105 Michael 2020-02-13 14:22:17 UTC
A Garmin eTrex 30 connected to an USB 3.0 port of an AMD RYZEN system showing the same behavior:
[23803.507473] usb 1-2: new high-speed USB device number 14 using xhci_hcd
[23803.547562] usb 1-2: New USB device found, idVendor=05e3, idProduct=0727, bcdDevice= 2.50
[23803.547566] usb 1-2: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[23803.547568] usb 1-2: Product: USB Storage
[23803.547570] usb 1-2: Manufacturer: Generic
[23803.547572] usb 1-2: SerialNumber: 000000000250
[23803.554609] usb-storage 1-2:1.0: USB Mass Storage device detected
[23803.554796] scsi host9: usb-storage 1-2:1.0
[23804.580523] scsi 9:0:0:0: Direct-Access     Generic  STORAGE DEVICE   0250 PQ: 0 ANSI: 0
[23804.580860] sd 9:0:0:0: Attached scsi generic sg2 type 0
[23804.818580] sd 9:0:0:0: [sdb] 30392320 512-byte logical blocks: (15.6 GB/14.5 GiB)
[23804.820914] sd 9:0:0:0: [sdb] Write Protect is off
[23804.820918] sd 9:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[23804.822987] sd 9:0:0:0: [sdb] No Caching mode page found
[23804.822991] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[23804.849969]  sdb: sdb1
[23804.854844] sd 9:0:0:0: [sdb] Attached SCSI removable disk
[24257.645365] usb 1-1: new full-speed USB device number 15 using xhci_hcd
[24257.862068] usb 1-1: device descriptor read/64, error -71


Connected to an USB 2.0 port or to an INTEL system (using the same cable!), everything is fine.
Comment 106 Andreas 2020-02-22 12:28:06 UTC
Hello,
I found this bug by google search when looking for the error message. I have a quite similar behaviour when trying to clear a IDE disk by writing urandom data to it. I'm using a usb<->IDE converter. It's working quite fine when using one of the USB2.0 ports but fails with upper error message in most USB3.1 Port scenarios.

System:
Vanilla Kernel 5.4.21 (Debian bullseye configuration)
Ryzen 7 1800X
Gigabyte AX370 Gaming 5
 - X370 Series Chipset USB 3.1 xHCI Controller (rev 02)
 - ASMedia Technology Inc. ASM1143 USB 3.1 Host Controller (doesn't work at all)
 - Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) USB 3.0 Host Controller

The issue seems to have some sort of "cable" component as I do get scenarios which seem to work even on USB3.0 Ports, I'll just write what I observed.

Case 1 USB 3.1:
USB<->SATA device -> USB3.1 Port -> worked at least once

Case 2 USB 3.1:
USB<->SATA device -> 4-Port USB hub (10cm cable) -> worked at least once

Case 3 USB 3.1:
USB<->SATA device -> 4-Port USB hub (40cm cable) -> USB 3.1 Port --> never managed to clean disk

Case 4 USB 3.1: 
USB<->SATA device -> 2m usb cable -> USB 3.1 Port --> never managed to clean disk

case 5 USB 2.0:
USB<->SATA devive -> USB 2.0 Port -> works

case 6 USB 2.0:
USB<->SATA device -> 4-Port USB hub (10cm cable) -> USB 2.0 Port -> works

case 7 USB 2.0:
USB<->SATA device -> 4-Port USB hub (40cm cable) -> USB 2.0 Port -> works

case 8 USB 2.0:
USB<->SATA device -> 2m cable -> USB 2.0 Port -> works

case 9 USB 2.0:
USB<->SATA device -> 2m cable 4-Port USB hub (40cm cable) -> USB 2.0 Port -> works

All tested USB hubs are 2.0 hubs. The asmedia usb doesn't work at all port is dead right after booting, yet this seems to be unrelated to this issue here.

To me this does look like the 3.1 Ports are extremely sensitive to cable issues.
Comment 107 biopsin 2020-03-18 11:35:51 UTC
5.4.25_1 - ROG STRIX B450-I GAMING (RYZEN)

Hi,
bug is still present with external HDD conectected on DELTACO USB3.0 TO SATAII + 3.5*IDE Cable.


dmesg output:

[ 9540.086599] usb 2-3: device descriptor read/8, error -110
[ 9545.717826] usb 2-3: device descriptor read/8, error -110
[ 9551.350614] usb 2-3: device descriptor read/8, error -110
[ 9556.982468] usb 2-3: device descriptor read/8, error -110
[ 9562.614549] usb 2-3: device descriptor read/8, error -110
[ 9568.246248] usb 2-3: device descriptor read/8, error -110
[ 9573.878494] usb 2-3: device descriptor read/8, error -110
[ 9579.510536] usb 2-3: device descriptor read/8, error -110
[ 9579.658663] blk_update_request: I/O error, dev sdc, sector 319807200 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 0
[ 9579.658779] blk_update_request: I/O error, dev sdc, sector 319807456 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 0
[ 9579.658809] blk_update_request: I/O error, dev sdc, sector 319807200 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[ 9579.658842] blk_update_request: I/O error, dev sdc, sector 2048 op 0x1:(WRITE) flags 0x100000 phys_seg
1 prio class 0
[ 9579.658846] Buffer I/O error on dev sdc1, logical block 0, lost async page write
[ 9580.671946] EXT4-fs error (device sdc1): __ext4_find_entry:1531: inode #2: comm udevil: reading directory lblock 0
[ 9580.674408] EXT4-fs error (device sdc1): __ext4_find_entry:1531: inode #2: comm udevil: reading directory lblock 0
[ 9585.142455] usb 2-3: device descriptor read/8, error -110
[ 9590.773921] usb 2-3: device descriptor read/8, error -110
[ 9590.773935] xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 9592.045019] Buffer I/O error on dev sdc1, logical block 30441472, lost sync page write
[ 9592.045023] JBD2: Error -5 detected when updating journal superblock for sdc1-8.
[ 9592.045025] Buffer I/O error on dev sdc1, logical block 30441472, lost sync page write
[ 9592.045026] JBD2: Error -5 detected when updating journal superblock for sdc1-8.
[ 9596.406564] usb 2-3: device descriptor read/8, error -110
Comment 108 ErickP 2020-03-25 02:03:30 UTC
Hello,

This bug is present on ARM64 SBC system too.

uname -r
5.4.26-rockchip64 (Ubuntu 18.04.4 LTS)

Device: Realtek Ethernet 8152 USB 3.0 Gigabit adapter

dmesg:
[11519.368679] xhci-hcd xhci-hcd.1.auto: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[11519.997949] usb 8-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[11522.779552] xhci-hcd xhci-hcd.1.auto: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[11523.389784] usb 8-1: reset SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[11528.980290] xhci-hcd xhci-hcd.1.auto: xHCI host not responding to stop endpoint command.
[11528.993885] xhci-hcd xhci-hcd.1.auto: xHCI host controller not responding, assume dead
[11528.994627] xhci-hcd xhci-hcd.1.auto: HC died; cleaning up
Comment 109 Michael 2020-04-14 12:36:17 UTC
Just a small notice: bug is still alive running
$ uname -r
5.6.3-arch1-1

[21762.874883] usb 1-2: new high-speed USB device number 5 using xhci_hcd
[21762.928994] usb 1-2: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[21762.928997] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[21762.929000] usb 1-2: Product: 802.11 n WLAN
[21762.929002] usb 1-2: Manufacturer: Ralink
[21762.929003] usb 1-2: SerialNumber: 1.0
[21763.223013] usb 1-2: reset high-speed USB device number 5 using xhci_hcd
[21763.266041] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[21763.944109] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 5370 detected
[21763.950281] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[21763.950768] usbcore: registered new interface driver rt2800usb
[21763.962966] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[21807.879713] ieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[21807.879968] ieee80211 phy0: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[21811.980951] device wlp3s0f0u2 entered promiscuous mode
[21831.708072] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[21831.813186] device wlp3s0f0u2 left promiscuous mode
Comment 110 Mathias Nyman 2020-04-14 13:07:24 UTC
Created attachment 288441 [details]
Patch v2 1/2  handling halted endpoints at completion of stop endpoint command

patch 1/2 of two patch series to fix this issue
Comment 111 Mathias Nyman 2020-04-14 13:08:32 UTC
Created attachment 288443 [details]
Patch v2 2/2  handling halted endpoints at completion of stop endpoint command

patch 2/2 of series to fix this issue
Comment 112 Michael 2020-04-14 13:47:22 UTC
Thanks for the patches. Added both of them and the issue is still present:

[   21.783543] usb 1-1: new high-speed USB device number 5 using xhci_hcd
[   21.837511] usb 1-1: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[   21.837515] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   21.837518] usb 1-1: Product: 802.11 n WLAN
[   21.837520] usb 1-1: Manufacturer: Ralink
[   21.837522] usb 1-1: SerialNumber: 1.0
[   22.165094] usb 1-1: reset high-speed USB device number 5 using xhci_hcd
[   22.207584] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[   22.886244] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 5370 detected
[   22.891860] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   22.892493] usbcore: registered new interface driver rt2800usb
[   22.904005] rt2800usb 1-1:1.0 wlp3s0f0u1: renamed from wlan0
[   43.634949] device wlp3s0f0u1 entered promiscuous mode
[   43.635031] audit: type=1700 audit(1586871720.135:70): dev=wlp3s0f0u1 prom=256 old_prom=0 auid=1000 uid=0 gid=0 ses=2
[   65.039630] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[   65.091107] device wlp3s0f0u1 left promiscuous mode
Comment 113 Michael 2020-04-14 13:48:05 UTC
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Comment 114 Michael 2020-04-14 13:57:24 UTC
Not all devices are affected in the same way.
Same USB3 port and not affected:
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter

[  765.080527] usb 1-1: new high-speed USB device number 7 using xhci_hcd
[  765.133195] usb 1-1: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[  765.133199] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  765.133201] usb 1-1: Product: 802.11 n WLAN
[  765.133203] usb 1-1: Manufacturer: Ralink
[  765.133204] usb 1-1: SerialNumber: 1.0
[  765.345171] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
[  765.388223] ieee80211 phy2: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[  766.066341] ieee80211 phy2: rt2x00_set_rf: Info - RF chipset 0005 detected
[  766.072528] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
[  766.091676] audit: type=1130 audit(1586872442.909:94): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  766.097778] rt2800usb 1-1:1.0 wlp3s0f0u1: renamed from wlan0
[  771.664919] ieee80211 phy2: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  771.664959] ieee80211 phy2: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[  775.893631] device wlp3s0f0u1 entered promiscuous mode
[  775.893663] audit: type=1700 audit(1586872452.713:99): dev=wlp3s0f0u1 prom=256 old_prom=0 auid=1000 uid=0 gid=0 ses=2
[  777.876925] device wlp3s0f0u1 left promiscuous mode
Comment 115 Bernhard 2020-04-14 17:08:23 UTC
I just applied both patches, the Xhci Error message actually went away BUT the device still didn't work.

Logs after unplugging & plugging in the device with the patches:
[   72.648791] usb 1-4: USB disconnect, device number 3
[   72.650675] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x101c with error -19
[   72.753779] wlan0: deauthenticating from cc:ce:1e:99:77:ed by local choice (Reason: 3=DEAUTH_LEAVING)
[   72.781608] audit: type=1130 audit(1586883567.129:93): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   72.793722] audit: type=1130 audit(1586883567.139:94): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   73.317939] audit: type=1131 audit(1586883567.665:95): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=geoclue comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   77.799300] audit: type=1131 audit(1586883572.149:96): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   80.933744] usb 1-4: new high-speed USB device number 6 using xhci_hcd
[   80.988187] usb 1-4: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[   80.988190] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   80.988191] usb 1-4: Product: 802.11 n WLAN
[   80.988192] usb 1-4: Manufacturer: Ralink
[   80.988193] usb 1-4: SerialNumber: 1.0
[   81.131897] usb 1-4: reset high-speed USB device number 6 using xhci_hcd
[   81.174210] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[   81.852225] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
[   81.858386] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   81.920689] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[   81.920711] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

Compared to the output without patches:
[   67.093338] usb 1-4: USB disconnect, device number 3
[   67.093964] xhci_hcd 0000:15:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[   67.096166] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x101c with error -19
[   67.168604] wlan0: deauthenticating from cc:ce:1e:99:77:ed by local choice (Reason: 3=DEAUTH_LEAVING)
[   67.179973] audit: type=1130 audit(1586883250.510:93): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   67.231226] audit: type=1130 audit(1586883250.560:94): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   72.236839] audit: type=1131 audit(1586883255.570:95): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   73.323295] audit: type=1131 audit(1586883256.653:96): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=geoclue comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   77.327072] audit: type=1131 audit(1586883260.660:97): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   77.865232] usb 1-4: new high-speed USB device number 6 using xhci_hcd
[   77.919826] usb 1-4: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[   77.919830] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   77.919832] usb 1-4: Product: 802.11 n WLAN
[   77.919833] usb 1-4: Manufacturer: Ralink
[   77.919835] usb 1-4: SerialNumber: 1.0
[   78.063383] usb 1-4: reset high-speed USB device number 6 using xhci_hcd
[   78.105846] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[   78.783888] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
[   78.790016] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   78.874273] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[   78.874299] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Comment 116 Michael 2020-04-15 06:27:39 UTC
Tested another device against the applied patches to make sure the issue isn't related to the combination rt2800usb - usb host:
ID 7392:7710 Edimax Technology Co., Ltd Edimax Wi-Fi

[   68.126337] usb 1-2: new high-speed USB device number 17 using xhci_hcd
[   68.181565] usb 1-2: New USB device found, idVendor=7392, idProduct=7710, bcdDevice= 0.00
[   68.181568] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   68.181571] usb 1-2: Product: Edimax Wi-Fi
[   68.181573] usb 1-2: Manufacturer: MediaTek
[   68.181575] usb 1-2: SerialNumber: 1.0
[   68.398420] usb 1-2: reset high-speed USB device number 17 using xhci_hcd
[   68.446602] mt7601u 1-2:1.0: ASIC revision: 76010001 MAC revision: 76010500
[   68.473662] mt7601u 1-2:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____
[   69.461098] mt7601u 1-2:1.0: EEPROM ver:0d fae:00
[   69.472103] mt7601u 1-2:1.0: EEPROM country region 01 (channels 1-13)
[   70.152995] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[   70.472567] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[   70.792966] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[   71.112927] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[   71.432909] mt7601u 1-2:1.0: Warning: mt7601u_mcu_wait_resp retrying
[   71.432913] mt7601u 1-2:1.0: Error: mt7601u_mcu_wait_resp timed out
[   71.433388] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[   71.435442] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[   71.582930] mt7601u 1-2:1.0: Vendor request req:07 off:0080 failed:-71
[   71.729217] mt7601u 1-2:1.0: Vendor request req:02 off:0080 failed:-71


After the device is unplugged, dmesg log is spammed:
[  363.312561] mt7601u 1-2:1.0: Vendor request req:07 off:0730 failed:-71
[  363.479252] mt7601u 1-2:1.0: Vendor request req:07 off:0730 failed:-71
[  363.649243] mt7601u 1-2:1.0: Vendor request req:07 off:0730 failed:-71
...
[  380.069000] mt7601u 1-2:1.0: Vendor request req:02 off:0080 failed:-71
[  380.069055] mt7601u: probe of 1-2:1.0 failed with error -110
[  380.069272] usb 1-2: USB disconnect, device number 90


@Bernhard: I can confirm missing Error message on some devices, too. The devices are not working.
Comment 117 Michael 2020-06-01 17:18:28 UTC
Just got a new variant of that issue:
[39799.493322] usb usb1-port9: disabled by hub (EMI?), re-enabling...
[39799.493328] usb 1-9: USB disconnect, device number 5
[39799.833153] usb 1-9: new low-speed USB device number 6 using xhci_hcd
[39815.286287] usb 1-9: device descriptor read/64, error -110
[39826.307239] xhci_hcd 0000:03:00.0: ERROR Transfer event pointed to bad slot 4
[39826.307247] xhci_hcd 0000:03:00.0: @00000000dffed510 dff3d720 00000000 03000005 04038001
[39826.307267] xhci_hcd 0000:03:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x000f address=0x60 flags=0x0020]
[39826.307395] xhci_hcd 0000:03:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 0 comp_code 3
[39826.307399] xhci_hcd 0000:03:00.0: Looking for event-dma 00000000dfeff000 trb-start 00000000dfeff0f0 trb-end 00000000dfeff110 seg-start 00000000dfeff000 seg-end 00000000dfeffff0

Affected: CHERRY RS 6000 USB ON keyboard and Logitech RX1000 mouse stopped working - reboot required.

$ uname -r
5.6.15-arch1-1
Comment 118 Øyvind Stegard 2020-06-03 10:17:30 UTC
My Linux server just crashed rather hard with these errors:
juni 02 19:26:17 nori kernel: xhci_hcd 0000:04:00.0: WARN Cannot submit Set TR Deq Ptr
juni 02 19:26:17 nori kernel: xhci_hcd 0000:04:00.0: A Set TR Deq Ptr command is pending.
juni 02 19:26:17 nori kernel: usb 4-1: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
juni 02 19:26:37 nori kernel: xhci_hcd 0000:04:00.0: WARN Cannot submit Set TR Deq Ptr
juni 02 19:26:37 nori kernel: xhci_hcd 0000:04:00.0: A Set TR Deq Ptr command is pending.
juni 02 19:26:37 nori kernel: usb 4-1: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd


Affected a USB3-connected hard-drive (Bus 004 Device 002: ID 059f:1057 LaCie, Ltd), which became unresponsive, and there were several hung processes blocked on I/O to the drive. The drive itself has zero logged SMART-errors, so it's likely not failing. Another USB2-connected drive also was affected, but not in an unrecoverable fashion, i.e. hung processes could be killed. The server has been stable for several years, but this one forced me to do a hard power-off, due to soft reboot not able to complete.

Running Ubuntu 18.04.4.
[    0.000000] Linux version 5.3.0-53-generic (buildd@lgw01-amd64-016) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #47~18.04.1-Ubuntu SMP Thu May 7 13:10:50 UTC 2020 (Ubuntu 5.3.0-53.47~18.04.1-generic 5.3.18)


With USB controller:
04:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller (prog-if 30 [XHCI])
        Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer ASM1042 SuperSpeed USB Host Controller
        Flags: bus master, fast devsel, latency 0, IRQ 18
        Memory at f7c00000 (64-bit, non-prefetchable) [size=32K]
        Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
        Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
        Capabilities: [78] Power Management version 3
        Capabilities: [80] Express Legacy Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Kernel driver in use: xhci_hcd
Comment 119 Michael 2020-06-07 09:16:23 UTC
definitely weak xHCI host system (at this time Logitech keyboard, connected to USB 3 port):

[ 9241.775664] usb 1-9: new low-speed USB device number 7 using xhci_hcd
[ 9242.327943] xhci_hcd 0000:03:00.0: ERROR unknown event type 2
[ 9246.875619] xhci_hcd 0000:03:00.0: ERROR mismatched command completion event
[ 9249.008917] xhci_hcd 0000:03:00.0: Timeout while waiting for setup device command
[ 9264.462045] xhci_hcd 0000:03:00.0: Abort failed to stop command ring: -110
[ 9264.462080] xhci_hcd 0000:03:00.0: xHCI host controller not responding, assume dead
[ 9264.462093] xhci_hcd 0000:03:00.0: HC died; cleaning up
[ 9264.462128] xhci_hcd 0000:03:00.0: Timeout while waiting for setup device command
[ 9264.668691] usb 1-9: device not accepting address 7, error -62
[ 9264.668723] usb usb1-port9: couldn't allocate usb_device
Comment 120 Michael 2020-06-13 10:01:27 UTC
Still present on
$ uname -r
5.7.2-arch1-1
Comment 121 himanshuxd 2020-06-24 14:37:12 UTC
Have the same error 
$ dmesg | grep xhci 
has
[40557.207677] xhci_hcd 0000:00:14.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state
Comment 122 Roger Wolff 2020-07-04 15:28:14 UTC
I'm using "stock Ubuntu 20.04" 

I have this happening on kernel 5.4.0 . 

[ 4063.051692] usb 3-10.4: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ 4063.051695] usb 3-10.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4063.051696] usb 3-10.4: Product: ChibiOS/RT Virtual COM Port
[ 4063.051698] usb 3-10.4: Manufacturer: STMicroelectronics
[ 4063.051699] usb 3-10.4: SerialNumber: 400
[ 4063.058680] cdc_acm 3-10.4:1.0: ttyACM1: USB ACM device
[ 4073.043695] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[ 4073.043697] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
[ 4073.059819] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
[ 4073.059822] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.

I plugged in my development board that provides a virtual comport. I then hit boot-and-reset buttons on the board to make it boot into DFU bootloader mode. 

This has worked the last decade or so.  I didn't read everything above, but I saw something about AMD... I have: 

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)

as the USB controller: Not AMD. -> Not hardware vendor related imho.
Comment 123 sixerjman 2020-07-04 15:32:51 UTC
Happening at ~30 second intervals on Debian kernel 5.7.0-1-amd64 with Dell XHCI Controller and USB 3.0 hub:

xhci_hcd 0000:00:10.0: WARN Cannot submit Set TR Deq Ptr
Jul  4 05:02:32 hostname kernel: [33164.415980] xhci_hcd 0000:00:10.0: A Set TR Deq Ptr command is pending.
Jul  4 05:02:32 hostname kernel: [33164.497202] usb 3-3.1: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd
Comment 124 Roger Wolff 2020-07-04 15:50:53 UTC
I've now managed to get a workable situation for myself: 
Using an old USB2-hub instead of the USB3-hub that I was using before. 

The DFU download takes ages when there is no hub between my computer and the STM32. Using the USB3-hub worked a few months ago when I was still on Ubuntu 16.04. 

[ 5382.799225] usb 3-4.1: Product: ChibiOS/RT Virtual COM Port
[ 5382.799226] usb 3-4.1: Manufacturer: STMicroelectronics
[ 5382.799227] usb 3-4.1: SerialNumber: 400
[ 5382.807282] cdc_acm 3-4.1:1.0: ttyACM3: USB ACM device
[ 5387.003761] usb 3-4: clear tt 1 (91a1) error -32
About 12 identical messages in the same millisecond deleted. 
[ 5387.004976] usb 3-4: clear tt 1 (91a1) error -32
[ 5387.222030] usb 3-4.1: USB disconnect, device number 22
[ 5387.224061] cdc_acm 3-4.1:1.0: failed to set dtr/rts
[ 5387.522299] usb 3-4.1: new full-speed USB device number 23 using xhci_hcd
[ 5387.627345] usb 3-4.1: New USB device found, idVendor=0483, idProduct=df11, bcdDevice=22.00
[ 5387.627348] usb 3-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5387.627350] usb 3-4.1: Product: STM32  BOOTLOADER
[ 5387.627352] usb 3-4.1: Manufacturer: STMicroelectronics
[ 5387.627353] usb 3-4.1: SerialNumber: FFFFFFFEFFFF

So this is a mostly normal switchover from the usercode running ACM USB code and the bootloader. Through an USB2 switch.
Comment 125 masterl 2020-08-04 10:30:38 UTC
I was getting similar freezes with HP ENVY x360 Convertible 15 running OpenSUSE Leap 15.2. 
This laptop model doesn't come with an RJ45 (LAN) port so I use a Type C USB ethernet adapter. And it was exhibiting the same problems, after some time it would just fail to work and initially I thought it was the NetworkManager.
For me even running the command 'ip add' would lock up, yet most other commands and even the desktop manager would still be working fine. But I couldn't get network back or even switch to WiFi. Basically every time this happened I had to restart the laptop. 

Anyway, after going through the accounts here and other sites I found one which suggested that the issue could be with power management suspending the USB device. 

So I added the particular USB to TLP black_list to prevent it from being suspended and so far I've gon 24 hrs without the lockup.

Link to forum: https://forum.manjaro.org/t/usb-ethernet-dongle-stopped-working/125717
Comment 126 Michael 2020-09-03 09:35:32 UTC
Still present on:
$ uname -r
5.8.5-arch1-1

device connected to USB3 port:
[15005.134111] usb 1-2: new high-speed USB device number 13 using xhci_hcd
[15005.311803] usb 1-2: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[15005.311807] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15005.311810] usb 1-2: Product: 802.11 n WLAN
[15005.311812] usb 1-2: Manufacturer: Ralink
[15005.311814] usb 1-2: SerialNumber: 1.0
[15005.602591] usb 1-2: reset high-speed USB device number 13 using xhci_hcd
[15005.834856] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[15006.513400] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 5370 detected
[15006.519415] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[15006.520103] usbcore: registered new interface driver rt2800usb
[15006.532103] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
...
[15062.425086] Bluetooth: Core ver 2.22
[15062.425100] NET: Registered protocol family 31
[15062.425101] Bluetooth: HCI device and connection manager initialized
[15062.425103] Bluetooth: HCI socket layer initialized
[15062.425105] Bluetooth: L2CAP socket layer initialized
[15062.425107] Bluetooth: SCO socket layer initialized
[15068.677302] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Any ideas, why HCI device and connection manager initialized?
The device doesn't have BT:
$ lsusb
Bus 001 Device 013: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

device connected to USB2 port:
[15317.960151] usb 5-1.1.2: new high-speed USB device number 6 using xhci_hcd
[15318.186487] usb 5-1.1.2: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[15318.186492] usb 5-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15318.186495] usb 5-1.1.2: Product: 802.11 n WLAN
[15318.186497] usb 5-1.1.2: Manufacturer: Ralink
[15318.186498] usb 5-1.1.2: SerialNumber: 1.0
[15318.376954] usb 5-1.1.2: reset high-speed USB device number 6 using xhci_hcd
[15318.593739] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[15318.603488] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
[15318.603596] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[15318.626103] rt2800usb 5-1.1.2:1.0 wlp39s0f3u1u1u2: renamed from wlan0
...
[15336.958194] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[15336.958238] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

everything is fine!
Comment 127 Martin Jørgensen 2020-09-04 14:50:45 UTC
Experiencing the same kinda issues with my local Gentoo system on linux 5.4.60 running on my AMD Threadripper ASUS X399-A system.

[59417.351322] Bluetooth: HCI device and connection manager initialized
[59417.351326] Bluetooth: HCI socket layer initialized
[59417.351327] Bluetooth: L2CAP socket layer initialized
[59417.351330] Bluetooth: SCO socket layer initialized
[59417.356567] usbcore: registered new interface driver btusb
[59417.401190] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[59417.401191] Bluetooth: BNEP filters: protocol multicast
[59417.401195] Bluetooth: BNEP socket layer initialized
[59746.085438] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
[59746.085445] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
[59746.085450] debugfs: File 'force_bredr_smp' in directory 'hci0' already present!
[59814.624020] input: WH-1000XM2 (AVRCP) as /devices/virtual/input/input23
[59902.644488] snd_hda_intel 0000:0b:00.3: Too big adjustment 128
[59962.175286] snd_hda_intel 0000:0b:00.3: Too big adjustment 128
[60729.936646] Bluetooth: RFCOMM TTY layer initialized
[60729.936651] Bluetooth: RFCOMM socket layer initialized
[60729.936655] Bluetooth: RFCOMM ver 1.11
[61319.535471] usb 1-3: USB disconnect, device number 20
[61319.536250] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[61333.523244] usb 1-3: new full-speed USB device number 21 using xhci_hcd
[61333.947814] usb 1-3: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[61333.947818] usb 1-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[61333.947819] usb 1-3: Product: CSR8510 A10
[61454.719213] usb 1-3: USB disconnect, device number 21
[61454.719807] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Comment 128 Martin Jørgensen 2020-09-05 05:46:17 UTC
For my system, it seems to trigger after resuming from suspend.
Comment 129 Kopa Rebu 2020-09-13 16:51:20 UTC
Hi,

I'd like to add some information here about this issue, which in one of my computers happens when using a Software Defined Radio (SDR) device on some of the motherboard USB ports:

* The device works OK when using the back panel USB 3.2 Gen 1 ports
* It doesn't work OK when using the back panel USB 3.2 Gen 2 ports, or when using the front headers (either USB 3.2 Gen 1 or USB 2.0)

When I finish using the device, the following message gets logged. I have to disconnect it and plug it in again in order to use it:

xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

This motherboard is an ASUS Prime B550M.

Kernel 5.4.0-45-generic (from Ubuntu 20.04).

I've tried booting with "intel_iommu=off" or "iommu=off" just for testing, but the result is the same.
Comment 130 Michael 2020-10-02 11:07:05 UTC
Just received an AMD notebook to run some tests on 5.8.12-arch1-1:

ASUS TUF Gaming FX505D
05:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1

WiFi adapter:
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter

[  308.749192] usb 1-2: new high-speed USB device number 46 using xhci_hcd
[  308.909139] usb 1-2: New USB device found, idVendor=148f, idProduct=3070, bcdDevice= 1.01
[  308.909145] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  308.909148] usb 1-2: Product: 802.11 n WLAN
[  308.909150] usb 1-2: Manufacturer: Ralink
[  308.909153] usb 1-2: SerialNumber: 1.0
[  309.032719] usb 1-2: reset high-speed USB device number 46 using xhci_hcd
[  309.188373] ieee80211 phy40: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[  309.276422] ieee80211 phy40: rt2x00_set_rf: Info - RF chipset 0005 detected
[  309.277177] ieee80211 phy40: Selected rate control algorithm 'minstrel_ht'
[  309.297319] rt2800usb 1-2:1.0 wlp5s0f3u2: renamed from wlan0
[  309.338896] ieee80211 phy40: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  309.338980] ieee80211 phy40: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[  310.619294] usb 1-2: USB disconnect, device number 46
[  311.185849] ieee80211 phy40: rt2x00queue_flush_queue: Warning - Queue 0 failed to flush

Then xhci died.
Comment 131 Micha 2020-10-09 13:08:55 UTC
Hi,

I have the same problem with an Argus KVM switch. The mouse stopped atfer the first click to work.

uname -a
Linux sysiphus 5.8.0-2-amd64 #1 SMP Debian 5.8.10-1 (2020-09-19) x86_64 GNU/Linux

Debian Sid


❯ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 046d:c245 Logitech, Inc. G400 Optical Mouse
Bus 003 Device 003: ID 046d:c326 Logitech, Inc. Washable Keyboard K310
Bus 003 Device 002: ID 1a86:8072 QinHeng Electronics
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

journald
Okt 07 19:29:43 sysiphus kernel: usb 3-2: USB disconnect, device number 2
Okt 07 19:29:43 sysiphus kernel: usb 3-2.1: USB disconnect, device number 3
Okt 07 19:29:43 sysiphus acpid[587]: input device has been disconnected, fd 5
Okt 07 19:29:43 sysiphus kernel: xhci_hcd 0000:08:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Okt 07 19:29:43 sysiphus acpid[587]: input device has been disconnected, fd 6
Okt 07 19:29:43 sysiphus acpid[587]: input device has been disconnected, fd 12
Okt 07 19:29:43 sysiphus kernel: usb 3-2.2: USB disconnect, device number 4
Okt 07 19:29:43 sysiphus kernel: xhci_hcd 0000:08:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

dmesg with debug
[ 2539.095820] xhci_hcd 0000:00:14.0: // Ding dong!
[ 2539.095824] xhci_hcd 0000:00:14.0: // Ding dong!
[ 2539.095840] xhci_hcd 0000:00:14.0: Slot 17 output ctx = 0x3eac96000 (dma)
[ 2539.095841] xhci_hcd 0000:00:14.0: Slot 17 input ctx = 0x3ef030000 (dma)
[ 2539.095843] xhci_hcd 0000:00:14.0: Set slot id 17 dcbaa entry 000000003007eed2 to 0x3eac96000
[ 2539.173763] usb 1-10.2: new full-speed USB device number 18 using xhci_hcd
[ 2539.173772] xhci_hcd 0000:00:14.0: Set root hub portnum to 10
[ 2539.173775] xhci_hcd 0000:00:14.0: Set fake root hub portnum to 10
[ 2539.173778] xhci_hcd 0000:00:14.0: udev->tt = 000000002e0e39e0
[ 2539.173781] xhci_hcd 0000:00:14.0: udev->ttport = 0xa
[ 2539.173789] xhci_hcd 0000:00:14.0: // Ding dong!
[ 2539.174915] xhci_hcd 0000:00:14.0: Successful setup address command
[ 2539.174922] xhci_hcd 0000:00:14.0: Op regs DCBAA ptr = 0x000003ead2c000
[ 2539.174928] xhci_hcd 0000:00:14.0: Slot ID 17 dcbaa entry @000000003007eed2 = 0x000003eac96000
[ 2539.174933] xhci_hcd 0000:00:14.0: Output Context DMA address = 0x3eac96000
[ 2539.174937] xhci_hcd 0000:00:14.0: Internal device address = 17
[ 2539.198845] xhci_hcd 0000:00:14.0: Max Packet Size for ep 0 changed.
[ 2539.198851] xhci_hcd 0000:00:14.0: Max packet size in usb_device = 8
[ 2539.198854] xhci_hcd 0000:00:14.0: Max packet size in xHCI HW = 64
[ 2539.198857] xhci_hcd 0000:00:14.0: Issuing evaluate context command.
[ 2539.198867] xhci_hcd 0000:00:14.0: // Ding dong!
[ 2539.198886] xhci_hcd 0000:00:14.0: Successful evaluate context command
[ 2539.200465] usb 1-10.2: no configurations
[ 2539.200472] usb 1-10.2: can't read configurations, error -22
[ 2539.200634] xhci_hcd 0000:00:14.0: // Ding dong!
[ 2539.200641] usb 1-10-port2: unable to enumerate USB device


https://www.sendspace.com/file/d923jl trace file

All other kernel parameters above I have tested without success.



Micha
Comment 132 Eric H. 2020-11-28 06:37:47 UTC
I have same issue with HackRF SDR, and there's a bug on their side

https://github.com/mossmann/hackrf/issues/783


I connect device:

[  428.013129] usb 1-10: USB disconnect, device number 4
[ 2163.462098] usb 1-10: new high-speed USB device number 6 using xhci_hcd
[ 2163.699532] usb 1-10: New USB device found, idVendor=1d50, idProduct=6089, bcdDevice= 1.02
[ 2163.699535] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=4
[ 2163.699536] usb 1-10: Product: HackRF One
[ 2163.699538] usb 1-10: Manufacturer: Great Scott Gadgets
[ 2163.699539] usb 1-10: SerialNumber: 0000000000000000b65c67dc32a3535f

I run test once, and after device close:

[ 2187.589321] xhci_hcd 0000:02:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Then, if I try to run other tests, the device no longer respond until I reset the device (it has a reset button) or disconnect/reconnect it.

Here, I have the same setup as some other people reporting the issue, a B350 chipset (Ryzen 2700X), on ASUS ROG STRIX B350-F GAMING motherboard.

Kernel version: uname -a
Linux lx-ryzen 5.4.0-53-generic #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

This does the issue with USB3 and USB2 ports.

This same device work fine on another computer (a non-Ryzen laptop), same kernel.
Comment 133 Eric H. 2020-11-28 16:04:28 UTC
Same result with B450 chipset, same kernel.
ASUS PRIME B450M-A motherboard.
Comment 134 Bernhard 2020-11-28 16:39:11 UTC
Could this issue be caused by USB Controllers / Chipsets made by ASMedia?
B350 / X370 / B450 / X470 Chipsets are all manufactured by ASMedia.
 
And @Michael mentioned that one of his Intel systems (I'm assuming the one with a Asus P9X79 motherboard?) has issues with USB 3, but not with USB 2. So I looked up that particular mobo and guess what:

ASMedia® USB 3.0 controller :
4 x USB 3.1 Gen 1 port(s) (4 at back panel, blue)
Intel® X79 chipset :
14 x USB 2.0 port(s) (6 at back panel, black+white, 8 at mid-board)

Only the USB 3.1 Gen 1 Ports are using the ASMedia controller.
Comment 135 Micha 2020-11-28 17:16:34 UTC
My board has two controllers and both shows the same behaviour.

lspci|grep "USB controller"
00:14.0 USB controller: Intel Corporation 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller
08:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller

Asus PRIME Z270-K, BIOS 1207 06/22/2018
Comment 136 WGH 2020-12-01 02:37:08 UTC
The same problem with HackRF: it stops working after using it once (presumably due to transfers being cancelled on exit). hackrf_info still detects it though, which is probably because only the bulk transfer endpoint becomes broken.

Kernel 5.9.11

ASRock B550 Extreme4, BIOS P1.20 08/13/2020

01:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] Device 43ee
0c:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller

The debug messages on stopping the tool:

[ 3944.894483] xhci_hcd 0000:01:00.0: Transfer error for slot 28 ep 2 on endpoint
[ 3944.894494] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3944.894602] xhci_hcd 0000:01:00.0: Ignoring reset ep completion code of 1
[ 3945.396550] xhci_hcd 0000:01:00.0: Cancel URB 000000008085c3f5, dev 5, ep 0x81, starting at offset 0x1fa7ae1c90
[ 3945.396558] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3945.396690] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1c90 (dma).
[ 3945.396710] xhci_hcd 0000:01:00.0: Cancel URB 000000000098c2b5, dev 5, ep 0x81, starting at offset 0x1fa7ae1990
[ 3945.396712] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3945.396836] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1990 (dma).
[ 3945.396839] xhci_hcd 0000:01:00.0: Finding endpoint context
[ 3945.396841] xhci_hcd 0000:01:00.0: Cycle state = 0x1
[ 3945.396843] xhci_hcd 0000:01:00.0: New dequeue segment = 000000008a0bf921 (virtual)
[ 3945.396845] xhci_hcd 0000:01:00.0: New dequeue pointer = 0x1fa7ae1a90 (DMA)
[ 3945.396847] xhci_hcd 0000:01:00.0: Set TR Deq Ptr cmd, new deq seg = 000000008a0bf921 (0x1fa7ae1000 dma), new deq ptr = 00000000e5711e6d (0x1fa7ae1a90 dma), new cycle = 1
[ 3945.396851] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3945.396869] xhci_hcd 0000:01:00.0: Cancel URB 000000008b1032dd, dev 5, ep 0x81, starting at offset 0x1fa7ae1a90
[ 3945.396871] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3945.396904] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[ 3945.396909] xhci_hcd 0000:01:00.0: Slot state = 3, EP state = 2
[ 3945.397028] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1a90 (dma).
[ 3945.397040] xhci_hcd 0000:01:00.0: Cancel URB 00000000b1b43562, dev 5, ep 0x81, starting at offset 0x1fa7ae1b90
[ 3945.397042] xhci_hcd 0000:01:00.0: // Ding dong!
[ 3945.397172] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1b90 (dma).

Messages on attempts to use the device again:

[ 4076.243019] xhci_hcd 0000:01:00.0: WARN halted endpoint, queueing URB anyway.
[ 4076.243029] xhci_hcd 0000:01:00.0: WARN halted endpoint, queueing URB anyway.
[ 4076.243044] xhci_hcd 0000:01:00.0: WARN halted endpoint, queueing URB anyway.
[ 4076.243051] xhci_hcd 0000:01:00.0: WARN halted endpoint, queueing URB anyway.
[ 4077.749450] xhci_hcd 0000:01:00.0: Cancel URB 0000000063c2cde4, dev 5, ep 0x81, starting at offset 0x1fa7ae1d90
[ 4077.749456] xhci_hcd 0000:01:00.0: // Ding dong!
[ 4077.749592] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1d90 (dma).
[ 4077.749620] xhci_hcd 0000:01:00.0: Cancel URB 00000000564ffbd2, dev 5, ep 0x81, starting at offset 0x1fa7ae1e90
[ 4077.749622] xhci_hcd 0000:01:00.0: // Ding dong!
[ 4077.749748] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1e90 (dma).
[ 4077.749761] xhci_hcd 0000:01:00.0: Cancel URB 00000000ff7fb480, dev 5, ep 0x81, starting at offset 0x1fa7ae1f90
[ 4077.749763] xhci_hcd 0000:01:00.0: // Ding dong!
[ 4077.749892] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae1f90 (dma).
[ 4077.749906] xhci_hcd 0000:01:00.0: Cancel URB 00000000f83271e0, dev 5, ep 0x81, starting at offset 0x1fa7ae00a0
[ 4077.749908] xhci_hcd 0000:01:00.0: // Ding dong!
[ 4077.750035] xhci_hcd 0000:01:00.0: Removing canceled TD starting at 0x1fa7ae00a0 (dma).
Comment 137 Eric H. 2020-12-02 00:17:10 UTC
I think I've narrow it down to a minimum.

Using libusb, if you happen to call libusb_control_transfer(), which is synchronous I/O, while there's asynchronous I/O already in progress (usually caused by application error), then the cleanup to the in-progress asynchronous I/O will cause the error.

Ex:
...
libusb_submit_transfer(...); // Start async I/O
...
libusb_control_transfer(...); // Sync I/O
...
libusb_cancel_transfer(...); // .... WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
...


Or, simply

...
libusb_submit_transfer(...); // Start async I/O
...
libusb_control_transfer(...); // Sync I/O
...
libusb_release_interface(...); // Will cleanup async I/O in progress .... WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
...


The thing is that in the example above, even though there's an application error, the behavior is different on different chipset driver.

In the case of HackRF application (which I mentioned above), the application called libusb_cancel_transfer() on exit followed by a libusb_control_transfer.  That should work, since the async (streaming) I/O were truminated before sync I/O, but a final callback did a call (by mistake, did not check that the driver was in process of shutting down) to libusb_submit_transfer().  This created a race condition in which if that made it possible to trigger the above bug (made easily reproducible with properly placed 'sleep()' call).
Comment 138 S4ndm4n 2021-01-15 16:07:44 UTC
Same problems here:

ASUS X470-F Gaming
Ryzen 2700x

most problems i have with rt2800usb driver.

Any progress?
Comment 139 Mathias Nyman 2021-01-18 14:47:41 UTC
rewritten URB cancel, endpoint stop and set trb deq can be found in my tree
in rewrite_halt_stop_handling branch

git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git rewrite_halt_stop_handling  

https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=rewrite_halt_stop_handling

Does that help?
Comment 140 Térence Clastres 2021-01-18 17:31:22 UTC
Created attachment 294739 [details]
Patch from Nyman's rewrite_halt_stop_handling branch
Comment 141 Térence Clastres 2021-01-18 17:42:13 UTC
(In reply to Mathias Nyman from comment #139)
> rewritten URB cancel, endpoint stop and set trb deq can be found in my tree
> in rewrite_halt_stop_handling branch
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git
> rewrite_halt_stop_handling  
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/
> ?h=rewrite_halt_stop_handling
> 
> Does that help?

Just created the corresponding patch to easily apply your changes to linux 5.10.y.

I don't get "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state." anymore, but the problem is still here.

After connecting my android phone, I start to get `hub 2-8:1.0: hub_ext_port_status failed (err = -110)` and `device descriptor read/8, error -110` spammed for a while.
The immediate issue is the usb port in question not working but what's worrying is the issue seems to propagate to other usb ports like the ones used by my mouse or keyboard. I guess it's because they are part of the same hub?
Maybe this problem is unrelated but in any case let me know.
Comment 142 Michael 2021-01-18 17:53:18 UTC
Thanks for your effort. Unfortunately it doesn't fix the issue.
Tested two WiFi devices on
$ uname -r
5.10.7-arch1-1

First device:
$ lsusb
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

[  109.165827] usb 1-2: new high-speed USB device number 4 using xhci_hcd
[  109.410190] usb 1-2: New USB device found, idVendor=148f, idProduct=5370, bcdDevice= 1.01
[  109.410195] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  109.410197] usb 1-2: Product: 802.11 n WLAN
[  109.410199] usb 1-2: Manufacturer: Ralink
[  109.410201] usb 1-2: SerialNumber: 1.0
[  109.624366] usb 1-2: reset high-speed USB device number 4 using xhci_hcd
[  109.858679] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[  110.536313] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 5370 detected
[  110.542761] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[  110.555906] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[  117.628420] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  117.628459] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

Now running WiFi driver test (we use monitor mode to produce heavy workload):
$ sudo hcxdumptool -i wlp3s0f0u2 --check_driver

[  121.752121] device wlp3s0f0u2 entered promiscuous mode
[  121.771509] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[  121.822851] device wlp3s0f0u2 left promiscuous mode


Second device:
$ lsusb:
ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter

[  419.565208] usb 1-2: new high-speed USB device number 5 using xhci_hcd
[  419.741196] usb 1-2: New USB device found, idVendor=148f, idProduct=5572, bcdDevice= 1.01
[  419.741201] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  419.741204] usb 1-2: Product: 802.11 n WLAN
[  419.741206] usb 1-2: Manufacturer: Ralink
[  419.741208] usb 1-2: SerialNumber: 1.0
[  419.950046] usb 1-2: reset high-speed USB device number 5 using xhci_hcd
[  420.181669] ieee80211 phy2: rt2x00_set_rt: Info - RT chipset 5592, rev 0222 detected
[  420.859692] ieee80211 phy2: rt2x00_set_rf: Info - RF chipset 000f detected
[  420.868375] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
[  420.887633] rt2800usb 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[  434.285018] ieee80211 phy2: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  434.285066] ieee80211 phy2: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36

Now running WiFi driver test (we use monitor mode to produce heavy workload):
$ sudo hcxdumptool -i wlp3s0f0u2 --check_driver

[  463.468004] device wlp3s0f0u2 entered promiscuous mode
[  537.382571] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[  537.384485] ieee80211 phy2: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0500 with error -19
[  537.411446] device wlp3s0f0u2 left promiscuous mode
Comment 143 Bernhard 2021-01-18 19:34:58 UTC
The message "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state." is gone for me, but the device still doesn't work after unplugging it and plugging it in again.

After unplugging I get this message in dmesg:
ieee80211 phy1: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x1004 with error -19
Comment 144 S4ndm4n 2021-01-18 20:29:11 UTC
I am on Kali Linux 2020.4 and tried to use the patch @Mathias Nyman released.

but it failed.

did someone know a tutorial on how to do this on Kali?
Comment 145 Michael 2021-01-19 09:52:47 UTC
An ASUS TUF Gaming notebook (AMD Ryzen 5 3550H), showing a different behavior on the same device:
$ lsusb
ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter

$ uname -r
5.10.7-arch1-1

$ lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Root Complex
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 IOMMU
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge
00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]
00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]
00:01.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]
00:01.7 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 PCIe GPP Bridge [6:0]
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 61)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Raven/Raven2 Device 24: Function 7
01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 10fa (rev a1)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Non-Volatile memory controller: Micron Technology Inc Device 5410 (rev 01)
04:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Picasso (rev c2)
05:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor
05:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1
05:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1
05:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller


We end up in an endless " rt2x00queue_flush_queue: Warning - Queue 0 failed to flush" / "USB disconnect, device number x" loop, which spam dmesg:
[   61.139415] usb 3-2: new high-speed USB device number 3 using xhci_hcd
[   61.297702] usb 3-2: New USB device found, idVendor=148f, idProduct=5572, bcdDevice= 1.01
[   61.297708] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   61.297712] usb 3-2: Product: 802.11 n WLAN
[   61.297714] usb 3-2: Manufacturer: Ralink
[   61.297716] usb 3-2: SerialNumber: 1.0
[   61.466255] usb 3-2: reset high-speed USB device number 3 using xhci_hcd
[   61.620283] ieee80211 phy1: rt2x00_set_rt: Info - RT chipset 5592, rev 0222 detected
[   61.709535] ieee80211 phy1: rt2x00_set_rf: Info - RF chipset 000f detected
[   61.711046] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   61.711993] usbcore: registered new interface driver rt2800usb
[   61.724424] rt2800usb 3-2:1.0 wlp5s0f4u2: renamed from wlan0
[   61.756915] ieee80211 phy1: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[   61.757186] ieee80211 phy1: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36
[   72.279569] usb 3-2: USB disconnect, device number 3
[   72.846030] ieee80211 phy1: rt2x00queue_flush_queue: Warning - Queue 0 failed to flush
[   73.249377] usb 3-2: new high-speed USB device number 4 using xhci_hcd
[   73.407318] usb 3-2: New USB device found, idVendor=148f, idProduct=5572, bcdDevice= 1.01
[   73.407324] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   73.407328] usb 3-2: Product: 802.11 n WLAN
[   73.407330] usb 3-2: Manufacturer: Ralink
[   73.407332] usb 3-2: SerialNumber: 1.0
[   73.532850] usb 3-2: reset high-speed USB device number 4 using xhci_hcd
[   73.683428] ieee80211 phy2: rt2x00_set_rt: Info - RT chipset 5592, rev 0222 detected
[   73.768177] ieee80211 phy2: rt2x00_set_rf: Info - RF chipset 000f detected
[   73.769304] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
[   73.787530] rt2800usb 3-2:1.0 wlp5s0f4u2: renamed from wlan0
[  112.379076] device wlp5s0f4u2 entered promiscuous mode
[  153.340032] usb 3-2: USB disconnect, device number 4
[  153.905735] ieee80211 phy2: rt2x00queue_flush_queue: Warning - Queue 0 failed to flush
[  153.926132] device wlp5s0f4u2 left promiscuous mode
[  154.315733] usb 3-2: new high-speed USB device number 5 using xhci_hcd
[  154.474372] usb 3-2: New USB device found, idVendor=148f, idProduct=5572, bcdDevice= 1.01
[  154.474378] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  154.474381] usb 3-2: Product: 802.11 n WLAN
[  154.474383] usb 3-2: Manufacturer: Ralink
[  154.474385] usb 3-2: SerialNumber: 1.0
[  154.599207] usb 3-2: reset high-speed USB device number 5 using xhci_hcd
[  154.748666] ieee80211 phy3: rt2x00_set_rt: Info - RT chipset 5592, rev 0222 detected
[  154.833665] ieee80211 phy3: rt2x00_set_rf: Info - RF chipset 000f detected
[  154.834795] ieee80211 phy3: Selected rate control algorithm 'minstrel_ht'
[  154.850542] rt2800usb 3-2:1.0 wlp5s0f4u2: renamed from wlan0
[  157.356200] ieee80211 phy3: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[  157.356259] ieee80211 phy3: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.36


I double checked all devices, cables and connectors to make sure that they are working as expected, running a Raspberry Pi B+:
$ uname -r
5.4.83-3-ARCH
No "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state"
No "rt2x00queue_flush_queue: Warning - Queue 0 failed to flush"
No "USB disconnect, device number x"

Arch Arm is still on 5.4 LTS. But that doesn't matter, because the xhci issue is present on my AMD RYZEN systems (and some Intel systems) since 4.20
BTW:
I expect that Arch Arm move to 5.10 LTS, soon. It take too much time for me to compile latest kernel on a Raspberry - so I have to wait.
Comment 146 Michael 2021-01-19 10:33:57 UTC
@ S4ndm4n KALI is not the best choice to do module tests. It is designed to perform penetration tests and many modules are either patched or third party modules.
Comment 147 Stanislaw Gruszka 2021-01-20 13:25:03 UTC
Since issue affects mostly rt2800usb devices, maybe we can add quirk to xhci to restore pre 4.20 behaviour for endpoints that are used by rt2800usb. 

Please check if patch like this make the problem gone: 

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index dfa61de7c83f..b75a16e5cc9d 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2568,6 +2568,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
                remaining       = 0;
                break;
        case COMP_USB_TRANSACTION_ERROR:
+               if (1) /* this will be quirk for disable Soft Retry */
+                       break;
                if ((ep_ring->err_count++ > MAX_SOFT_RETRY) ||
                    le32_to_cpu(slot_ctx->tt_info) & TT_SLOT)
                        break;

If it does, I could then prepare patch that will change this part only for rt2800usb.
Comment 148 Bernhard 2021-01-20 13:40:11 UTC
This patch fixes the issue for me
Comment 149 Michael 2021-01-20 14:08:14 UTC
Doesn't work on
$ uname -r
5.10.8-arch1-1
and 
ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter

Warning "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state." is gone, but interface freeze.

To reproduce the issue:
$ hcxdumptool -I
wlan interfaces:
dc4ef4086e71 wlp3s0f0u2 (rt2800usb)

$ sudo hcxdumptool -i wlp3s0f0u2 --check_injection
initialization...
interface freeze and must be disconnected


expected result (we use a chipset, known as working regardless of the xhci issue connected to tthe same USB3 port):
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter

$ hcxdumptool -I
wlan interfaces:
c83a35cb08e3 wlp3s0f0u2 (rt2800usb)

$ sudo hcxdumptool -i wlp3s0f0u2 --check_injection
initialization...
starting antenna test and packet injection test (that can take up to two minutes)...
available channels: 1,2,3,4,5,6,7,8,9,10,11,12,13,14
packet injection is working on 2.4GHz!
injection ratio: 72% (BEACON: 87 PROBERESPONSE: 63)
your injection ratio is good
antenna ratio: 83% (NETWORK: 24 PROBERESPONSE: 20)
your antenna ratio is excellent, let's ride!
4 driver errors encountered during the test

terminating...

BTW:
Don't worry about the 4 driver errors. The first received packets (via raw socket) after entering monitor mode don't contain a radiotap header. This could be driver related.


BTW:
Now we connect this device
ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter
to an USB2 port:

$ sudo hcxdumptool -i wlp39s0f3u1u1u2 --check_injection
initialization...
starting antenna test and packet injection test (that can take up to two minutes)...
available channels: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,165,184,188,192,196
packet injection is working on 2.4GHz!
injection ratio: 31% (BEACON: 16 PROBERESPONSE: 5)
your injection ratio is average, but there is still room for improvement
antenna ratio: 66% (NETWORK: 3 PROBERESPONSE: 2)
your antenna ratio is good

terminating...

No warning, no disconnect, everything is fine.
Comment 150 Stanislaw Gruszka 2021-01-20 14:25:19 UTC
Michael, you experiencing different problem than Bernhard. Perhaps you can bisect this or just check if it ever worked on some older kernel (in this broken case of RT5572 + USB3) .
Comment 151 Michael 2021-01-20 14:52:06 UTC
Stanislaw, are you sure?

Same device, tested on Intel system (xhci unpatched):
Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
06:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller
07:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller

ASM1042 should be USB3, too - but I'm not sure.

$ uname -r
5.10.8-arch1-1
and 
ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter

$ sudo hcxdumptool -I
wlan interfaces:
dc4ef4086e71 wlp0s26u1u2 (rt2800usb)

$ sudo hcxdumptool -i wlp0s26u1u2 --check_injection
initialization...
starting antenna test and packet injection test (that can take up to two minutes)...
available channels: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,149,151,153,155,157,159,161,165,184,188,192,196
packet injection is working on 2.4GHz!
injection ratio: 35% (BEACON: 176 PROBERESPONSE: 62)
your injection ratio is average, but there is still room for improvement
antenna ratio: 35% (NETWORK: 20 PROBERESPONSE: 7)
your antenna ratio is average, but there is still room for improvement
2 driver errors encountered during the test

terminating...

BTW:
5GHz injection not shown as working, because I haven't set up a 5GHz ACCESS POINT to respond to hcxdumptool
Comment 152 Michael 2021-01-20 14:55:56 UTC
I forgot to mention for the RYZEN system:
03:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] X370 Series Chipset USB 3.1 xHCI Controller (rev 02)
Comment 153 Michael 2021-01-20 15:02:33 UTC
Stanislaw, the difference between them
using ehci-pci on the Intel system
vs
using xhci_hcd on the RYZEN
Thanks for pointing me into this direction.
Comment 154 Stanislaw Gruszka 2021-01-20 15:06:48 UTC
> Stanislaw, are you sure?

Well, I asked to check if hardware combination that is now broken for you ever worked. In Bernhard case it worked on 4.19 and stop to work on 4.20 and he was able to identify broken commit.
Comment 155 Stanislaw Gruszka 2021-01-20 15:16:44 UTC
Created attachment 294785 [details]
rt2800usb_no_soft_retry.patch

This is patch that restore old xhci behaviour only for rt2800usb. I use usb->transfer_flags to add "quirk" flag. Mathias, do you think it's ok to avoid Soft Retry this way, maybe you have some better idea as solution? 

Bernhard, please test if it still fixes the issue for you .
Comment 156 Michael 2021-01-20 15:22:26 UTC
/home/zerobeat/Downloads/linux-5.10.8/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c:217:25: error: 'URB_SOFT_RETRY_NOT_OK' undeclared (first use in this function); did you mean 'URB_SHORT_NOT_OK'?
  217 |  urb->transfer_flags |= URB_SOFT_RETRY_NOT_OK;
      |                         ^~~~~~~~~~~~~~~~~~~~~
      |                         URB_SHORT_NOT_OK
Comment 157 Michael 2021-01-20 15:29:49 UTC
As Bernhard, I can confirm that this patch
https://bugzilla.kernel.org/show_bug.cgi?id=202541#c147
is working for me.
This device
https://bugzilla.kernel.org/show_bug.cgi?id=202541#c10
now is working after applying that patch.
Also I can confirm the the issue on the RT5572 is related to USB3 and it is a new one.
Comment 158 Bernhard 2021-01-20 15:59:02 UTC
When applying the patch from https://bugzilla.kernel.org/show_bug.cgi?id=202541#c155 the device works, but now this message shows up very often in dmesg:

[  194.130691] usb 1-3: BOGUS urb flags, 1000200 --> 200
[  194.130704] WARNING: CPU: 0 PID: 113 at drivers/usb/core/urb.c:517 usb_submit_urb+0x1c9/0x5e0
[  194.130705] Modules linked in: rt2800usb rt2x00usb rt2800lib rt2x00lib snd_usb_audio mac80211 btusb btrtl btbcm snd_usbmidi_lib btintel snd_rawmidi snd_seq_device bluetooth xpad libarc4 mc joydev ff_memless mousedev ecdh_generic ecc cfg80211 ccm algif_aead cbc des_generic libdes ecb edac_mce_amd kvm_amd algif_skcipher rfkill kvm cmac md4 algif_hash af_alg ppdev wmi_bmof irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd snd_hda_codec_realtek cryptd glue_helper snd_hda_codec_generic amdgpu rapl ledtrig_audio snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg soundwire_intel soundwire_generic_allocation soundwire_cadence snd_hda_codec vfat fat snd_hda_core snd_hwdep soundwire_bus pcspkr r8169 snd_soc_core k10temp sp5100_tco snd_compress ccp nf_log_ipv6 realtek mdio_devres gpu_sched ac97_bus i2c_piix4 ip6t_REJECT libphy nf_reject_ipv6 i2c_algo_bit rng_core snd_pcm_dmaengine ttm snd_pcm drm_kms_helper snd_timer cec snd syscopyarea xt_hl sysfillrect sysimgblt
[  194.130748]  fb_sys_fops soundcore ip6t_rt wmi parport_pc parport pinctrl_amd gpio_amdpt video gpio_generic mac_hid nf_log_ipv4 nf_log_common ipt_REJECT nf_reject_ipv4 xt_LOG xt_limit xt_addrtype xt_tcpudp xt_conntrack ip6table_filter ip6_tables nf_conntrack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_filter pkcs8_key_parser crypto_user drm fuse agpgart bpf_preload ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 hid_steam usbhid dm_mod crc32c_intel xhci_pci xhci_pci_renesas
[  194.130769] CPU: 0 PID: 113 Comm: kworker/u32:8 Tainted: G        W         5.10.8-arch1-1 #3
[  194.130770] Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 PC MATE (MS-7A34), BIOS A.J0 01/23/2019
[  194.130774] Workqueue: phy1 rt2x00usb_work_rxdone [rt2x00usb]
[  194.130776] RIP: 0010:usb_submit_urb+0x1c9/0x5e0
[  194.130777] Code: bc 24 a0 00 00 00 48 89 54 24 08 e8 41 c1 f3 ff 48 8b 54 24 08 45 89 f0 44 89 f9 48 89 c6 48 c7 c7 60 49 ff 96 e8 d1 9c 2c 00 <0f> 0b 83 e3 01 0f 85 f1 00 00 00 8b 74 24 04 48 83 c4 18 48 89 ef
[  194.130778] RSP: 0018:ffffb97d00777d70 EFLAGS: 00010282
[  194.130779] RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff9a5d0ec18bb8
[  194.130780] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff9a5d0ec18bb0
[  194.130780] RBP: ffff9a5a337980c0 R08: 0000000000000000 R09: ffffb97d00777ba8
[  194.130781] R10: ffffb97d00777ba0 R11: ffffffff976ca568 R12: ffff9a5a191a1800
[  194.130782] R13: 0000000000000002 R14: 0000000000000200 R15: 0000000001000200
[  194.130783] FS:  0000000000000000(0000) GS:ffff9a5d0ec00000(0000) knlGS:0000000000000000
[  194.130783] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  194.130784] CR2: 00007fb1c6c7e7c8 CR3: 000000011c504000 CR4: 00000000003506f0
[  194.130784] Call Trace:
[  194.130788]  rt2x00usb_kick_rx_entry+0xa3/0x110 [rt2x00usb]
[  194.130791]  rt2x00lib_rxdone+0x36b/0x5c0 [rt2x00lib]
[  194.130793]  rt2x00usb_work_rxdone+0x6d/0xb0 [rt2x00usb]
[  194.130796]  process_one_work+0x1d6/0x3a0
[  194.130798]  worker_thread+0x4d/0x3d0
[  194.130799]  ? rescuer_thread+0x410/0x410
[  194.130800]  kthread+0x133/0x150
[  194.130802]  ? __kthread_bind_mask+0x60/0x60
[  194.130804]  ret_from_fork+0x22/0x30
[  194.130806] ---[ end trace 11276ca464fe8927 ]---
Comment 159 Michael 2021-01-20 17:18:27 UTC
@ Stanislaw, may I ask a question?
I purchased the  RT5572 adapter several days before. It never worked due to the xhci issue. Now (after your help), it is working and we (with lots of your help) encountered a new issue. Affected combination exclusively
RT5572 - USB3 - xhci - rt2800usb
Should I report this issue?
If yes, is it a xhci issue or a rt2800usb issue?

@ Bernhard, I didn't notice this messages in combination with monitor mode - but I noticed them when running managed in combination with NetworkManager.
Comment 160 Stanislaw Gruszka 2021-01-21 09:34:10 UTC
Created attachment 294799 [details]
rt2800usb_no_soft_retry_v2.patch

This one should make "BOGUS urb flags" messages gone. Please test.

Patch is for 4.11-rc , perhaps for 4.10 it requires some changes.
Comment 161 Stanislaw Gruszka 2021-01-21 09:39:23 UTC
(In reply to Michael from comment #159)
> @ Stanislaw, may I ask a question?
> I purchased the  RT5572 adapter several days before. It never worked due to
> the xhci issue. Now (after your help), it is working and we (with lots of
> your help) encountered a new issue. Affected combination exclusively
> RT5572 - USB3 - xhci - rt2800usb
> Should I report this issue?
> If yes, is it a xhci issue or a rt2800usb issue?

Taking this happen only on some particular hardware, it can be driver, firmware or even hardware issue (both on rt2800usb or usb host). If you can find if this worked on some older kernel version and bisect it, you could report the issue, otherwise (without bisection) I do not see any chance to fix this problem.
Comment 162 Michael 2021-01-21 11:02:44 UTC
@ Stanislaw, thanks for your reply.
At this moment, there are too many screws that are turned.
First I'll wait until the "WARN Set TR Deq Ptr cmd failed" received a final fix. Than I'll dive into the driver code to find out, what is going wrong there.
Comment 163 Bernhard 2021-01-21 13:23:37 UTC
The last patch fixes the issue for me and the BOGUS messages are now gone too. Thanks
Comment 164 Michael 2021-01-21 15:34:48 UTC
patch v2 causes monitor mode to crash (on ioctl() system calls:

[  602.100650] usb 1-2: BOGUS urb flags, 208 --> 200
[  602.100691] WARNING: CPU: 10 PID: 15060 at drivers/usb/core/urb.c:517 usb_submit_urb+0x1c9/0x5e0
[  602.100692] Modules linked in: mt7601u rt2800usb(OE) rt2x00usb(OE) rt2800lib(OE) rt2x00lib(OE) mac80211 libarc4 nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) cfg80211 snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi ledtrig_audio snd_hda_intel snd_intel_dspcfg rfkill soundwire_intel soundwire_generic_allocation soundwire_cadence 8021q snd_hda_codec garp mrp edac_mce_amd stp llc snd_hda_core snd_hwdep soundwire_bus r8169 snd_soc_core kvm realtek snd_compress nls_iso8859_1 ac97_bus snd_pcm_dmaengine vfat mdio_devres irqbypass mousedev crct10dif_pclmul fat ppdev snd_pcm crc32_pclmul ghash_clmulni_intel wmi_bmof mxm_wmi drm_kms_helper aesni_intel snd_timer cec ccp snd syscopyarea crypto_simd sysfillrect sp5100_tco cryptd usbhid sysimgblt glue_helper libphy soundcore fb_sys_fops pcspkr i2c_piix4 rng_core k10temp rapl parport_pc parport wmi pinctrl_amd gpio_amdpt gpio_generic mac_hid acpi_cpufreq drm sg fuse crypto_user agpgart bpf_preload ip_tables x_tables ext4 crc32c_generic
[  602.100876]  crc16 mbcache jbd2 crc32c_intel sr_mod xhci_pci cdrom xhci_pci_renesas
[  602.100879] CPU: 10 PID: 15060 Comm: hcxdumptool Tainted: P        W  OE     5.10.9-arch1-1 #1
[  602.100880] Hardware name: Micro-Star International Co., Ltd. MS-7A33/X370 KRAIT GAMING (MS-7A33), BIOS 1.F0 11/06/2018
[  602.100881] RIP: 0010:usb_submit_urb+0x1c9/0x5e0
[  602.100882] Code: bc 24 a0 00 00 00 48 89 54 24 08 e8 01 c1 f3 ff 48 8b 54 24 08 45 89 f0 44 89 f9 48 89 c6 48 c7 c7 f8 47 bf b9 e8 51 99 2c 00 <0f> 0b 83 e3 01 0f 85 f1 00 00 00 8b 74 24 04 48 83 c4 18 48 89 ef
[  602.100882] RSP: 0018:ffffb69648f5fb10 EFLAGS: 00010282
[  602.100883] RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff88a90ee98bb8
[  602.100884] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff88a90ee98bb0
[  602.100884] RBP: ffff88a60f3fb500 R08: 0000000000000000 R09: ffffb69648f5f948
[  602.100926] R10: ffffb69648f5f940 R11: ffffffffba2c0500 R12: ffff88a6152db800
[  602.100926] R13: 0000000000000002 R14: 0000000000000200 R15: 0000000000000208
[  602.100927] FS:  00007fef23ab0280(0000) GS:ffff88a90ee80000(0000) knlGS:0000000000000000
[  602.101008] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  602.101009] CR2: 00007fef2403eff8 CR3: 000000014b076000 CR4: 00000000003506e0
[  602.101050] Call Trace:
[  602.101132]  rt2x00usb_kick_rx_entry+0xa0/0x100 [rt2x00usb]
[  602.101175]  rt2x00queue_init_queues+0xb3/0x100 [rt2x00lib]
[  602.101257]  rt2x00lib_enable_radio+0x25/0xa0 [rt2x00lib]
[  602.101300]  rt2x00lib_start+0x7c/0xc0 [rt2x00lib]
[  602.101391]  drv_start+0x3d/0x100 [mac80211]
[  602.101444]  ieee80211_do_open+0x1c4/0x9c0 [mac80211]
[  602.101536]  ? ieee80211_check_concurrent_iface+0x14f/0x1c0 [mac80211]
[  602.101577]  __dev_open+0xfb/0x1b0
[  602.101658]  __dev_change_flags+0x1a6/0x210
[  602.101699]  ? enqueue_task_fair+0x8a/0x5d0
[  602.101780]  dev_change_flags+0x21/0x60
[  602.101821]  devinet_ioctl+0x641/0x810
[  602.101823]  ? preempt_schedule_thunk+0x16/0x18
[  602.101904]  inet_ioctl+0x1d7/0x210
[  602.102026]  sock_do_ioctl+0x82/0x180
[  602.102067]  sock_ioctl+0x272/0x3e0
[  602.102068]  __x64_sys_ioctl+0x83/0xb0
[  602.102150]  do_syscall_64+0x33/0x40
[  602.102191]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  602.102272] RIP: 0033:0x7fef23bcff6b
[  602.102273] Code: 89 d8 49 8d 3c 1c 48 f7 d8 49 39 c4 72 b5 e8 1c ff ff ff 85 c0 78 ba 4c 89 e0 5b 5d 41 5c c3 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d d5 ae 0c 00 f7 d8 64 89 01 48
[  602.102314] RSP: 002b:00007ffecf9e65a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  602.102315] RAX: ffffffffffffffda RBX: 000055f706b51d18 RCX: 00007fef23bcff6b
[  602.102396] RDX: 000055f706bce140 RSI: 0000000000008914 RDI: 0000000000000003
[  602.102396] RBP: 00007ffecf9e6620 R08: 0000000000000004 R09: 0032753066307333
[  602.102437] R10: 0000000000000020 R11: 0000000000000246 R12: 0000000000000004
[  602.102438] R13: 00007ffecf9e6718 R14: 0000000000000000 R15: 0000000000000000
[  602.102519] ---[ end trace 42333ce669cb71ea ]---
[  607.450006] device wlp3s0f0u2 left promiscuous mode
Comment 165 Stanislaw Gruszka 2021-01-22 07:48:41 UTC
(In reply to Michael from comment #164)
> patch v2 causes monitor mode to crash (on ioctl() system calls:
> 
> [  602.100650] usb 1-2: BOGUS urb flags, 208 --> 200
> [  602.100691] WARNING: CPU: 10 PID: 15060 at drivers/usb/core/urb.c:517
> usb_submit_urb+0x1c9/0x5e0
[snip]
> [  602.100879] CPU: 10 PID: 15060 Comm: hcxdumptool Tainted: P        W  OE 
> 5.10.9-arch1-1 #1

Those are same "BOGUS urb flags" messages like reported before by Bernhard. I think you did not correctly apply v2 patch on top of 5.10. Please double check if this hunk is present on your backported patch:

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 357b149b20d3..140bac59dc32 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -495,7 +495,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)

        /* Check against a simple/standard policy */
        allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |
-                       URB_FREE_BUFFER);
+                  URB_SOFT_RETRY_NOT_OK | URB_FREE_BUFFER);
        switch (xfertype) {
        case USB_ENDPOINT_XFER_BULK:
        case USB_ENDPOINT_XFER_INT:
Comment 166 Michael 2021-01-22 08:26:24 UTC
 The patch was applied to urb.c (5.10.9):
	/* Check against a simple/standard policy */
	allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |
		   URB_SOFT_RETRY_NOT_OK | URB_FREE_BUFFER);
	switch (xfertype) {
	case USB_ENDPOINT_XFER_BULK:
	case USB_ENDPOINT_XFER_INT:

At this moment, I don't know what exactly went wrong. I'll try to identify the issue.
Comment 167 Stanislaw Gruszka 2021-01-22 09:19:40 UTC
Maybe usb layer was compiled in the kernel and you only reload modules.
Comment 168 Michael 2021-01-22 09:26:36 UTC
Thanks. Now the modules are loaded correctly and the BOGUS messages disappeared.

Unfortunately monitor mode is not working with v2:
ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

before:
$ sudo hcxdumptool -i wlp3s0f0u2 --check_injection
initialization...
starting antenna test and packet injection test (that can take up to two minutes)...
available channels: 1,2,3,4,5,6,7,8,9,10,11,12,13,14
packet injection is working on 2.4GHz!
injection ratio: 54% (BEACON: 123 PROBERESPONSE: 67)
your injection ratio is good
antenna ratio: 45% (NETWORK: 20 PROBERESPONSE: 9)
your antenna ratio is average, but there is still room for improvement

terminating...

after v2:
$ sudo hcxdumptool -i wlp3s0f0u2 --check_injection
initialization...
starting antenna test and packet injection test (that can take up to two minutes)...
available channels: 1,2,3,4,5,6,7,8,9,10,11,12,13,14
warning: no PROBERESPONSE received - packet injection is probably not working!
8 driver errors encountered during the test

terminating...
Comment 169 Stanislaw Gruszka 2021-01-22 09:44:03 UTC
Michael, at this point I really doubt about reliability of your testing.
Comment 170 Michael 2021-01-22 09:49:34 UTC
Stanislaw, and you're not the only one. I doubt it, too.
Maybe I patched my kernel to death and it is time for me to compile a fresh one.
But anyway, thanks for your effort an for your patience.
Comment 171 Michael 2021-01-22 10:00:11 UTC
Stanislaw, short notice for you. Now, I'm running the fresh kernel (the RYZEN is really fast compiling it). Patch v2 is applied.
Everything is working fine and all Bogus messages are gone.
Thanks again.
Comment 172 WGH 2021-01-29 17:09:47 UTC
(In reply to Mathias Nyman from comment #139)
> rewritten URB cancel, endpoint stop and set trb deq can be found in my tree
> in rewrite_halt_stop_handling branch
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git
> rewrite_halt_stop_handling  
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/
> ?h=rewrite_halt_stop_handling
> 
> Does that help?

I applied the patch to 5.10.11-gentoo, and it did help with my HackRF One (see comment #136 for details and hardware)! No ill effects so far.
Comment 173 Stanislaw Gruszka 2021-02-03 09:11:58 UTC
After discussion on my posted patch here:

https://lore.kernel.org/linux-usb/20210122104342.12451-1-stf_xl@wp.pl/t/#u

it was concluded that this should be rather be xhci quirk instead of rt2800usb driver flag.

If change from comment 147 help for you with the problem, please provide PCI-id of your xHCI controller. This can be done by command:

lspci -k -nn | grep -B2 xhci 

If you have more than one xHCI controller please assure you provide PCI-id's of one that actually has the problem ('lspci -t' command can be useful as well)
Comment 174 Stanislaw Gruszka 2021-02-03 09:13:37 UTC
(In reply to Stanislaw Gruszka from comment #173)
> If you have more than one xHCI controller please assure you provide PCI-id's
> of one that actually has the problem ('lspci -t' command can be useful as
> well)

I meant 'lsusb -t'
Comment 175 Michael 2021-02-03 09:54:18 UTC
USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] X370 Series Chipset USB 3.1 xHCI Controller [1022:43b9] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1142]
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci
Comment 176 Stanislaw Gruszka 2021-02-03 13:01:38 UTC
Created attachment 295055 [details]
0001-usb-xhci-do-not-perform-Soft-Retry-for-some-xHCI-hos.patch

This is next proposed fix. It suppose to disable Soft Retry for affected xHCI controllers. Currently only for xHCI device reported by Michael:
PCI_VENDOR_ID_AMD = 0x1022 , PCI_DEVICE_ID_AMD_PROMONTORYA_4 = 0x43b9

If you want to test and have different xHCI host you need to add your PCI-id's to 
drivers/usb/host/xhci-pci.c part of the patch.
Comment 177 Michael 2021-02-03 13:46:33 UTC
@Stanislaw, I followed the discussion you mentioned here:
https://bugzilla.kernel.org/show_bug.cgi?id=202541#c173

Other devices than rt2800usb devices are affected, too.
Tested this one before applying your patch:
ID 7392:7710 Edimax Technology Co., Ltd Edimax Wi-Fi
and running into the same xhci issue  on USB controller mentioned here:
https://bugzilla.kernel.org/show_bug.cgi?id=202541#c175

[10214.423508] usb 1-2: new high-speed USB device number 3 using xhci_hcd
[10214.602833] usb 1-2: New USB device found, idVendor=7392, idProduct=7710, bcdDevice= 0.00
[10214.602838] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10214.602841] usb 1-2: Product: Edimax Wi-Fi
[10214.602843] usb 1-2: Manufacturer: MediaTek
[10214.602845] usb 1-2: SerialNumber: 1.0
[10214.931553] usb 1-2: reset high-speed USB device number 3 using xhci_hcd
[10215.102895] mt7601u 1-2:1.0: ASIC revision: 76010001 MAC revision: 76010500
[10215.132670] mt7601u 1-2:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____
[10216.101346] mt7601u 1-2:1.0: EEPROM ver:0d fae:00
[10216.111983] mt7601u 1-2:1.0: EEPROM country region 01 (channels 1-13)
[10217.189574] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[10217.190361] usbcore: registered new interface driver mt7601u
[10217.199429] mt7601u 1-2:1.0 wlp3s0f0u2: renamed from wlan0
[10296.419053] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
[10296.419228] xhci_hcd 0000:03:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Comment 178 alpir 2021-02-03 13:55:24 UTC
The same problem (with ID 04a9:220d Canon, Inc. CanoScan N670U/N676U/LiDE 20):

Feb 03 09:48:54 [kernel] [34974.104606] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Feb 03 09:49:49 [kernel] [35029.419748] usb 1-6: USB disconnect, device number 3
Feb 03 09:49:52 [kernel] [35031.994403] usb 1-6: new full-speed USB device number 6 using xhci_hcd
Feb 03 09:50:45 [kernel] [35085.400634] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.
Feb 03 09:50:45 [kernel] [35085.404278] xhci_hcd 0000:01:00.0: WARN Successful completion on short TX
Feb 03 09:50:45 [kernel] [35085.404398] xhci_hcd 0000:01:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 4 comp_code 1
Feb 03 09:50:45 [kernel] [35085.404401] xhci_hcd 0000:01:00.0: Looking for event-dma 00000008146ff050 trb-start 00000008146ff060 trb-end 00000008146ff060 seg-start 00000008146ff000 seg-end 00000008146ffff0

$  lspci -k -nn | grep -B2 xhci
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 6 [1022:1466]
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 7 [1022:1467]
01:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset USB 3.1 XHCI Controller [1022:43d5] (rev 01)
	Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1 XHCI Controller [1b21:1142]
	Kernel driver in use: xhci_hcd
--
09:00.2 USB controller [0c03]: NVIDIA Corporation TU116 USB 3.1 Host Controller [10de:1aec] (rev a1)
	Subsystem: NVIDIA Corporation TU116 USB 3.1 Host Controller [10de:139d]
	Kernel driver in use: xhci_hcd
--
0a:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Zeppelin USB 3.0 Host controller [1022:145f]
	Subsystem: Advanced Micro Devices, Inc. [AMD] Zeppelin USB 3.0 Host controller [1022:7914]
	Kernel driver in use: xhci_hcd

$  uname -a
Linux Gentoo 5.4.92-gentoo #1 SMP PREEMPT Thu Jan 28 20:45:52 MSK 2021 x86_64 AMD Ryzen 5 2600 Six-Core Processor AuthenticAMD GNU/Linux
Comment 179 Stanislaw Gruszka 2021-02-03 14:24:44 UTC
(In reply to Michael from comment #177)
> Other devices than rt2800usb devices are affected, too.
> Tested this one before applying your patch:
> ID 7392:7710 Edimax Technology Co., Ltd Edimax Wi-Fi
> and running into the same xhci issue  on USB controller mentioned here:
> https://bugzilla.kernel.org/show_bug.cgi?id=202541#c175

Ok, so it makes sense to disable Soft Retry per xHCI.
Comment 180 Stanislaw Gruszka 2021-02-03 14:28:06 UTC
(In reply to alpir from comment #178)
> The same problem (with ID 04a9:220d Canon, Inc. CanoScan N670U/N676U/LiDE
> 20):
> 
> Feb 03 09:48:54 [kernel] [34974.104606] xhci_hcd 0000:01:00.0: WARN Set TR
> Deq Ptr cmd failed due to incorrect slot or ep state.

alpir, does the change from comment 147 help for you ?
Comment 181 Stanislaw Gruszka 2021-02-03 15:27:05 UTC
alpir, you have different device-id than Michael, but you both have the same subsytem device: ASMedia 1b21:1142. So perhaps patch should be based on subdevice id's. Let's wait for other users reports regarding xHCI controller, we will see then.
Comment 182 alpir 2021-02-03 15:43:01 UTC
I tried patch from comment 147. The error "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state" has gone. But behavior USDB3.1 still the same.

Why did I even start looking for the reason for the strange behavior of OSD ports: two my JetFlash Transcend 8GB flash drives connected to the USB3 port is sometimes not detected by the system as being mountable (fat32). When I run a disk check (8 Gb) with the command badblocks -nvs / dev / sdd, then after a while the check ends with the following error: Pass completed, 5662144 bad blocks found. (5662144/0/0 errors). And both flash drives.

But if you connect them to USB2, then there are no errors at all.

At the same time, when looking at the logs, I found errors: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Now, after patch, i get next in logs:

Feb 03 17:47:14 [kernel] [   52.603587] usb 2-3: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:47:14 [kernel] [   52.636130] usb-storage 2-3:1.0: USB Mass Storage device detected
Feb 03 17:47:14 [kernel] [   52.636242] scsi host11: usb-storage 2-3:1.0
Feb 03 17:47:14 [kernel] [   52.651996] usbcore: registered new interface driver uas
Feb 03 17:47:16 [kernel] [   54.013780] scsi 11:0:0:0: Direct-Access     JetFlash Transcend 8GB    1100 PQ: 0 ANSI: 6
Feb 03 17:47:16 [kernel] [   54.014688] sd 11:0:0:0: [sdd] 15425536 512-byte logical blocks: (7.90 GB/7.36 GiB)
Feb 03 17:47:16 [kernel] [   54.015150] sd 11:0:0:0: [sdd] Write Protect is off
Feb 03 17:47:16 [kernel] [   54.015156] sd 11:0:0:0: [sdd] Mode Sense: 43 00 00 00
Feb 03 17:47:16 [kernel] [   54.015625] sd 11:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Feb 03 17:47:16 [kernel] [   54.028165]  sdd: sdd1
Feb 03 17:47:16 [kernel] [   54.045687] sd 11:0:0:0: [sdd] Attached SCSI removable disk
Feb 03 17:48:04 [kernel] [  102.221862] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:51:52 [kernel] [  330.009696] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:55:55 [kernel] [  573.644576] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:01 [kernel] [  579.149875] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:01 [kernel] [  579.254204] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:06 [kernel] [  584.781836] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:07 [kernel] [  585.073435] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:12 [kernel] [  590.413816] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:12 [kernel] [  590.518146] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:18 [kernel] [  596.046034] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:18 [kernel] [  596.336445] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:23 [kernel] [  601.677932] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:23 [kernel] [  601.782091] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:29 [kernel] [  607.309722] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:29 [kernel] [  607.598490] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:35 [kernel] [  612.941883] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:35 [kernel] [  613.046062] usb 2-3: reset SuperSpeed Gen 1 USB device number 2 using xhci_hcd
Feb 03 17:56:40 [kernel] [  618.573664] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:40 [kernel] [  618.694297] usb 2-3: USB disconnect, device number 2
Feb 03 17:56:40 [kernel] [  618.702083] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 16 prio class 0
Feb 03 17:56:40 [kernel] [  618.702241] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702275] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702280] Buffer I/O error on dev sdd, logical block 512656, async page read
Feb 03 17:56:40 [kernel] [  618.702318] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702343] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702346] Buffer I/O error on dev sdd, logical block 512656, async page read
Feb 03 17:56:40 [kernel] [  618.702376] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702401] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702403] Buffer I/O error on dev sdd, logical block 512656, async page read
Feb 03 17:56:40 [kernel] [  618.702434] blk_update_request: I/O error, dev sdd, sector 4101248 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Feb 03 17:56:40 [kernel] [  618.702463] blk_update_request: I/O error, dev sdd, sector 4101256 op 0x0:(READ) flags 0x0 phys_seg 15 prio class 0
Feb 03 17:56:40 [kernel] [  618.702494] Buffer I/O error on dev sdd, logical block 512657, async page read
Feb 03 17:56:40 [kernel] [  618.702509] Buffer I/O error on dev sdd, logical block 512657, async page read
Feb 03 17:56:40 [kernel] [  618.702521] Buffer I/O error on dev sdd, logical block 512657, async page read
Feb 03 17:56:40 [kernel] [  618.702597] Buffer I/O error on dev sdd, logical block 512659, async page read
Feb 03 17:56:41 [kernel] [  618.892181] usb 2-3: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
Feb 03 17:56:45 [kernel] [  623.702972] buffer_io_error: 2070133 callbacks suppressed
Feb 03 17:56:45 [kernel] [  623.702975] Buffer I/O error on dev sdd, logical block 1030195, async page read
Feb 03 17:56:45 [kernel] [  623.702979] Buffer I/O error on dev sdd, logical block 1030196, async page read
Feb 03 17:56:45 [kernel] [  623.702983] Buffer I/O error on dev sdd, logical block 1030196, async page read
Feb 03 17:56:45 [kernel] [  623.702986] Buffer I/O error on dev sdd, logical block 1030196, async page read
Feb 03 17:56:45 [kernel] [  623.702988] Buffer I/O error on dev sdd, logical block 1030196, async page read
Feb 03 17:56:45 [kernel] [  623.702991] Buffer I/O error on dev sdd, logical block 1030197, async page read
Feb 03 17:56:45 [kernel] [  623.702993] Buffer I/O error on dev sdd, logical block 1030197, async page read
Feb 03 17:56:45 [kernel] [  623.702995] Buffer I/O error on dev sdd, logical block 1030197, async page read
Feb 03 17:56:45 [kernel] [  623.702997] Buffer I/O error on dev sdd, logical block 1030197, async page read
Feb 03 17:56:45 [kernel] [  623.703000] Buffer I/O error on dev sdd, logical block 1030198, async page read
Feb 03 17:56:46 [kernel] [  624.205633] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:46 [kernel] [  624.309977] usb 2-3: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
Feb 03 17:56:50 [kernel] [  628.703937] buffer_io_error: 2089117 callbacks suppressed
Feb 03 17:56:50 [kernel] [  628.703939] Buffer I/O error on dev sdd, logical block 1552477, async page read
Feb 03 17:56:50 [kernel] [  628.703942] Buffer I/O error on dev sdd, logical block 1552477, async page read
Feb 03 17:56:50 [kernel] [  628.703945] Buffer I/O error on dev sdd, logical block 1552478, async page read
Feb 03 17:56:50 [kernel] [  628.703948] Buffer I/O error on dev sdd, logical block 1552478, async page read
Feb 03 17:56:50 [kernel] [  628.703950] Buffer I/O error on dev sdd, logical block 1552478, async page read
Feb 03 17:56:50 [kernel] [  628.703953] Buffer I/O error on dev sdd, logical block 1552478, async page read
Feb 03 17:56:50 [kernel] [  628.703955] Buffer I/O error on dev sdd, logical block 1552479, async page read
Feb 03 17:56:50 [kernel] [  628.703958] Buffer I/O error on dev sdd, logical block 1552479, async page read
Feb 03 17:56:50 [kernel] [  628.703960] Buffer I/O error on dev sdd, logical block 1552479, async page read
Feb 03 17:56:50 [kernel] [  628.703963] Buffer I/O error on dev sdd, logical block 1552479, async page read
Feb 03 17:56:51 [kernel] [  629.838589] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:52 [kernel] [  630.129112] usb 2-3: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Feb 03 17:56:57 [kernel] [  635.469561] usb 2-3: device descriptor read/8, error -110
Feb 03 17:56:57 [kernel] [  635.573925] usb 2-3: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
Feb 03 17:57:03 [kernel] [  641.101804] usb 2-3: device descriptor read/8, error -110
Feb 03 17:57:03 [kernel] [  641.214076] usb usb2-port3: attempt power cycle
Feb 03 17:57:04 [kernel] [  642.323012] usb 2-3: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd
Feb 03 17:57:09 [kernel] [  647.757472] usb 2-3: device descriptor read/8, error -110
Feb 03 17:57:09 [kernel] [  647.861845] usb 2-3: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd
Feb 03 17:57:15 [kernel] [  653.390427] usb 2-3: device descriptor read/8, error -110
Feb 03 17:57:15 [kernel] [  653.680943] usb 2-3: new SuperSpeed Gen 1 USB device number 6 using xhci_hcd
Feb 03 17:57:21 [kernel] [  659.022390] usb 2-3: device descriptor read/8, error -110
Feb 03 17:57:21 [kernel] [  659.125736] usb 2-3: new SuperSpeed Gen 1 USB device number 6 using xhci_hcd
Feb 03 17:57:26 [kernel] [  664.653379] usb 2-3: device descriptor read/8, error -110
Feb 03 17:57:26 [kernel] [  664.765744] usb usb2-port3: unable to enumerate USB device
Comment 183 Bernhard 2021-02-03 16:13:06 UTC
My controller has the PCI ID 43bb, so I've added "PCI_DEVICE_ID_AMD_PROMONTORYA_2" to the patch from #176, and that fixed the issue for me.
Comment 184 Michael 2021-02-03 16:37:52 UTC
@Stanislaw, I'm running an older mobo and a RYZEN 1700.
I don't need CPU power - GPU power is more important for me (crypto analysis).
Comment 185 biopsin 2021-02-04 08:01:25 UTC
[Continuing my first report in comment:https://bugzilla.kernel.org/show_bug.cgi?id=202541#c107]

$ lspci -k -nn | grep -B2 xhci
02:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset USB 3.1 XHCI Controller [1022:43d5] (rev 01)
        Subsystem: ASMedia Technology Inc. Device [1b21:1142]
        Kernel driver in use: xhci_hcd

I have adapted the patch by Mr. Gruszka [https://bugzilla.kernel.org/show_bug.cgi?id=202541#c176] for my current system and needs

$ uname -a
Linux voidx 5.4.95_1 #1 SMP PREEMPT 1612063540 x86_64 GNU/Linux

If someone has some spare time to glance at it or comment on my error ;)
(diff availible for 30 days) @
https://p.teknik.io/lIBbA
Comment 186 Stanislaw Gruszka 2021-02-04 09:41:33 UTC
(In reply to alpir from comment #182)
> I tried patch from comment 147. The error "WARN Set TR Deq Ptr cmd failed
> due to incorrect slot or ep state" has gone. But behavior USDB3.1 still the
> same.
[snip]
> But if you connect them to USB2, then there are no errors at all.

alpir, I think you experiencing different issue that can not be solved by simply disabling Soft Retry. Some more fixes are possibly needed for handing your xHCI/usb hardware. Maybe you can try patch from comment 139? If this is regression, maybe you can bisect to find offending commit? Anyway your problems, most likely will require expertise of Mathias Nyman - xhci driver maintainer.
Comment 187 Stanislaw Gruszka 2021-02-04 09:50:48 UTC
(In reply to biopsin from comment #185)
> [Continuing my first report in
> comment:https://bugzilla.kernel.org/show_bug.cgi?id=202541#c107]

Similarly like for as for alpir case this most likely will require some different fixes, but you can try if disabling Soft Retry works. You can just disable like showed in comment 147

 > $ lspci -k -nn | grep -B2 xhci
> 02:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] 400 Series
> Chipset USB 3.1 XHCI Controller [1022:43d5] (rev 01)
>         Subsystem: ASMedia Technology Inc. Device [1b21:1142]
>         Kernel driver in use: xhci_hcd
> 
[snip]
> If someone has some spare time to glance at it or comment on my error ;)
> (diff availible for 30 days) @
> https://p.teknik.io/lIBbA

ASMedia is subsystem_{vendor,device) so most likely quirk flag is not set properly for you. You can print values by patch like this to see:

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 906a0e08821e..0ec9c3637b7a 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -102,6 +102,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 
        id = pci_match_id(pdev->driver->id_table, pdev);
 
+       printk("vendor: 0x%04x device 0x%04x subvendor 0x%04x subdevice 0x%04x\n",
+              pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device);
+
        if (id && id->driver_data) {
                driver_data = (struct xhci_driver_data *)id->driver_data;
                xhci->quirks |= driver_data->quirks;

If indeed those are subsystem ID's I think there is bug in existing xhci-pci.c quirks code: 

        if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
                pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
                xhci->quirks |= XHCI_BROKEN_STREAMS;
        if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
                pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
                xhci->quirks |= XHCI_TRUST_TX_LENGTH;
        if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
            (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI ||
             pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI))
                xhci->quirks |= XHCI_NO_64BIT_SUPPORT

and those check should be replaced by pdev->subsystem_vendor and pdev->subsystem_device.
Comment 188 Stanislaw Gruszka 2021-02-04 10:09:54 UTC
Created attachment 295065 [details]
asmedia_subsytem_quirks.patch

This patch apply existing xhci ASMedia quirks also for ASMedia subdevices .

Looking into changelog history those quirks helped with some usb disk issues, so perhaps patch could help with disk issues reported here i.e. alpir and biopsin cases. Please test.
Comment 189 alpir 2021-02-04 10:28:23 UTC
None of the patches (comments 139, 147, 188) did not solve my problem.
Comment 190 biopsin 2021-02-05 08:44:34 UTC
@Gruszka 
Your patch [https://bugzilla.kernel.org/show_bug.cgi?id=202541#c188] makes very mutch sense, thank you.
I'm currently testing it with my setup and kernel 5.4.95_x86_64.
Tested against one PATA and one SATA drives, so far I see no ill effects, but I also can't confirm or deny it does anything with this short timespan, and much have change since my initial post last year. I will at least continuing applying it now and then out this year and report any newsworthy. Thank you for your time and help!
Comment 191 raul 2021-02-09 13:43:44 UTC
Created attachment 295151 [details]
Dmesg of a Toshiba USB 3.0 HDD connected to USB 3.0 front port and back port.

I am having this error on Linux 5.10.10-051010 while trying to connect a USB 3.0 hard disk, Toshiba Touro 4TB (HitachiGST). If I connect the disk to a USB 2.0 port it works flawlessly.

The kernel shows a different kind of error depending on whether I connect the HDD to the front or back USB 3.0 ports of the motherboard MSI X470 Gaming Plus MAX.

lspci -vnnt:
> -[0000:00]-+-00.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
> 00h-0fh) Root Complex [1022:1450]
>            +-00.2  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) I/O Memory Management Unit [1022:1451]
>            +-01.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-01.1-[01]----00.0  Samsung Electronics Co Ltd NVMe SSD
>            Controller SM981/PM981/PM983 [144d:a808]
>            +-01.3-[03-26]--+-00.0  Advanced Micro Devices, Inc. [AMD] Device
>            [1022:43d0]
>            |               +-00.1  Advanced Micro Devices, Inc. [AMD] 400
>            Series Chipset SATA Controller [1022:43c8]
>            |               \-00.2-[20-26]--+-00.0-[21]--
>            |                               +-01.0-[22]----00.0  Realtek
>            Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit
>            Ethernet Controller [10ec:8168]
>            |                               +-02.0-[23]--
>            |                               +-03.0-[24]--
>            |                               +-04.0-[25]--
>            |                               \-08.0-[26]----00.0  ASMedia
>            Technology Inc. ASM1142 USB 3.1 Host Controller [1b21:1242]
>            +-02.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-03.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-03.1-[27]--+-00.0  Advanced Micro Devices, Inc. [AMD/ATI]
>            Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df]
>            |            \-00.1  Advanced Micro Devices, Inc. [AMD/ATI]
>            Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0]
>            +-04.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-07.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-07.1-[28]--+-00.0  Advanced Micro Devices, Inc. [AMD]
>            Zeppelin/Raven/Raven2 PCIe Dummy Function [1022:145a]
>            |            +-00.2  Advanced Micro Devices, Inc. [AMD] Family 17h
>            (Models 00h-0fh) Platform Security Processor [1022:1456]
>            |            \-00.3  Advanced Micro Devices, Inc. [AMD] Zeppelin
>            USB 3.0 Host controller [1022:145f]
>            +-08.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-1fh) PCIe Dummy Host Bridge [1022:1452]
>            +-08.1-[29]--+-00.0  Advanced Micro Devices, Inc. [AMD]
>            Zeppelin/Renoir PCIe Dummy Function [1022:1455]
>            |            +-00.2  Advanced Micro Devices, Inc. [AMD] FCH SATA
>            Controller [AHCI mode] [1022:7901]
>            |            \-00.3  Advanced Micro Devices, Inc. [AMD] Family 17h
>            (Models 00h-0fh) HD Audio Controller [1022:1457]
>            +-14.0  Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller
>            [1022:790b]
>            +-14.3  Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge
>            [1022:790e]
>            +-18.0  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 0 [1022:1460]
>            +-18.1  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 1 [1022:1461]
>            +-18.2  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 2 [1022:1462]
>            +-18.3  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 3 [1022:1463]
>            +-18.4  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 4 [1022:1464]
>            +-18.5  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 5 [1022:1465]
>            +-18.6  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 6 [1022:1466]
>            \-18.7  Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>            00h-0fh) Data Fabric: Device 18h; Function 7 [1022:1467]

lsusb -vt:
> /:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
>     ID 1d6b:0003 Linux Foundation 3.0 root hub
>     |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
>         ID 4971:1015 SimpleTech 
> /:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
>     ID 1d6b:0002 Linux Foundation 2.0 root hub
> /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
>     ID 1d6b:0003 Linux Foundation 3.0 root hub
> /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
>     ID 1d6b:0002 Linux Foundation 2.0 root hub
> /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 10000M
>     ID 1d6b:0003 Linux Foundation 3.0 root hub
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
>     ID 1d6b:0002 Linux Foundation 2.0 root hub
>     |__ Port 4: Dev 2, If 0, Class=Vendor Specific Class,
>     Driver=dvb_usb_af9035, 480M
>         ID 07ca:1835 AVerMedia Technologies, Inc. 
>     |__ Port 12: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid,
>     1.5M
>         ID 04d9:1818 Holtek Semiconductor, Inc. Keyboard [Diatec Filco
>         Majestouch 2]
>     |__ Port 12: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid,
>     1.5M
>         ID 04d9:1818 Holtek Semiconductor, Inc. Keyboard [Diatec Filco
>         Majestouch 2]
>     |__ Port 13: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid,
>     12M
>         ID 046d:c066 Logitech, Inc. G9x Laser Mouse
>     |__ Port 13: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid,
>     12M
>         ID 046d:c066 Logitech, Inc. G9x Laser Mouse
Comment 192 raul 2021-02-10 13:48:50 UTC
Created attachment 295183 [details]
Dmesg of a OnePlus 7 Pro connecting in USB 3.1 gen1 mode. No errors.

(In reply to raul from comment #191)
Connecting a Oneplus 7 Pro smartphone does show any error. This phone has a USB 3.1 gen1 port and connects in that mode without errors. I can navigate the filesystem as one would expect.
Comment 193 Zak 2021-03-27 12:15:20 UTC
Same issue with a Seagate Portable 4 TB USB 3.0 drive that I connect with usb-storage quirks as its UAS implementation is problematic. Random hangs that flood dmesg with errors.

lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        ID 0bc2:231a Seagate RSS LLC Expansion Portable

Errors in dmesg start like this...

xhci_hcd 0000:00:10.0: WARN Cannot submit Set TR Deq Ptr
xhci_hcd 0000:00:10.0: A Set TR Deq Ptr command is pending.
usb 3-3: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd
sd 5:0:0:0: [sdd] tag#0 FAILED Result: hostbyte=DID_TIME_OUT driverbyte=DRIVER_OK cmd_age=31s
sd 5:0:0:0: [sdd] tag#0 CDB: Read(16) 88 00 00 00 00 00 a4 01 ed 78 00 00 00 10 00 00

After that:

task:usb-storage     state:D stack:    0 pid:  286 ppid:     2 flags:0x00004000
Call Trace:
  __schedule+0x282/0x870
  ? usleep_range+0x80/0x80
  schedule+0x46/0xb0
  schedule_timeout+0xff/0x140
  ? __prepare_to_swait+0x4b/0x70
  __wait_for_common+0xae/0x160
  usb_sg_wait+0xe0/0x1a0 [usbcore]
  usb_stor_bulk_transfer_sglist.part.0+0x64/0xb0 [usb_storage]
  usb_stor_Bulk_transport+0x188/0x410 [usb_storage]
  usb_stor_invoke_transport+0x3a/0x520 [usb_storage]
  ? __prepare_to_swait+0x4b/0x70
  ? __wait_for_common+0xed/0x160
  usb_stor_control_thread+0x185/0x280 [usb_storage]
  ? storage_probe+0x2a0/0x2a0 [usb_storage]
  kthread+0x11b/0x140
  ? __kthread_bind_mask+0x60/0x60
  ret_from_fork+0x22/0x30
Comment 194 Mathias Nyman 2021-03-30 08:58:39 UTC
(In reply to Zak from comment #193)
> 
> 
> Errors in dmesg start like this...
> 
> xhci_hcd 0000:00:10.0: WARN Cannot submit Set TR Deq Ptr
> xhci_hcd 0000:00:10.0: A Set TR Deq Ptr command is pending.

There are recent major changes in this area in the xhci driver.
The above message no longer exists, new message in this case is
"Set TR Deq already pending, don't submit for x" 

Can you try this on a 5.12-rc kernel?

Thanks
Mathias
Comment 195 mikec 2021-04-06 20:36:40 UTC
Created attachment 296259 [details]
xhci no soft retry for Intel xhci 8086:06ed and 8086:31a8

Hi

I am having this issue on 2 systems when I plug in 
a Hoco Hub HB16. The Hoco Hub HB16 is a 6 in 1 adapter that
includes 
Type-C to USB3.0 x3
Type-C to HDMI
Type-C to RJ45 Ethernet (RealTek RTL8153, linux loads driver rtl8153b-2)
Type-C to Type-C(PD2.0)
USB Billboard device

Also when the device is plugged into a Windows10 machine
for the first time it presents a disk that contains the RTL8153
drivers, the user is provided with an option to install these. This
"disk" is not visible later.

The 2 systems where this device failed both reported
"WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state."
Both systems have Ubuntu Mate 20.10

$ uname -a
5.8.0-48-generic #54-Ubuntu SMP Fri Mar 19 14:25:20 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux


1. Dell XPS 9500 (Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz)
$ sudo lspci -k -nn | grep -B2 xhci
    00:14.0 USB controller [0c03]: Intel Corporation Comet Lake USB 3.1 xHCI Host Controller [8086:06ed]
	Subsystem: Dell Comet Lake USB 3.1 xHCI Host Controller [1028:097d]
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci
--
    7:00.0 USB controller [0c03]: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] [8086:15ec] (rev 06)
	Subsystem: Dell JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] [1028:097d]
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci



2. Seed Studio Odyssey J4105 (Intel(R) Celeron(R) J4105 CPU @ 1.50GHz)
$ sudo lspci -k -nn | grep -B3 xhci 
    00:15.0 USB controller [0c03]: Intel Corporation Device [8086:31a8] (rev 03)
	DeviceName: Onboard - Other
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci

I applied the changes in Stanislaw's patch at comment 176, I added the
PCI IDs to match both my systems.

I can confirm that with the patch applied both systems no longer reported  the 
issue ""WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state."

Just to note that on the Dell XPS I use the Dell DA20 Adapter which is a Type-C
to USB and HDMI adapter. This appears to have an ASIX Elec. Corp. AX88179 
USB 3.0 to Gigabit Ethernet which I don't have any issues with.
Comment 196 Luke-Jr 2021-05-29 18:08:35 UTC
Encountered this with a PCI-e card using ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller

Moved to my native "Intel Corporation Device a3af" USB bus, this error disappeared (though other problems remain in my case)

Linux 5.10.33

Of potential noteworthiness: When I got my Talos II, I tried to move this ASMedia USB PCI-e card to it, and found it was immediately shutdown by the IOMMU whenever I would try to use it at all. It seems the firmware is garbage.

IIRC, someone was getting close to an open source firmware replacement without those issues... would be interesting to see if it helps with this bug as well.
Comment 197 Ivan 2021-06-24 09:37:58 UTC
same problem
5.12.12-arch1-1 #1 SMP PREEMPT Fri, 18 Jun 2021 21:59:22 +0000 x86_64 GNU/Linux

GPD Pocket

00:00.0 Host bridge [0600]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series SoC Transaction Register [8086:2280] (rev 34)
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel driver in use: iosf_mbi_pci
00:02.0 VGA compatible controller [0300]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller [8086:22b0] (rev 34)
	DeviceName:  Onboard IGD
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel driver in use: i915
	Kernel modules: i915
00:0b.0 Signal processing controller [1180]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series Power Management Controller [8086:22dc] (rev 34)
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel driver in use: proc_thermal
	Kernel modules: processor_thermal_device
00:14.0 USB controller [0c03]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series USB xHCI Controller [8086:22b5] (rev 34)
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci
00:1a.0 Encryption controller [1080]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series Trusted Execution Engine [8086:2298] (rev 34)
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel modules: mei_txe
00:1c.0 PCI bridge [0604]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Express Port #1 [8086:22c8] (rev 34)
	Kernel driver in use: pcieport
00:1f.0 ISA bridge [0601]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCU [8086:229c] (rev 34)
	Subsystem: Intel Corporation Device [8086:7270]
	Kernel modules: lpc_ich
01:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM4356 802.11ac Wireless Network Adapter [14e4:43ec] (rev 02)
	Subsystem: Gemtek Technology Co., Ltd Device [17f9:0036]
	Kernel driver in use: brcmfmac
	Kernel modules: brcmfmac


# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.
Table at 0x5B8DE000.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: American Megatrends Inc.
	Version: 5.11
	Release Date: 06/28/2017
	Address: 0xF0000
	Runtime Size: 64 kB
	ROM Size: 4 MB
	Characteristics:
		PCI is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		Boot from CD is supported
		Selectable boot is supported
		BIOS ROM is socketed
		EDD is supported
		5.25"/1.2 MB floppy services are supported (int 13h)
		3.5"/720 kB floppy services are supported (int 13h)
		3.5"/2.88 MB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		ACPI is supported
		USB legacy is supported
		BIOS boot specification is supported
		Targeted content distribution is supported
		UEFI is supported
	BIOS Revision: 5.11

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: Default string
	Product Name: Default string
	Version: Default string
	Serial Number: Default string
	UUID: 03000200-0400-0500-0006-000700080009
	Wake-up Type: Power Switch
	SKU Number: Default string
	Family: Default string

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
	Manufacturer: AMI Corporation
	Product Name: Default string
	Version: Default string
	Serial Number: Default string
	Asset Tag: Default string
	Features:
		Board is a hosting board
		Board is replaceable
	Location In Chassis: Default string
	Chassis Handle: 0x0003
	Type: Motherboard
	Contained Object Handles: 0

Handle 0x0003, DMI type 3, 22 bytes
Chassis Information
	Manufacturer: Default string
	Type: Desktop
	Lock: Not Present
	Version: Default string
	Serial Number: Default string
	Asset Tag: Default string
	Boot-up State: Safe
	Power Supply State: Safe
	Thermal State: Safe
	Security Status: None
	OEM Information: 0x00000000
	Height: Unspecified
	Number Of Power Cords: 1
	Contained Elements: 0
	SKU Number: Default string

Handle 0x0008, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J1A1
	Internal Connector Type: None
	External Reference Designator: PS2Mouse
	External Connector Type: PS/2
	Port Type: Mouse Port

Handle 0x0009, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J1A1
	Internal Connector Type: None
	External Reference Designator: Keyboard
	External Connector Type: PS/2
	Port Type: Keyboard Port

Handle 0x000A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2A1
	Internal Connector Type: None
	External Reference Designator: TV Out
	External Connector Type: Mini Centronics Type-14
	Port Type: Other

Handle 0x000B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2A2A
	Internal Connector Type: None
	External Reference Designator: COM A
	External Connector Type: DB-9 male
	Port Type: Serial Port 16550A Compatible

Handle 0x000C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2A2B
	Internal Connector Type: None
	External Reference Designator: Video
	External Connector Type: DB-15 female
	Port Type: Video Port

Handle 0x000D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J3A1
	Internal Connector Type: None
	External Reference Designator: USB1
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x000E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J3A1
	Internal Connector Type: None
	External Reference Designator: USB2
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J3A1
	Internal Connector Type: None
	External Reference Designator: USB3
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0010, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9A1 - TPM HDR
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0011, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9C1 - PCIE DOCKING CONN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0012, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2B3 - CPU FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0013, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J6C2 - EXT HDMI
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0014, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J3C1 - GMCH FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0015, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J1D1 - ITP
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0016, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9E2 - MDC INTPSR
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0017, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9E4 - MDC INTPSR
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0018, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9E3 - LPC HOT DOCKING
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0019, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9E1 - SCAN MATRIX
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J9G1 - LPC SIDE BAND
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J8F1 - UNIFIED
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J6F1 - LVDS
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2F1 - LAI FAN
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J2G1 - GFX VID
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x001F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: J1G6 - AC JACK
	Internal Connector Type: Other
	External Reference Designator: Not Specified
	External Connector Type: None
	Port Type: Other

Handle 0x0020, DMI type 9, 17 bytes
System Slot Information
	Designation: J6B2
	Type: x16 PCI Express
	Current Usage: In Use
	Length: Long
	ID: 0
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:00:01.0

Handle 0x0021, DMI type 9, 17 bytes
System Slot Information
	Designation: J6B1
	Type: x1 PCI Express
	Current Usage: In Use
	Length: Short
	ID: 1
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:00:1c.3

Handle 0x0022, DMI type 9, 17 bytes
System Slot Information
	Designation: J6D1
	Type: x1 PCI Express
	Current Usage: In Use
	Length: Short
	ID: 2
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:00:1c.4

Handle 0x0023, DMI type 9, 17 bytes
System Slot Information
	Designation: J7B1
	Type: x1 PCI Express
	Current Usage: In Use
	Length: Short
	ID: 3
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:00:1c.5

Handle 0x0024, DMI type 9, 17 bytes
System Slot Information
	Designation: J8B4
	Type: x1 PCI Express
	Current Usage: In Use
	Length: Short
	ID: 4
	Characteristics:
		3.3 V is provided
		Opening is shared
		PME signal is supported
	Bus Address: 0000:00:1c.6

Handle 0x0025, DMI type 10, 6 bytes
On Board Device Information
	Type: Video
	Status: Enabled
	Description:    To Be Filled By O.E.M.

Handle 0x0026, DMI type 11, 5 bytes
OEM Strings
	String 1: Default string

Handle 0x0027, DMI type 12, 5 bytes
System Configuration Options
	Option 1: Default string

Handle 0x0028, DMI type 16, 23 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: Multi-bit ECC
	Maximum Capacity: 8 GB
	Error Information Handle: Not Provided
	Number Of Devices: 2

Handle 0x0029, DMI type 19, 31 bytes
Memory Array Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x001FFFFFFFF
	Range Size: 8 GB
	Physical Array Handle: 0x0028
	Partition Width: 2

Handle 0x002A, DMI type 17, 40 bytes
Memory Device
	Array Handle: 0x0028
	Error Information Handle: Not Provided
	Total Width: 8 bits
	Data Width: 64 bits
	Size: 4 GB
	Form Factor: DIMM
	Set: None
	Locator: A1_DIMM0
	Bank Locator: A1_BANK0
	Type: DDR3
	Type Detail: Unknown
	Speed: 1600 MT/s
	Manufacturer: Hynix Semiconductor
	Serial Number: 00000000
	Asset Tag: 00000000
	Part Number: 00000000
	Rank: Unknown
	Configured Memory Speed: 1600 MT/s
	Minimum Voltage: 1.5 V
	Maximum Voltage: 1.5 V
	Configured Voltage: 1.5 V

Handle 0x002B, DMI type 20, 35 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x000FFFFFFFF
	Range Size: 4 GB
	Physical Device Handle: 0x002A
	Memory Array Mapped Address Handle: 0x0029
	Partition Row Position: Unknown
	Interleave Position: 1
	Interleaved Data Depth: 2

Handle 0x002C, DMI type 17, 40 bytes
Memory Device
	Array Handle: 0x0028
	Error Information Handle: Not Provided
	Total Width: 8 bits
	Data Width: 64 bits
	Size: 4 GB
	Form Factor: DIMM
	Set: None
	Locator: A1_DIMM1
	Bank Locator: A1_BANK1
	Type: DDR3
	Type Detail: Unknown
	Speed: 1600 MT/s
	Manufacturer: Hynix Semiconductor
	Serial Number: 00000000
	Asset Tag: 00000000
	Part Number: 00000000
	Rank: Unknown
	Configured Memory Speed: 1600 MT/s
	Minimum Voltage: 1.5 V
	Maximum Voltage: 1.5 V
	Configured Voltage: 1.5 V

Handle 0x002D, DMI type 20, 35 bytes
Memory Device Mapped Address
	Starting Address: 0x00100000000
	Ending Address: 0x001FFFFFFFF
	Range Size: 4 GB
	Physical Device Handle: 0x002C
	Memory Array Mapped Address Handle: 0x0029
	Partition Row Position: Unknown
	Interleave Position: 2
	Interleaved Data Depth: 2

Handle 0x002E, DMI type 32, 20 bytes
System Boot Information
	Status: No errors detected

Handle 0x002F, DMI type 41, 11 bytes
Onboard Device
	Reference Designation:  Onboard IGD
	Type: Video
	Status: Enabled
	Type Instance: 1
	Bus Address: 0000:00:02.0

Handle 0x0030, DMI type 41, 11 bytes
Onboard Device
	Reference Designation:  Onboard LAN
	Type: Ethernet
	Status: Enabled
	Type Instance: 1
	Bus Address: 0000:00:19.0

Handle 0x0031, DMI type 41, 11 bytes
Onboard Device
	Reference Designation:  Onboard 1394
	Type: Other
	Status: Enabled
	Type Instance: 1
	Bus Address: 0000:03:1c.2

Handle 0x0032, DMI type 7, 19 bytes
Cache Information
	Socket Designation: CPU Internal L1
	Configuration: Enabled, Not Socketed, Level 1
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 224 kB
	Maximum Size: 224 kB
	Supported SRAM Types:
		Unknown
	Installed SRAM Type: Unknown
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Other
	Associativity: Other

Handle 0x0033, DMI type 7, 19 bytes
Cache Information
	Socket Designation: CPU Internal L2
	Configuration: Enabled, Not Socketed, Level 2
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 2 MB
	Maximum Size: 2 MB
	Supported SRAM Types:
		Unknown
	Installed SRAM Type: Unknown
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Unified
	Associativity: 16-way Set-associative

Handle 0x0034, DMI type 4, 48 bytes
Processor Information
	Socket Designation: SOCKET 0
	Type: Central Processor
	Family: Atom
	Manufacturer: Intel
	ID: C4 06 04 00 FF FB EB BF
	Signature: Type 0, Family 6, Model 76, Stepping 4
	Flags:
		FPU (Floating-point unit on-chip)
		VME (Virtual mode extension)
		DE (Debugging extension)
		PSE (Page size extension)
		TSC (Time stamp counter)
		MSR (Model specific registers)
		PAE (Physical address extension)
		MCE (Machine check exception)
		CX8 (CMPXCHG8 instruction supported)
		APIC (On-chip APIC hardware supported)
		SEP (Fast system call)
		MTRR (Memory type range registers)
		PGE (Page global enable)
		MCA (Machine check architecture)
		CMOV (Conditional move instruction supported)
		PAT (Page attribute table)
		PSE-36 (36-bit page size extension)
		CLFSH (CLFLUSH instruction supported)
		DS (Debug store)
		ACPI (ACPI supported)
		MMX (MMX technology supported)
		FXSR (FXSAVE and FXSTOR instructions supported)
		SSE (Streaming SIMD extensions)
		SSE2 (Streaming SIMD extensions 2)
		SS (Self-snoop)
		HTT (Multi-threading)
		TM (Thermal monitor supported)
		PBE (Pending break enabled)
	Version: Intel(R) Atom(TM) x7-Z8750 CPU @ 1.60GHz
	Voltage: 1.2 V
	External Clock: 80 MHz
	Max Speed: 2400 MHz
	Current Speed: 1600 MHz
	Status: Populated, Enabled
	Upgrade: Socket BGA1155
	L1 Cache Handle: 0x0032
	L2 Cache Handle: 0x0033
	L3 Cache Handle: Not Provided
	Serial Number: Not Specified
	Asset Tag: Fill By OEM
	Part Number: Fill By OEM
	Core Count: 4
	Core Enabled: 4
	Thread Count: 4
	Characteristics:
		64-bit capable

Handle 0x0035, DMI type 13, 22 bytes
BIOS Language Information
	Language Description Format: Long
	Installable Languages: 1
		en|US|iso8859-1
	Currently Installed Language: en|US|iso8859-1

Handle 0x0036, DMI type 127, 4 bytes
End Of Table
Comment 198 Antonio 2021-08-24 18:04:51 UTC
I have same problem with kernels 5.13.12 and 5.14.0-rc7:

dmesg:
xhci_hcd 0000:00:14.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

journalctl:
ago 24 18:38:40 SERVER kernel: sd 4:0:0:0: [sda] tag#3 FAILED Result: hostbyte=DID_TIME_OUT driverbyte=DRIVER_OK cmd_age=30s
Comment 199 ST 2021-09-15 22:43:14 UTC
I also experience exactly same issue on multiple USB devices ( USB-WIFI or a USB-Webcam ) only on my brand new AMD Mainboard ( ASRock model: B550M-HDV)

I tried both ubuntu focal and hirsute with latest kernels on my OldPC (ASUSTeK model: M5A78L-M LX3) and on my IntelNUC (NUC8BEB) and this issue does not happen (Tried with same USB-WIFI and USB-Webcam devices).

Issue is easily reproducible by inserting USB-WIFI and then executing "ip a" on a shell.
Comment 200 Dmitry Nezhevenko 2021-09-18 18:39:58 UTC
I also have exactly same problem, but with a bit different HW.

Now it's USB DAC branded as "Qudelix-5K". As far as I understand it's USB1 device.

[  174.358189] usb 5-2.3.2.2.1.1: new full-speed USB device number 17 using xhci_hcd
[  174.475229] usb 5-2.3.2.2.1.1: New USB device found, idVendor=0a12, idProduct=4025, bcdDevice=19.70
[  174.475232] usb 5-2.3.2.2.1.1: New USB device strings: Mfr=1, Product=8, SerialNumber=3
[  174.475233] usb 5-2.3.2.2.1.1: Product: Qudelix-5K USB DAC/MIC 48KHz
[  174.475234] usb 5-2.3.2.2.1.1: Manufacturer: QTIL
[  174.475235] usb 5-2.3.2.2.1.1: SerialNumber: ABCDEF0123456789

It produces corrupted sound (actually some noise) just after a few seconds of playback if connected to Dell WD19TB thunderbolt dock station. Issue happens with USB-A ports on dock plus one Type-C port (front). Second Type-C port (named as "Type-C with Thunderbolt 3 port" works.

When such noise happens I'm getting followed in dmesg:

xhci_hcd 0000:3a:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 5 comp_code 1
xhci_hcd 0000:3a:00.0: Looking for event-dma 00000000ffe940f0 trb-start 00000000ffe94100 trb-end 00000000ffe94100 seg-start 00000000ffe94000 seg-end 00000000ffe94ff0
xhci_hcd 0000:3a:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 5 comp_code 1
xhci_hcd 0000:3a:00.0: Looking for event-dma 00000000ffe949b0 trb-start 00000000ffe949c0 trb-end 00000000ffe949c0 seg-start 00000000ffe94000 seg-end 00000000ffe94ff0

I've tried to add/remove extra USB hubs (originally Qudelix was plugged to internal USB3 hub of monitor). But even if plugged directly to dock, it produces corrupted sound.

Another important thing: this dock has built-in Ethernet with r8153 chipset like mentioned above.

After reading comments here I've tried to disable soft retry using followed patch:

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 1c9a7957c45c..07cbcf50160c 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -189,10 +189,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 
        if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
                xhci->quirks |= XHCI_LPM_SUPPORT;
                xhci->quirks |= XHCI_INTEL_HOST;
                xhci->quirks |= XHCI_AVOID_BEI;
+               xhci->quirks |= XHCI_NO_SOFT_RETRY;
        }
        if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
                        pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
                xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
                xhci->limit_active_eps = 64;

And it completely fixed issue for me. DAC produces clear sound even if connected through chain of two hubs!


PS. 
lspci -k -nn | grep -B2 xhci 
00:14.0 USB controller [0c03]: Intel Corporation Comet Lake PCH-LP USB 3.1 xHCI Host Controller [8086:02ed]
        Subsystem: Hewlett-Packard Company Comet Lake PCH-LP USB 3.1 xHCI Host Controller [103c:8724]
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
--
37:00.0 USB controller [0c03]: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] [8086:15ec] (rev 06)
        Subsystem: Hewlett-Packard Company JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] [103c:8723]
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
--
3a:00.0 USB controller [0c03]: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] [8086:15f0] (rev 06)
        Subsystem: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] [8086:0000]
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci

5.14.6 kernel

Hope that this will help to fix it