Skip to contentSkip to conversation

Fix "detection of high tier USB3 devices" patch in usb-linus

PATCH Superseded Mathias Nyman 4 participants 8 messages Jun 26, 2025 – Jun 27, 2025 USB

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Fix "detection of high tier USB3 devices" patch in usb-linus

Hi Greg

This is a fixup patch for
8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs") that is currently in your usb-linus branch.

Let me know if you instead of adding this fixup want to drop the original and me to send a new 'squashed' patch instead.

Thanks
Mathias

Mathias Nyman (1):
usb: hub: Fix flushing and scheduling of delayed work that tunes
runtime pm

 drivers/usb/core/hub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

Delayed work to prevent USB3 hubs from runtime-suspending immediately after resume was added in commit 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs").

This delayed work needs be flushed if system suspends, or hub needs to be quiesced for other reasons right after resume. Not flushing it triggered issues on QC SC8280XP CRD board during suspend/resume testing.

Fix it by flushing the delayed resume work in hub_quiesce()

The delayed work item that allow hub runtime suspend is also scheduled just before calling autopm get. Alan pointed out there is a small risk that work is run before autopm get, which would call autopm put before get, and mess up the runtime pm usage order.
Swap the order of work sheduling and calling autopm get to solve this.

---
 drivers/usb/core/hub.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +4 -2
index 6bb6e92cb0a4..08562711dcf2 100644
@@ -1359,11 +1359,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 
 	if (type == HUB_RESUME && hub_is_superspeed(hub->hdev)) {
 		/* give usb3 downstream links training time after hub resume */
+		usb_autopm_get_interface_no_resume(
+			to_usb_interface(hub->intfdev));
+
 		INIT_DELAYED_WORK(&hub->init_work, hub_post_resume);
 		queue_delayed_work(system_power_efficient_wq, &hub->init_work,
 				   msecs_to_jiffies(USB_SS_PORT_U0_WAKE_TIME));
-		usb_autopm_get_interface_no_resume(
-			to_usb_interface(hub->intfdev));
 		return;
 	}
 
@@ -1417,6 +1418,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
 
 	/* Stop hub_wq and related activity */
 	timer_delete_sync(&hub->irq_urb_retry);
+	flush_delayed_work(&hub->init_work);
 	usb_kill_urb(hub->urb);
 	if (hub->has_indicators)
 		cancel_delayed_work_sync(&hub->leds);
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/1] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

Quoted 9 lines · Mathias Nyman

Delayed work to prevent USB3 hubs from runtime-suspending immediately after resume was added in commit 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs").

This delayed work needs be flushed if system suspends, or hub needs to be quiesced for other reasons right after resume. Not flushing it triggered issues on QC SC8280XP CRD board during suspend/resume testing.

Fix it by flushing the delayed resume work in hub_quiesce()

I'm seeing NFS boot failures on the Raspberry Pi 3B+ in pending-fixes which bisect to this commit. The networking fails to come up so the rootfs can't be mounted, the ethernet on these boards is USB based.

Full log:

https://lava.sirena.org.uk/scheduler/job/1516948#L1142

Bisect log:

# bad: [d427f8d7f886d8f8a04b5428576eae768b4d82df] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
# good: [f02769e7f272d6f42b9767f066c5a99afd2338f3] Merge tag 'devicetree-fixes-for-6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
# good: [bf39286adc5e10ce3e32eb86ad316ae56f3b52a0] ASoC: amd: yc: Add DMI quirk for Lenovo IdeaPad Slim 5 15
# good: [6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e] ASoC: SOF: Intel: hda: Use devm_kstrdup() to avoid memleak.
# good: [ff21a6ec0f27c126db0a86d96751bd6e5d1d9874] ASoC: rt721-sdca: fix boost gain calculation error
# good: [dc6458ed95e40146699f9c523e34cb13ff127170] ASoC: amd: ps: fix for soundwire failures during hibernation exit sequence
git bisect start 'd427f8d7f886d8f8a04b5428576eae768b4d82df' 'f02769e7f272d6f42b9767f066c5a99afd2338f3' 'bf39286adc5e10ce3e32eb86ad316ae56f3b52a0' '6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e' 'ff21a6ec0f27c126db0a86d96751bd6e5d1d9874' 'dc6458ed95e40146699f9c523e34cb13ff127170'

# test job: [bf39286adc5e10ce3e32eb86ad316ae56f3b52a0] https://lava.sirena.org.uk/scheduler/job/1497128
# test job: [6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e] https://lava.sirena.org.uk/scheduler/job/1508039
# test job: [ff21a6ec0f27c126db0a86d96751bd6e5d1d9874] https://lava.sirena.org.uk/scheduler/job/1506606
# test job: [dc6458ed95e40146699f9c523e34cb13ff127170] https://lava.sirena.org.uk/scheduler/job/1499810
# test job: [d427f8d7f886d8f8a04b5428576eae768b4d82df] https://lava.sirena.org.uk/scheduler/job/1516135
# bad: [d427f8d7f886d8f8a04b5428576eae768b4d82df] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
git bisect bad d427f8d7f886d8f8a04b5428576eae768b4d82df
# test job: [d33699368307488766936aaaddc54dca2e7d16e6] https://lava.sirena.org.uk/scheduler/job/1516393
# bad: [d33699368307488766936aaaddc54dca2e7d16e6] Merge branch 'libcrypto-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
git bisect bad d33699368307488766936aaaddc54dca2e7d16e6
# test job: [3cef1fa2e5ab778fac013758696f467a59c62a59] https://lava.sirena.org.uk/scheduler/job/1516449
# good: [3cef1fa2e5ab778fac013758696f467a59c62a59] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
git bisect good 3cef1fa2e5ab778fac013758696f467a59c62a59
# test job: [cb6b43d5b6dcae418cdda3ed43324f8545fd6f05] https://lava.sirena.org.uk/scheduler/job/1516670
# bad: [cb6b43d5b6dcae418cdda3ed43324f8545fd6f05] Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git
git bisect bad cb6b43d5b6dcae418cdda3ed43324f8545fd6f05
# test job: [af4db5a35a4ef7a68046883bfd12468007db38f1] https://lava.sirena.org.uk/scheduler/job/1516809
# good: [af4db5a35a4ef7a68046883bfd12468007db38f1] usb: typec: altmodes/displayport: do not index invalid pin_assignments
git bisect good af4db5a35a4ef7a68046883bfd12468007db38f1
# test job: [09812134071b3941fb81def30b61ed36d3a5dfb5] https://lava.sirena.org.uk/scheduler/job/1516835
# good: [09812134071b3941fb81def30b61ed36d3a5dfb5] dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
git bisect good 09812134071b3941fb81def30b61ed36d3a5dfb5
# test job: [5d843d4194975b2c21cf2e982bdc150f91b665c0] https://lava.sirena.org.uk/scheduler/job/1516926
# good: [5d843d4194975b2c21cf2e982bdc150f91b665c0] Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
git bisect good 5d843d4194975b2c21cf2e982bdc150f91b665c0
# test job: [a49e1e2e785fb3621f2d748581881b23a364998a] https://lava.sirena.org.uk/scheduler/job/1517035
# bad: [a49e1e2e785fb3621f2d748581881b23a364998a] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm
git bisect bad a49e1e2e785fb3621f2d748581881b23a364998a
# test job: [099cf1fbb8afc3771f408109f62bdec66f85160e] https://lava.sirena.org.uk/scheduler/job/1517048
# good: [099cf1fbb8afc3771f408109f62bdec66f85160e] usb: typec: displayport: Fix potential deadlock
git bisect good 099cf1fbb8afc3771f408109f62bdec66f85160e
# first bad commit: [a49e1e2e785fb3621f2d748581881b23a364998a] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm
#3 lore raw

Re: [PATCH 1/1] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

Quoted 11 lines · Mark Brown
Quoted 9 lines · Mathias Nyman

Delayed work to prevent USB3 hubs from runtime-suspending immediately after resume was added in commit 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs").

This delayed work needs be flushed if system suspends, or hub needs to be quiesced for other reasons right after resume. Not flushing it triggered issues on QC SC8280XP CRD board during suspend/resume testing.

Fix it by flushing the delayed resume work in hub_quiesce()

Quoted 8 lines

