From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: bin luo <luob87709@gmail.com>
Cc: linux-usb@vger.kernel.org, andreas.noever@gmail.com,
westeri@kernel.org, YehezkelShB@gmail.com
Subject: Re: [BUG] thunderbolt: request work may outlive control channel teardown
Date: Fri, 27 Nov 2026 06:40:31 +0100 [thread overview]
Message-ID: <20261127054031.GD953667@black.igk.intel.com> (raw)
In-Reply-To: <CALa7h7Gx9bFLg8YTWNu6Wo_CHz5EKV0F4zJDxGXux1W9tar+sA@mail.gmail.com>
Hi,
On Thu, Nov 26, 2026 at 01:24:49PM +0800, bin luo wrote:
>
>
> Hi Mika,
>
> Thank you for looking at the report.
>
> To be upfront, I do not currently have two physical Thunderbolt/USB4
> hosts available to run a live Host-to-Host test myself, so the steps
> below are derived from the driver code rather than an observed run on
> physical hardware.
Thanks for the steps.
> Target hardware setup
> ---------------------
> - Host A (DUT): Linux host with a Thunderbolt 3/4 or USB4 host
> controller (NHI), running v7.4-rc1+ with CONFIG_USB4=y,
> CONFIG_USB4_NET=m (or y, module thunderbolt_net), CONFIG_KASAN=y,
> CONFIG_KASAN_GENERIC=y, and CONFIG_DEBUG_LIST=y.
> - Host B (peer): Second Thunderbolt 3/4 or USB4 host supporting
> Inter-Domain (XDomain) connections (Linux with thunderbolt_net works
> well to generate continuous XDomain traffic).
> - Cable: Direct Thunderbolt 3/4 or USB4 cable connecting a USB4/TB
> Type-C port on Host A to a USB4/TB Type-C port on Host B.
>
> 1. Confirm the XDomain link is up on Host A
> -------------------------------------------
> After connecting the cable between Host A and Host B:
> - Check sysfs for the domain and XDomain peer device:
> ls -l /sys/bus/thunderbolt/devices/
> (Expect domainN and an XDomain device such as 0-1 / 0-3 with
> device_name, vendor_name, and unique_id attributes.)
> - Check kernel log and thunderbolt-net interface:
> dmesg | grep -i thunderbolt
> ip link show thunderbolt0
> - Optional: enable dynamic debug to observe XDomain requests and
> control-channel stop:
> echo 'file drivers/thunderbolt/xdomain.c +p' > \
> /sys/kernel/debug/dynamic_debug/control
> echo 'file drivers/thunderbolt/ctl.c +p' > \
> /sys/kernel/debug/dynamic_debug/control
>
> 2. Trigger sequence on real hardware
> ------------------------------------
> The race is between an asynchronous no-response XDomain reply
> (__tb_xdomain_response() -> tb_cfg_request() -> schedule_work(&req->work)
> on system_wq) and NHI removal (nhi_pci_do_remove() -> tb_domain_remove()
> -> tb_ctl_stop() -> device_unregister(&tb->dev) -> tb_domain_release()
> -> tb_ctl_free()).
>
> Specifically, when Host B sends an XDomain request (either discovery/
> property/link-state requests handled by tb_xdp_handle_request(), or
> thunderbolt-net protocol frames answered via tb_xdomain_response() in
> drivers/net/thunderbolt/main.c):
> 1. tb_xdp_handle_request() calls __tb_xdomain_response(), which calls
> tb_cfg_request(ctl, req, response_ready, req) with req->response ==
> NULL.
> 2. tb_cfg_request() enqueues req on ctl->request_queue, transmits the
> frame via tb_ctl_tx(), schedules req->work on system_wq, and returns.
> 3. tb_xdp_handle_request() immediately calls tb_domain_put(tb) and exits
> while req->work is still queued on system_wq with a raw req->ctl
> pointer.
> 4. Concurrently on Host A, trigger NHI driver unbind (replace BDF with
> the NHI PCI device from `lspci -nn | grep -iE 'thunderbolt|usb4|nhi'`):
> echo 0000:00:0d.2 > /sys/bus/pci/drivers/thunderbolt/unbind
> (and rebind in a loop while Host B continuously toggles thunderbolt0
> or sends XDomain protocol requests, e.g. `ip link set thunderbolt0
> down/up` on Host B to drive TBIP_LOGIN/TBIP_LOGOUT packets handled by
> tbnet_login_response()/tbnet_logout_response() via tb_xdomain_response
This already is something real users don't do and this puts the priority
pretty low on my todo list unfortunately.
prev parent reply other threads:[~2026-11-27 5:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 13:00 [BUG] thunderbolt: request work may outlive control channel teardown Bin Luo
2026-11-25 13:06 ` Bin Luo
2026-11-25 14:04 ` Mika Westerberg
[not found] ` <CALa7h7Gx9bFLg8YTWNu6Wo_CHz5EKV0F4zJDxGXux1W9tar+sA@mail.gmail.com>
2026-11-27 5:40 ` 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=20261127054031.GD953667@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=luob87709@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.