From: Michal Pecio <michal.pecio@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
Dennis Wissel <dennis@dsine.de>, Yiyu Zhou <yiyu@yiyuzhou.io>,
linux-usb@vger.kernel.org, regressions@lists.linux.dev
Subject: Re: [REGRESSION] usbhid -110 timeouts and reset loop for Keychron M5 (3434:d068) at boot since v7.3
Date: Sun, 1 Nov 2026 09:29:30 +0100 [thread overview]
Message-ID: <20261101092930.114ca454.michal.pecio@gmail.com> (raw)
In-Reply-To: <387e9e3b-683e-474c-ba00-4b12c7c77b7c@rowland.harvard.edu>
On Sat, 31 Oct 2026 12:32:38 -0400, Alan Stern wrote:
> The USB-Persist stuff in the hub driver was originally motivated by the
> desire to recover from disconnections during system suspend. For
> example, disconnections caused by host controllers that don't provide
> Vbus power while they are suspended, or users unplugging a device while
> the system is suspended and then plugging it back in before the system
> resumes. A more detailed description, somewhat out of date by now, is
> given in the changelog for 8808f00c7adf ("USB: try to salvage lost power
> sessions").
>
> Yes, this feature is very important. Mostly it was meant for USB
> mass-storage devices going away and then reappearing following a system
> resume. Before the USB-Persist facility was added, if the device held a
> mounted filesystem the result would _not_ be what users desired, to put
> it mildly. The ability to handle transient disconnections was just an
> unintended side benefit, although there did seem to be some real cases
> where it helped -- USB mice or something like that.
>
> To the device and driver, what happens looks like a reset, or rather, a
> reset-resume because the former configuration and altsettings are
> restored. Naturally any ongoing operations would be expected to be cut
> short, but while the device is suspended this isn't an issue.
>
> It seems that you're concerned about two slightly different types of
> thing. In one, the disconnection happens while the device is suspended
> and it is discovered when we want to resume the device. Presumably
> that's not a problem for you (?), because in this case we really do go
> through the whole reset-resume procedure.
Suspend and USB-Persist is a thing to keep in mind to avoid breaking,
but intended behavior change is only to drivers with URBs pending or
submitted on a disconnected device. We would like to reject such URBs
on devices behind disconnected root hub ports.
Maybe I will just say what I'm looking for to avoid XY problems: we
need a "barrier" which separates URBs (and ideally state changes like
deconfiguration) related to the pre-disconnection state from those
related to the post-reconnection state, when a udev is "rescued" and
the HCD must accept URBs to it again.
A suspended device has no URBs, so the barrier only needs to be one-
sided. I guess root hub port reset or hcd->driver->reset_device() on
the device or any of its upstream hubs is good enough
(Current logic in 7.3 watches for individual reset_device() calls
or RH port reconnection; the latter is clearly less than ideal for
USB3, and Sashiko thinks there are other issues.)
> When a hub is reset, the logic for what happens to its children is a
> little tricky to follow. I think that each port with a connected
> child ends up being handled by hub_port_connect_change(), which
> treats it as a new connection _unless_ the child was suspended
> beforehand, in which case we follow the reset-resume path. So yes,
> it is possible for the child will be reused in this way.
Hmm, what about hub_pre_reset()? It seems to usb_disconnect() all
children when it runs. I would expect even a suspended child to be
permanently forgotten before the hub is reset.
Unless the hub itself was suspended and gets reset-resumed instead,
I suppose. But then everything is quiescent so no problem.
If core can promise that children are suspended or already deleted
when a hub gets reset, we could use hub reset as one barrier for the
hub and all children, without tracking this per-device.
I implemented this barrier logic and it seems to work as expected,
and ftrace shows that hub_pre_reset() runs and drops children. But
it works != it always works != it will stay working...
> But even when the children aren't reused, unless their
> udev->persist_enabled flag is clear, they don't go away until well
> after the hub has been reset. The reason is that the hub driver has
> to look at each one, after the hub is running again, and evaluate
> whether the connection can be recovered. Maybe this can be improved.
That sounds like suspend and reset-resume of the hub. Considering
hub_pre_reset(), it hopefully doesn't happen on awake hubs.
> The case you mentioned, about a reset being queued but not occurring
> until after a transient disconnection, is a little different from the
> other cases. The core basically ignores disconnections while a reset
> is in progress (in USB-2, the electrical signalling used during a
> reset actually makes it impossible for the upstream port to tell
> whether the device remains connected or not). Disconnections before
> a reset starts end up getting handled much the same way; the most
> that happens is that the connect-change status is cleared and the
> reset is retried.
>
> This was all implemented before USB-3 appeared. If we were to do it
> again now, we might do it differently.
Thanks, good to know. It is maybe not a big deal to maintain this
"resuscitation" of awake devices. It seems similar to recovery from
USB3 SS.Inactive state - logical link error without disconnection,
software may try to Warm Reset the device. (I don't have any repro
and don't know if it's handled here).
Regards,
Michal
next prev parent reply other threads:[~2026-11-01 8:29 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-24 17:47 [REGRESSION] usbhid -110 timeouts and reset loop for Keychron M5 (3434:d068) at boot since v7.3 Dennis Wissel
2026-10-24 20:34 ` Yiyu Zhou
2026-10-24 20:35 ` Yiyu Zhou
2026-10-24 23:10 ` Dennis Wissel
2026-10-25 8:59 ` Thorsten Leemhuis
2026-10-26 9:28 ` Mathias Nyman
2026-10-26 9:49 ` Thorsten Leemhuis
2026-10-26 10:47 ` Greg KH
2026-10-25 10:14 ` Michal Pecio
2026-10-25 11:11 ` Dennis Wissel
2026-10-26 11:15 ` Michal Pecio
2026-10-26 20:39 ` Yiyu Zhou
2026-10-27 7:29 ` Dennis Wissel
2026-10-27 8:48 ` [PATCH] xhci: keep ep0 blocked after disconnect until Address Device reloads it Yiyu Zhou
2026-10-27 9:10 ` sashiko-bot
2026-10-27 10:36 ` Mathias Nyman
2026-10-27 11:27 ` Michal Pecio
2026-10-27 18:40 ` Yiyu Zhou
2026-10-27 19:21 ` [RFT PATCH 0/2] xhci: clean up endpoint rings after disconnect detect Mathias Nyman
2026-10-27 19:21 ` [RFT PATCH 1/2] xhci: give back all TDs when skipping endpoint reset after disconnect Mathias Nyman
2026-10-27 19:21 ` [RFT PATCH 2/2] xhci: clean up ep0 ring after disconnect instead of leaving stale TRBs Mathias Nyman
2026-10-27 23:05 ` [RFT PATCH 0/2] xhci: clean up endpoint rings after disconnect detect Dennis Wissel
2026-10-29 14:07 ` Mathias Nyman
2026-10-28 7:07 ` Michal Pecio
2026-10-29 6:54 ` [PATCH 0/4] Fix problems on disconnected devices in 7.3 Michal Pecio
2026-10-29 6:54 ` [PATCH 1/4] usb: xhci: Fix TD invalidation on disconnected endpoints Michal Pecio
2026-10-29 7:12 ` sashiko-bot
2026-10-29 6:55 ` [PATCH 2/4] usb: xhci: Give back stranded URBs " Michal Pecio
2026-10-29 7:23 ` sashiko-bot
2026-10-29 6:56 ` [PATCH 3/4] usb: xhci: Give back URBs on halted " Michal Pecio
2026-10-29 7:19 ` sashiko-bot
2026-10-29 6:57 ` [PATCH 4/4] usb: xhci: Reject URBs to disconnected devices Michal Pecio
2026-10-29 7:24 ` sashiko-bot
2026-10-29 4:18 ` [RFT PATCH 0/2] xhci: clean up endpoint rings after disconnect detect Yiyu Zhou
2026-10-29 13:15 ` Mathias Nyman
2026-10-27 10:58 ` [REGRESSION] usbhid -110 timeouts and reset loop for Keychron M5 (3434:d068) at boot since v7.3 Michal Pecio
2026-10-26 9:18 ` Mathias Nyman
2026-10-26 9:51 ` Michal Pecio
2026-10-26 11:38 ` Michal Pecio
2026-10-26 11:54 ` Mathias Nyman
2026-10-26 18:56 ` Alan Stern
2026-10-26 18:58 ` Alan Stern
2026-10-30 16:47 ` Michal Pecio
2026-10-31 16:32 ` Alan Stern
2026-11-01 8:29 ` Michal Pecio [this message]
2026-10-25 6:28 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261101092930.114ca454.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=dennis@dsine.de \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=regressions@lists.linux.dev \
--cc=stern@rowland.harvard.edu \
--cc=yiyu@yiyuzhou.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.