I'm seeing NFS boot failures on the Raspberry Pi 3B+ in pending-fixes which bisect to this commit. The networking fails to come up so the rootfs can't be mounted, the ethernet on these boards is USB based.

Full log:

    https://lava.sirena.org.uk/scheduler/job/1516948#L1142

Thanks for the report

The Raspberry Pi 3B+ doesn't have USB3 ports, so it should not be due to pending post resume work.

The same hub->init_work is however used for other purposes as well, it could be that we end up flushing some other work.

If I write a v2 patch that puts this post resume work into its own dedicated work item, and only flushes that, could you try it out on the Raspberry Pi 3B+

Same with the QC SC8280XP CRD board, would be grateful if Konrad could try out a version 2.

Thanks
Mathias

#4 lore raw

Re: [PATCH 1/1] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

Quoted 29 lines · Mathias Nyman
Quoted 11 lines · Mark Brown
Quoted 9 lines · Mathias Nyman

Delayed work to prevent USB3 hubs from runtime-suspending immediately after resume was added in commit 8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs").

This delayed work needs be flushed if system suspends, or hub needs to be quiesced for other reasons right after resume. Not flushing it triggered issues on QC SC8280XP CRD board during suspend/resume testing.

Fix it by flushing the delayed resume work in hub_quiesce()

Quoted 8 lines

I'm seeing NFS boot failures on the Raspberry Pi 3B+ in pending-fixes which bisect to this commit.  The networking fails to come up so the rootfs can't be mounted, the ethernet on these boards is USB based.

Full log:

    https://lava.sirena.org.uk/scheduler/job/1516948#L1142

Thanks for the report

The Raspberry Pi 3B+ doesn't have USB3 ports, so it should not be due to pending post resume work.

The same hub->init_work is however used for other purposes as well, it could be that we end up flushing some other work.

Quoted 6 lines

If I write a v2 patch that puts this post resume work into its own dedicated work item, and only flushes that, could you try it out on the Raspberry Pi 3B+

Same with the QC SC8280XP CRD board, would be grateful if Konrad could try out a version 2.

Keep me CCd and I gladly will!

Konrad

#5 lore raw

Re: [PATCH 1/1] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

In reply to Mathias Nyman
Quoted 3 lines · Mathias Nyman

If I write a v2 patch that puts this post resume work into its own dedicated work item, and only flushes that, could you try it out on the Raspberry Pi 3B+

