From: Tobias Heath <heathtobias@gmail.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Sukhdeep Singh <sukhdeeps@marvell.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] thunderbolt: add opt-in to preserve tunnels across s2idle
Date: Wed, 25 Nov 2026 14:26:56 +0000 [thread overview]
Message-ID: <a08cb3e1-10a0-4a35-9258-cd510b91985e@gmail.com> (raw)
In-Reply-To: <20261125132228.GE191152@black.igk.intel.com>
Hello,
Many thanks for your reply.
On this hardware the dock-side host router is pinned in D0 by active
USB4 tunnels and has not runtime-suspended since boot (active_time=515s,
suspended_time=0). The quiet host router does go to D3cold exactly as
the spec describes. The s2idle_preserve=1 path keeps the state that
runtime-PM would have kept anyway — it prevents the system-suspend path
from forcing a D3cold transition that tears down tunnels users still
have open. Would you be open to a v2 that scopes to 'suspend target is
s2idle AND domain has active tunnels' rather than a global module parameter?
On 25/11/2026 13:22, Mika Westerberg wrote:
> Hi,
>
> On Wed, Nov 25, 2026 at 12:45:36PM +0000, Tobias Heath wrote:
>> The current implementation of tb_switch_suspend() / tb_switch_resume()
>> writes ROUTER_CS_5 SLP into each USB4 switch on entry to s2idle and
>> rebuilds the tunnel on resume, independently of whether the host router
>> and connected switches actually need that teardown.
> Well after router sleep is set and acked and the implementation specific
> method is run (typically ACPI power resource is turned off) the routers
> reset their config spaces to default except certain fields that are
> mentioned in the spec.
>
>> On AMD USB4 host
>> controllers (verified on Ryzen AI 9 HX 370; same expected on Phoenix /
>> Strix generation hardware), the switch config survives D3hot intact,
>> and the mandatory rebuild produces an entirely avoidable re-enumeration
>> cascade on wake:
> It is expected to go into D3cold and at that point you lose everything.
>
>> * Every downstream USB device goes through USB disconnect + fresh add,
>> device numbers increment, open file descriptors onto those devices
>> are invalidated (audio streams interrupted, filesystem mounts
>> unmounted-and-remounted by udisks, etc.).
>> * PCIe hot-plug fires for the dock-side bridges.
>> * The dock's PD controller is reset, producing a 1 - 2 s
>> ADP1 ONLINE=0 blip that interferes with any userspace relying on
>> AC state at wake time (for instance systemd's HibernateOnACPower=
>> policy).
>> * resume_devices takes ~2 - 5 s of avoidable work.
>>
>> Add a module parameter, thunderbolt.s2idle_preserve (default: off), which
>> skips both the tb_switch_suspend() teardown on suspend_noirq and the
>> tb_switch_resume() + tb_tunnel_activate() rebuild on resume_noirq, when
>> the sleep target is PM_SUSPEND_TO_IDLE. S3 and hibernate paths are
>> unaffected.
> Adding new module parameters should be avoided.
>
>> Measured on GPD Win Max 2 with CalDigit TS5 Plus dock:
>>
>> Default upstream: resume_devices = 2.6 s; USB storm per wake; AC blip.
>> s2idle_preserve=1: resume_devices = 0.2 s; zero re-enumeration events;
>> AC stable; downstream connections (audio, storage,
>> keyboard) survive unchanged.
>>
>> The opt-in gate is deliberate. Where the TB tree is not preserved by
>> hardware across s2idle (e.g. some Intel generations under specific
>> firmware configurations), enabling this would leave the kernel with
>> stale state at wake; users are expected to test on their own hardware
>> before enabling.
> That's actually everything except your system according to the USB4 spec at
> least and I would also assume AMD follows that too. Why it does not enter
> D3cold is not clear at this point. Do you disable it via sysfs?
>
> There is also the power problem if you keep them alive.
>
> What we can do is to avoid the unnecessary runtime resume if the domain is
> already runtime suspended when entering s2idle but that's USB stack that
> does the wake up.
next prev parent reply other threads:[~2026-11-25 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 12:39 [PATCH 0/2] thunderbolt + atlantic: preserve dock across s2idle; fix surprise-removed deadlock Tobias Heath
2026-11-25 12:45 ` [PATCH 1/2] thunderbolt: add opt-in to preserve tunnels across s2idle Tobias Heath
2026-11-25 12:48 ` [PATCH 2/2] atlantic: skip hardware teardown when PCIe parent is Tobias Heath
2026-11-25 13:22 ` [PATCH 1/2] thunderbolt: add opt-in to preserve tunnels across s2idle Mika Westerberg
2026-11-25 14:26 ` Tobias Heath [this message]
2026-11-25 14:35 ` Mika Westerberg
2026-11-25 14:42 ` Tobias Heath
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=a08cb3e1-10a0-4a35-9258-cd510b91985e@gmail.com \
--to=heathtobias@gmail.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sukhdeeps@marvell.com \
--cc=westeri@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox