mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Tobias Heath <heathtobias@gmail.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:22:28 +0100	[thread overview]
Message-ID: <20261125132228.GE191152@black.igk.intel.com> (raw)
In-Reply-To: <31d3413a-9aa0-4208-8e15-3ba85829ef79@gmail.com>

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.

      parent reply	other threads:[~2026-11-25 13:22 UTC|newest]

Thread overview: 4+ 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   ` Mika Westerberg [this message]

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=20261125132228.GE191152@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=heathtobias@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®