Sure (and if it turns in -next it'll get tested regardless of if I take active steps!).

#6 lore raw

Re: [PATCH 1/1] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm

In reply to Mark Brown
Quoted 3 lines · Mark Brown

I'm seeing NFS boot failures on the Raspberry Pi 3B+ in pending-fixes which bisect to this commit. The networking fails to come up so the rootfs can't be mounted, the ethernet on these boards is USB based.

JFTR I also seem to be seeing similar NFS root failures from this on the Libretech Alta:

https://lava.sirena.org.uk/scheduler/job/1519029#L1770

I'll follow up if the previously posted fix doesn't also work here, unfortunately the firmware has innovated in the field of reliable networking (hence why the report turned up six hours later) so it's kind of annoying to get test results.

Bisect:

# bad: [d427f8d7f886d8f8a04b5428576eae768b4d82df] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
# good: [f02769e7f272d6f42b9767f066c5a99afd2338f3] Merge tag 'devicetree-fixes-for-6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
# good: [6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e] ASoC: SOF: Intel: hda: Use devm_kstrdup() to avoid memleak.
# good: [dc6458ed95e40146699f9c523e34cb13ff127170] ASoC: amd: ps: fix for soundwire failures during hibernation exit sequence
# good: [ff21a6ec0f27c126db0a86d96751bd6e5d1d9874] ASoC: rt721-sdca: fix boost gain calculation error
# good: [bf39286adc5e10ce3e32eb86ad316ae56f3b52a0] ASoC: amd: yc: Add DMI quirk for Lenovo IdeaPad Slim 5 15
git bisect start 'd427f8d7f886d8f8a04b5428576eae768b4d82df' 'f02769e7f272d6f42b9767f066c5a99afd2338f3' '6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e' 'dc6458ed95e40146699f9c523e34cb13ff127170' 'ff21a6ec0f27c126db0a86d96751bd6e5d1d9874' 'bf39286adc5e10ce3e32eb86ad316ae56f3b52a0'

# test job: [6c038b58a2dc5a008c7e7a1297f5aaa4deaaaa7e] https://lava.sirena.org.uk/scheduler/job/1508063
# test job: [dc6458ed95e40146699f9c523e34cb13ff127170] https://lava.sirena.org.uk/scheduler/job/1500817
# test job: [ff21a6ec0f27c126db0a86d96751bd6e5d1d9874] https://lava.sirena.org.uk/scheduler/job/1506669
# test job: [bf39286adc5e10ce3e32eb86ad316ae56f3b52a0] https://lava.sirena.org.uk/scheduler/job/1497137
# test job: [d427f8d7f886d8f8a04b5428576eae768b4d82df] https://lava.sirena.org.uk/scheduler/job/1516563
# bad: [d427f8d7f886d8f8a04b5428576eae768b4d82df] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
git bisect bad d427f8d7f886d8f8a04b5428576eae768b4d82df
# test job: [d33699368307488766936aaaddc54dca2e7d16e6] https://lava.sirena.org.uk/scheduler/job/1517049
# bad: [d33699368307488766936aaaddc54dca2e7d16e6] Merge branch 'libcrypto-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
git bisect bad d33699368307488766936aaaddc54dca2e7d16e6
# test job: [3cef1fa2e5ab778fac013758696f467a59c62a59] https://lava.sirena.org.uk/scheduler/job/1517137
# good: [3cef1fa2e5ab778fac013758696f467a59c62a59] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
git bisect good 3cef1fa2e5ab778fac013758696f467a59c62a59
# test job: [cb6b43d5b6dcae418cdda3ed43324f8545fd6f05] https://lava.sirena.org.uk/scheduler/job/1518260
# bad: [cb6b43d5b6dcae418cdda3ed43324f8545fd6f05] Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git
git bisect bad cb6b43d5b6dcae418cdda3ed43324f8545fd6f05
# test job: [af4db5a35a4ef7a68046883bfd12468007db38f1] https://lava.sirena.org.uk/scheduler/job/1518624
# good: [af4db5a35a4ef7a68046883bfd12468007db38f1] usb: typec: altmodes/displayport: do not index invalid pin_assignments
git bisect good af4db5a35a4ef7a68046883bfd12468007db38f1
# test job: [09812134071b3941fb81def30b61ed36d3a5dfb5] https://lava.sirena.org.uk/scheduler/job/1518720
# good: [09812134071b3941fb81def30b61ed36d3a5dfb5] dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
git bisect good 09812134071b3941fb81def30b61ed36d3a5dfb5
# test job: [5d843d4194975b2c21cf2e982bdc150f91b665c0] https://lava.sirena.org.uk/scheduler/job/1518763
# good: [5d843d4194975b2c21cf2e982bdc150f91b665c0] Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
git bisect good 5d843d4194975b2c21cf2e982bdc150f91b665c0
# test job: [a49e1e2e785fb3621f2d748581881b23a364998a] https://lava.sirena.org.uk/scheduler/job/1519029
# bad: [a49e1e2e785fb3621f2d748581881b23a364998a] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm
git bisect bad a49e1e2e785fb3621f2d748581881b23a364998a
# test job: [099cf1fbb8afc3771f408109f62bdec66f85160e] https://lava.sirena.org.uk/scheduler/job/1519034
# good: [099cf1fbb8afc3771f408109f62bdec66f85160e] usb: typec: displayport: Fix potential deadlock
git bisect good 099cf1fbb8afc3771f408109f62bdec66f85160e
# first bad commit: [a49e1e2e785fb3621f2d748581881b23a364998a] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm
maintainer
#7 lore raw
In reply to Mathias Nyman
Quoted 8 lines · Mathias Nyman

Hi Greg

This is a fixup patch for
8f5b7e2bec1c ("usb: hub: fix detection of high tier USB3 devices behind suspended hubs") that is currently in your usb-linus branch.

Let me know if you instead of adding this fixup want to drop the original and me to send a new 'squashed' patch instead.

This is good, I'll take it as-is, thanks!

greg k-h