From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Yaohan Li <shunsheng1218@gmail.com>
Cc: westeri@kernel.org, andreas.noever@gmail.com,
YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] thunderbolt: cancel pending DP bandwidth requests on teardown
Date: Mon, 23 Nov 2026 06:45:25 +0100 [thread overview]
Message-ID: <20261123054525.GM229695@black.igk.intel.com> (raw)
In-Reply-To: <20261119023558.1495581-1-shunsheng1218@gmail.com>
Hi,
On Thu, Nov 19, 2026 at 10:35:58AM +0800, Yaohan Li wrote:
> tb_queue_dp_bandwidth_request() queues its delayed work and keeps no
> record of it. The retry path in tb_handle_dp_bandwidth_request() queues
> the work again with a 50 ms delay, and tb_deinit() only cancels the
> bandwidth group release works. The flush_workqueue() in
> tb_domain_remove() runs before tb_deinit() but it does not cover a
> delayed work whose timer has not expired yet, so a request that is
> waiting for its retry can run after the domain has been removed and the
> tb structure has been freed.
>
> Record the queued requests in tb_cm and cancel the remaining ones in
> tb_deinit(), which runs after the workqueue has been flushed and before
> the domain device is unregistered. A request is recorded and queued
> while holding dp_bandwidth_lock, so tb_deinit() either sees it and
> cancels it or the request is rejected before it is queued at all. A
> work item that is already running hands the ownership of its request
> back to tb_deinit() through the canceled flag.
>
> This covers the list and the delayed work, not the lifetime of @tb.
> dp_bandwidth_closed keeps new work from being queued, but it is not a
> reference on @tb. Both in-tree callers are reached from the DP
> bandwidth handling in tb.c - one from the bandwidth work that runs on
> tb->wq, one from the control channel event path that tb_ctl_stop()
> stops - and tb_deinit() runs after both have been drained.
>
> Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>
>
> ---
> Prepared against v7.4-rc1-1969-g666539eecdf4.
>
> Compile tested only: arm64 with aarch64-linux-gnu-gcc 11.4
> and CONFIG_USB4=m. The affected hardware was not
> available, so the teardown path was not exercised and no fault or
> race injection was run.
For complex fixes like this, I would definitely want a real hardware repro,
and also a proof that your change actually fix it and does not cause any
unexpected "side effects".
prev parent reply other threads:[~2026-11-23 5:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 2:35 Yaohan Li
2026-11-23 5:45 ` 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=20261123054525.GM229695@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shunsheng1218@gmail.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®