From: Greg KH <gregkh@linuxfoundation.org>
To: Mathias Nyman <mathias.nyman@linux.intel.com>, stern@rowland.harvard.edu
Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org,
"Łukasz Bartosik" <ukaszb@chromium.org>
Subject: Re: [PATCH] usb: hub: Don't try to recover devices lost during warm reset.
Date: Tue, 15 Jul 2025 19:48:50 +0200 [thread overview]
Message-ID: <2025071527-vendor-rockfish-ef19@gregkh> (raw)
In-Reply-To: <20250623133947.3144608-1-mathias.nyman@linux.intel.com>
On Mon, Jun 23, 2025 at 04:39:47PM +0300, Mathias Nyman wrote:
> Hub driver warm-resets ports in SS.Inactive or Compliance mode to
> recover a possible connected device. The port reset code correctly
> detects if a connection is lost during reset, but hub driver
> port_event() fails to take this into account in some cases.
> port_event() ends up using stale values and assumes there is a
> connected device, and will try all means to recover it, including
> power-cycling the port.
>
> Details:
> This case was triggered when xHC host was suspended with DbC (Debug
> Capability) enabled and connected. DbC turns one xHC port into a simple
> usb debug device, allowing debugging a system with an A-to-A USB debug
> cable.
>
> xhci DbC code disables DbC when xHC is system suspended to D3, and
> enables it back during resume.
> We essentially end up with two hosts connected to each other during
> suspend, and, for a short while during resume, until DbC is enabled back.
> The suspended xHC host notices some activity on the roothub port, but
> can't train the link due to being suspended, so xHC hardware sets a CAS
> (Cold Attach Status) flag for this port to inform xhci host driver that
> the port needs to be warm reset once xHC resumes.
>
> CAS is xHCI specific, and not part of USB specification, so xhci driver
> tells usb core that the port has a connection and link is in compliance
> mode. Recovery from complinace mode is similar to CAS recovery.
>
> xhci CAS driver support that fakes a compliance mode connection was added
> in commit 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
>
> Once xHCI resumes and DbC is enabled back, all activity on the xHC
> roothub host side port disappears. The hub driver will anyway think
> port has a connection and link is in compliance mode, and hub driver
> will try to recover it.
>
> The port power-cycle during recovery seems to cause issues to the active
> DbC connection.
>
> Fix this by clearing connect_change flag if hub_port_reset() returns
> -ENOTCONN, thus avoiding the whole unnecessary port recovery and
> initialization attempt.
>
> Cc: stable@vger.kernel.org
> Fixes: 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
> Tested-by: Łukasz Bartosik <ukaszb@chromium.org>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> ---
> drivers/usb/core/hub.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Alan, any objection to this?
thanks,
greg k-h
next prev parent reply other threads:[~2025-07-15 17:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 13:39 [PATCH] usb: hub: Don't try to recover devices lost during warm reset Mathias Nyman
2025-07-15 17:48 ` Greg KH [this message]
2025-07-15 18:54 ` Alan Stern
2025-08-11 6:16 ` Jiri Slaby
2025-08-11 11:06 ` Jiri Slaby
2025-08-11 19:24 ` Alan Stern
2025-08-11 21:28 ` Michał Pecio
2025-08-12 10:48 ` Mathias Nyman
2025-08-12 18:15 ` Marcus Rückert
2025-08-12 22:02 ` Michał Pecio
2025-08-13 1:58 ` Marcus Rückert
2025-08-13 6:42 ` Michał Pecio
2025-08-13 9:14 ` Marcus Rückert
2025-08-13 9:48 ` Michał Pecio
2025-08-13 10:05 ` Marcus Rückert
2025-08-14 5:41 ` Michał Pecio
2025-08-13 10:13 ` Mathias Nyman
2025-08-13 2:11 ` Marcus Rückert
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=2025071527-vendor-rockfish-ef19@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=ukaszb@chromium.org \
/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.