From: Sven Peter <sven@kernel.org>
To: Andreas Noever <andreas.noever@gmail.com>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Konrad Dybcio <konradybcio@kernel.org>,
asahi@lists.linux.dev, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Sven Peter <sven@kernel.org>
Subject: [PATCH v2 6/7] thunderbolt: Tear down inactive DP tunnels when the domain is stopped
Date: Sun, 23 Aug 2026 18:09:19 +0200 [thread overview]
Message-ID: <20260823-b4-tbt-fixes-v2-6-26a18a426c9f@kernel.org> (raw)
In-Reply-To: <20260823-b4-tbt-fixes-v2-0-26a18a426c9f@kernel.org>
tb_stop only tears down DMA tunnels so a DP tunnel that is still
waiting for dprx_work to complete keeps that work queued while the
routers are removed and the control channel is stopped. The work only
stops once the DPRX timeout has passed and because it requeues itself
until then the flush_workqueue in tb_domain_remove won't wait for its
final run. The callback then runs against a domain that is already torn
down. A reference to that domain is kept so the completion waiting for
that domain to disappear in unbind will block until the timeout is
eventually reached.
Tear down DP tunnels that are not active yet as well which also cancels
that work. Tunnels for displays that are already alive are untouched and
keep working.
Fixes: d6d458d42e1e ("thunderbolt: Handle DisplayPort tunnel activation asynchronously")
Cc: stable@vger.kernel.org
Signed-off-by: Sven Peter <sven@kernel.org>
---
I also didn't run into this but noticed it when fixing the hop alloc thing
and think it makes sense to fix it anyway.
---
drivers/thunderbolt/tb.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 088323cd876d..921adba3544f 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -2958,12 +2958,14 @@ static void tb_stop(struct tb *tb)
/* tunnels are only present after everything has been initialized */
list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) {
/*
- * DMA tunnels require the driver to be functional so we
- * tear them down. Other protocol tunnels can be left
- * intact.
+ * DMA tunnels and DP tunnels which are not yet active require
+ * the driver to be functional so we tear them down.
+ * Other protocol tunnels can be left intact.
*/
if (tb_tunnel_is_dma(tunnel))
tb_tunnel_deactivate(tunnel);
+ else if (tb_tunnel_is_dp(tunnel) && !tb_tunnel_is_active(tunnel))
+ tb_tunnel_deactivate(tunnel);
tb_tunnel_put(tunnel);
}
tb_switch_remove(tb->root_switch);
--
2.55.0
next prev parent reply other threads:[~2026-08-23 16:10 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
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 ` Sven Peter [this message]
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=20260823-b4-tbt-fixes-v2-6-26a18a426c9f@kernel.org \
--to=sven@kernel.org \
--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=mika.westerberg@linux.intel.com \
--cc=stable@vger.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