🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22548

Re: [PATCH 1/2] thunderbolt: add opt-in to preserve tunnels across s2idle

#22548
From: Tobias Heath
Date: Wed, 25 Nov 2026 14:26
75 lines
15224 bytes
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.
Technical Details
Message-ID: <a08cb3e1-10a0-4a35-9258-cd510b91985e@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371387-linux-kernel-netdev=dewy.ru
References: <8fbb5876-e556-45a1-96b5-4a8061de9e5d@gmail.com> <31d3413a-9aa0-4208-8e15-3ba85829ef79@gmail.com> <20261125132228.GE191152@black.igk.intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371387-linux-kernel-netdev=dewy.ru
From: heathtobias@gmail.com (Tobias Heath)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 1/2] thunderbolt: add opt-in to preserve tunnels across
 s2idle
Date: Wed, 25 Nov 2026 14:26:56 +0000
Organization: Usenet Network
Message-ID: <a08cb3e1-10a0-4a35-9258-cd510b91985e@gmail.com>
References: <8fbb5876-e556-45a1-96b5-4a8061de9e5d@gmail.com>
 <31d3413a-9aa0-4208-8e15-3ba85829ef79@gmail.com>
 <20261125132228.GE191152@black.igk.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="227213"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:TYVNMN51UbHi8gCu/caJroQj4gA= sha256:oczQIve0G0L4+/42ahMMGDeQvOsvRk32ZtwdBd0ipiI=
	sha1:7xuHZtRIOH9/6/va8QzPGEOWryg= sha256:dD04qO3hQ7LBMREqDCt13xTwr0iDFwdX5BUbFgh4Zdg=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 001C5125E6E; Wed, 25 Nov 2026 17:27:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id E76AZfqPXJ2o;
	Wed, 25 Nov 2026 17:27:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371387-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 50521125E69; Wed, 25 Nov 2026 17:27:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B3B472D55C; Wed, 25 Nov 2026 14:27:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795616827;
	b=icODpY1zj1g+O2aLDQbS6tt26kVAxzSUXAHxZCcEnZes529PRB5e8lG9c3/Kw4wKahQ3
	 pMnJ30OIsxTcsxhOnfXjeFoUXWk4w5QquEEgbQ1iJdX4QvD9TMM6q7s2rnkS3Z0IRbKb3
	 OX/fyyScTOk/xkekaRLQZgn8/dHACyt6bv78xtH3laUkQ5/BF3xLaWQfUA1JbFvd8Q0aj
	 qtFsgycwBUfCdFHu0szaJ3qjHJD00oMtvKgu7HBf3cvMga3CSSHGLUY6nVydONlVeQKNo
	 ae3yxfONbeMq1BcxjxOPpru1lDQtJdgAlXySH0Yw61WoMtJqhDu1bdW5bVTTIDei/5A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795616827;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=nOfL+FVZ2BrVGbwc52XxXvSw2wKru+ljcM16VUgsDSY=;
	b=zO5ZU4YO1ucl4fO+o8yvAq5XcMynOBroGLI4PcRfQ31LVCLYp9jy6iRgdsBoz8kVdjDg
	 qN0q5YnjYVkPi8PeJsYmFi8UpmyBthZ3XqTLJhaPfbfpzyl1dFyN9BWRgiU00px2NRqPu
	 kcp/kPDmdlVHeR3fvly0+sxu6aZbROH+oKlfeu/pQEXa9uvvKBm0p4b9INnAngELa1ZEz
	 tXPbdiDToPZl/72nQKmyUOfOiTdhH/xqLMlNpxzfX4Yd5Ciyew8oJQDtMh4Qhsh5Z8CCD
	 jXlylCMw7QdnFIn8ZRd2FoQrqx6pKx/NNW8bVzZvrASgln1Vo3hchJq9iJ9xuritYSA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E+KYL0ej;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 399C9606A335;
	Wed, 25 Nov 2026 14:27:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E+KYL0ej
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795616821;
	b=fdI/8toeYrAvXdGBTzxMLR2y6/GtZw+zrr/zFCJka84oHWTR4NMpeid1gkQI9pxkR4e+
	 0Sfv/5U7Sj9Z+5xUX0PS9T3JWQMvUrgHWy6dgtAeQAAabbP+HBsmb/2trUWhBZ3oO6L8q
	 gq1teC2u31tJj2Oi28MoCcqmzRx7PJIfqXIBE1TioD0N9GKh89uoE1ekM3AzDN5aJj+Ow
	 XmW0lmUvfnGw4YQKlKCQXh8b6x0y65yzKgioLbvh95iFFQRIe7oQd42HS4XgAoxSMtlNF
	 PyPPgbuBAv7xkHnpIVxh9BHdxP1M1SJLrjgE/aApcYw8ABNO8RdWzcHFM4umL8LhAxA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795616821;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=nOfL+FVZ2BrVGbwc52XxXvSw2wKru+ljcM16VUgsDSY=;
	b=j8umCm9kPl8yhMgIHzSxH+277RiDG2eRd69L6jME1P/gx/CwNmcZ3ZjOJFH1QE/UQ4pf
	 525Mx7EsLxJ9RIXmWnqsV1C0aKEsZZ3fJeGjH/LRRzzO3xMbPjpPGvYttagpm2zpGboDg
	 EsYLH7uPAQ0fUwrpl4jWDyb/pt4FuyVcy4QyYUox9/R/AzmcO59+SSzayM8DQI7b8fGz9
	 5wtTKYwTcv6Q5t6EMjneJ3yBgzC7JC55iDXUUTDlV3MdmzmWMnT8xKly1WtvhSbcRLJVX
	 8uC5iG82Cz2d0RQIHTVkmt4YPBiJGmbzR2SHjOueR7ifgp9PKHBxXITGKgJjY1xzTjg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=E+KYL0ej;
	arc=none smtp.remote-ip=209.85.221.43
