public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	oneukum@suse.com, stable@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Subject: Re: [PATCH v2] usb: hub: fix detection of high tier USB3 devices behind suspended hubs
Date: Tue, 24 Jun 2025 12:49:02 +0300	[thread overview]
Message-ID: <e0b58ddf-8593-474e-aa32-156ebb8a92ad@linux.intel.com> (raw)
In-Reply-To: <c73fbead-66d7-497a-8fa1-75ea4761090a@rowland.harvard.edu>

On 24.6.2025 2.32, Alan Stern wrote:
> On Mon, Jun 23, 2025 at 10:31:17PM +0200, Konrad Dybcio wrote:
>> On 6/11/25 1:24 PM, Mathias Nyman wrote:
>>> USB3 devices connected behind several external suspended hubs may not
>>> be detected when plugged in due to aggressive hub runtime pm suspend.
>>>
>>> The hub driver immediately runtime-suspends hubs if there are no
>>> active children or port activity.
>>>
>>> There is a delay between the wake signal causing hub resume, and driver
>>> visible port activity on the hub downstream facing ports.
>>> Most of the LFPS handshake, resume signaling and link training done
>>> on the downstream ports is not visible to the hub driver until completed,
>>> when device then will appear fully enabled and running on the port.
>>>
>>> This delay between wake signal and detectable port change is even more
>>> significant with chained suspended hubs where the wake signal will
>>> propagate upstream first. Suspended hubs will only start resuming
>>> downstream ports after upstream facing port resumes.
>>>
>>> The hub driver may resume a USB3 hub, read status of all ports, not
>>> yet see any activity, and runtime suspend back the hub before any
>>> port activity is visible.
>>>
>>> This exact case was seen when conncting USB3 devices to a suspended
>>> Thunderbolt dock.
>>>
>>> USB3 specification defines a 100ms tU3WakeupRetryDelay, indicating
>>> USB3 devices expect to be resumed within 100ms after signaling wake.
>>> if not then device will resend the wake signal.
>>>
>>> Give the USB3 hubs twice this time (200ms) to detect any port
>>> changes after resume, before allowing hub to runtime suspend again.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: 2839f5bcfcfc ("USB: Turn on auto-suspend for USB 3.0 hubs.")
>>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>> ---
>> Hi, this patch seems to cause the following splat on QC
>> SC8280XP CRD board when resuming the system:
>>
>> [root@sc8280xp-crd ~]# ./suspend_test.sh
>> [   37.887029] PM: suspend entry (s2idle)
>> [   37.903850] Filesystems sync: 0.012 seconds
>> [   37.915071] Freezing user space processes
>> [   37.920925] Freezing user space processes completed (elapsed 0.001 seconds)
> I don't know what could be causing this problem.
> 
> However, Mathias, I did notice a minor error in the patch when I read it
> again.  It's in the new part of hub_activate() which does this:
> 
> +		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));
> 
> Once queue_delayed_work() has been called, it's possible that the work
> routine will run before the usb_autopm_get_interface_no_resume() call
> gets executed.  These two calls should be made in the opposite order.

Thanks, I'll fix that

-Mathias


  reply	other threads:[~2025-06-24  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 11:24 [PATCH v2] usb: hub: fix detection of high tier USB3 devices behind suspended hubs Mathias Nyman
2025-06-23 20:31 ` Konrad Dybcio
2025-06-23 23:32   ` Alan Stern
2025-06-24  9:49     ` Mathias Nyman [this message]
2025-06-24  9:47   ` Mathias Nyman
2025-06-24 16:40     ` Konrad Dybcio
2025-06-25 15:11       ` Mathias Nyman
2025-06-25 15:41         ` Konrad Dybcio
2025-06-26 12:18           ` Mathias Nyman

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=e0b58ddf-8593-474e-aa32-156ebb8a92ad@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox