From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Sven Peter <sven@kernel.org>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Konrad Dybcio <konradybcio@kernel.org>,
asahi@lists.linux.dev, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 2/7] thunderbolt: Make the DP tunnel activation callback mandatory
Date: Mon, 24 Aug 2026 12:45:46 +0200 [thread overview]
Message-ID: <20260824104546.GG893316@black.igk.intel.com> (raw)
In-Reply-To: <20260823-b4-tbt-fixes-v2-2-26a18a426c9f@kernel.org>
On Sun, Aug 23, 2026 at 06:09:15PM +0200, Sven Peter wrote:
> tb_tunnel_alloc_dp() takes an optional callback which is run from
> dprx_work once the DPRX capabilities read has completed. Without that
> callback tb_dp_dprx_start() reads the capabilities synchronously and
> never queues the work. It however always takes a tunnel reference which
> is only dropped by dprx_work itself or by tb_dp_dprx_stop() when
> cancel_delayed_work() actually canceled that work. That reference is
> thus leaked for every tunnel without a callback.
>
> The only tunnels without one are those from tb_tunnel_discover_dp(),
> which are activated again when restoring from hibernation.
> Pass the callback to tb_tunnel_discover_dp() as well and drop the
> synchronous path such that the DPRX capabilities are always read from
> dprx_work. Hibernation restore then also no longer blocks for up to 12
> seconds while waiting for that read to complete.
>
> Also fix up the KUnit tests.
>
> Fixes: d6d458d42e1e ("thunderbolt: Handle DisplayPort tunnel activation asynchronously")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sven Peter <sven@kernel.org>
> ---
> drivers/thunderbolt/tb.c | 4 +++-
> drivers/thunderbolt/test.c | 37 +++++++++++++++++++++++-----------
> drivers/thunderbolt/tunnel.c | 47 ++++++++++++++++++++++++--------------------
> drivers/thunderbolt/tunnel.h | 8 +++++---
> 4 files changed, 60 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index f43f2d952372..29b9879c40d8 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -89,6 +89,7 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port,
> const char *reason);
> static void tb_queue_dp_bandwidth_request(struct tb *tb, u64 route, u8 port,
> int retry, unsigned long delay);
> +static void tb_dp_tunnel_active(struct tb_tunnel *tunnel, void *data);
If possible move the whole function here instead of forward declaration.
>
> static void tb_queue_hotplug(struct tb *tb, u64 route, u8 port, bool unplug)
> {
> @@ -385,7 +386,8 @@ static void tb_switch_discover_tunnels(struct tb_switch *sw,
>
> switch (port->config.type) {
> case TB_TYPE_DP_HDMI_IN:
> - tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids);
> + tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids,
> + tb_dp_tunnel_active, tb);
next prev parent reply other threads:[~2026-08-24 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 16:09 [PATCH v2 0/7] thunderbolt: Fix DP tunnel teardown while an async DPRX read is running Sven Peter
2026-08-23 16:09 ` [PATCH v2 1/7] thunderbolt: Hold a router reference for each path hop Sven Peter
2026-08-24 10:42 ` Mika Westerberg
2026-08-24 11:06 ` Sven Peter
2026-08-24 11:37 ` Mika Westerberg
2026-08-24 12:50 ` Sven Peter
2026-08-23 16:09 ` [PATCH v2 2/7] thunderbolt: Make the DP tunnel activation callback mandatory Sven Peter
2026-08-24 10:45 ` Mika Westerberg [this message]
2026-08-24 14:13 ` Sven Peter
2026-08-24 14:17 ` Mika Westerberg
2026-08-23 16:09 ` [PATCH v2 3/7] thunderbolt: Fix domain reference leak when DPRX read is canceled Sven Peter
2026-08-23 16:09 ` [PATCH v2 4/7] thunderbolt: Don't access a DP tunnel after its DPRX read was canceled Sven Peter
2026-08-23 16:09 ` [PATCH v2 5/7] thunderbolt: Mark discovered tunnels as active Sven Peter
2026-08-23 16:09 ` [PATCH v2 6/7] thunderbolt: Tear down inactive DP tunnels when the domain is stopped Sven Peter
2026-08-23 16:09 ` [PATCH v2 7/7] thunderbolt: Drop the DP tunnel activation callback data Sven Peter
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=20260824104546.GG893316@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=asahi@lists.linux.dev \
--cc=konradybcio@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sven@kernel.org \
--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