X-Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B267606A323
	for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 14:27:00 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0B267606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4a358881793so3052185f8f.0
        for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 06:27:00 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795616819; x=1796221619; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=nOfL+FVZ2BrVGbwc52XxXvSw2wKru+ljcM16VUgsDSY=;
        b=E+KYL0ej5L8NVJgoZU9STxOaqN5SOEr3DBlsqsFwlMlHgkqo4kNPwC3SOOlMIQASAr
         Vcf2oyZx31L7Mmsp57zAecqrOoxcpMpJwtn0UkmT24kKH54YaSnhaairutIqbvrdKbZ9
         +H6p2rs7yrNghlql3ztopmaf3+RaWFUt/N+g5Rwy6uKGLkfsAjew6zBZPY5zCrYHV1d0
         MGn0l8EKrFt3q9TUTSNCYWScLUTeYnKIzAOJ+mg8eF9I5inPBo2GUtByJ7ntI+8izJlr
         /mJ/eylFfZJ6qQPdWk2fuhRgnTI23jtUyVST3Ywxy/ZvhVu2iFhKMG5e70UUnDBeX+Xp
         uHbA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795616819; x=1796221619;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=nOfL+FVZ2BrVGbwc52XxXvSw2wKru+ljcM16VUgsDSY=;
        b=eVuyDIDO5yC74O8Tf3Et0ZiCtPvUHeN9s1iJSjRz9neSJkWoeG8Mc8Fy26SRTSjISj
         CwtrVxMK9qoV6rr7prneI8VUvYYUFicRAO3kM/tXYnlHTJwjUeHK/u6soYRCp7AiVO25
         5mBeVv9+Cxg9HKnOoiJABaG8lhzBBBNxotCaWSfX4dan11MMNHPxgru4dIeX1YCqN55q
         kQSs/l972QdHaLxS5UUy9CCcU+dPI5DMBJeqYf+ErNkPAIjiXcpcNqq+0ExP/Lhd9sYk
         9Qtjr60KFOcbEJICS/Q1yAgA1DIdUSSA0RnZA6STzWgVoVxCjFdPEMq3KBEm05fFtkSp
         Zjkg==
X-Forwarded-Encrypted: i=1; AL+hErG09IGx6//dsGtHQMZnSJ3M3px5KL59FyWTMEPgp7OJTAPoWwvdSrz6yl9NW6NyGLPU8IcI4MA=@vger.kernel.org
X-Gm-Message-State: APuU4Z8eOWCIjfEWesPPGaXttyUy8Mi0yaj9KEVczQG7dcz4gIbzJKS3
	7UVBPlqfUeDQeaz74zub2ZdOaA4SMEez45RmFs22trDr4ohjsoV2PEMH
X-Gm-Gg: AZFdTZeHlipV0l3m/zCesWZjxNZkJb+E+0RcHuiV64/u2ur48eal5+YINIvJSDxWFbq
	114zPDbjwwR2q1isl/Fp6wRYXls79ou391NJrjdfxsp+aAfAnJpv2gxezzYhidVNqtDzCqEgxc+
	elpIF13G4hBaFMzoVvEqnsouTHWhegWA7KvGoZo9TXTmQ8iI2aYgU/trVetNu5OYEFJKtJkNg2V
	b10+Ntlwlop4m2WDaggIOK4uYlichZetvVQzFeP6E37FN12v/Cyl2iPoq2a2+QoiTx9yhOgpEQe
	88Cj4VaXFV1J2W62/FDRt8fqPAdUfFvflfS9V71bjEytk+2ZGX2kFKSDfNrfdv1fkoIyNP5qNHF
	LbHJ1QbUmAjJdIHWTOFMLInFP5AWLhvU9WuExX8hCdfBC7aGXDc/XsPf37kgs2McVoUzWis28w0
	VtJ2ytaBdVH5YqAQ/ASOo3Eir8lQH56/FcpM1NaUZLNa7tJ6Ph+eNH+RCan4yxrUiy/gvn+yrzb
	jwmGeiHtB0qZMYhB96JVTZkqCKk0l3YOpaj2fNcXohgqKa2aX/JNrKMaiatT+W87xctKvg7Mezs
	96PIlQPUvAp3w7nFu4UQTT5sCHtkXtN/zIFHilEIH/Hx9ewwydJOyll34cUJfR1o7w==
X-Received: by 2002:a05:6000:2310:b0:4a2:ee0f:4fa3 with SMTP id ffacd0b85a97d-4abad6a4224mr39050556f8f.8.1795616818830;
        Wed, 25 Nov 2026 06:26:58 -0800 (PST)
X-Received: from [192.168.0.61] (firewall-214-232.seh.ox.ac.uk. [163.1.214.232])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a67fe48sm31695107f8f.23.2026.11.25.06.26.58
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 25 Nov 2026 06:26:58 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-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
X-In-Reply-To: <20261125132228.GE191152@black.igk.intel.com>