Linux USB
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Juan Martinez <juan.martinez@amd.com>,
	westeri@kernel.org, andreas.noever@gmail.com,
	YehezkelShB@gmail.com, Basavaraj.Natikar@amd.com,
	Sanath.S@amd.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] thunderbolt: Fix tb->lock deadlock during hot-unplug on AMD USB4 routers
Date: Mon, 31 Aug 2026 08:07:56 -0500	[thread overview]
Message-ID: <82d72aff-a9b0-4a07-9a5a-8f591009e43e@amd.com> (raw)
In-Reply-To: <20260831130638.GK124825@black.igk.intel.com>



On 8/31/26 08:06, Mika Westerberg wrote:
> Hi,
> 
> On Mon, Aug 31, 2026 at 07:55:16AM -0500, Mario Limonciello wrote:
>>>> +static void tb_domain_reset_interface(struct tb *tb)
>>>> +{
>>>> +	guard(mutex)(&tb->lock);
>>>> +	__tb_domain_reset_interface_locked(tb);
>>>> +}
>>>> +
>>>>    /**
>>>>     * tb_domain_disconnect_xdomain_paths() - Disable DMA paths for XDomain
>>>>     * @tb: Domain disabling the DMA paths
>>>> @@ -835,7 +849,7 @@ int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd,
>>>>    	if (ret)
>>>>    		return ret;
>>>> -	if (tb->nhi->quirks & QUIRK_RESET_DMA_ON_TEARDOWN)
>>>> +	if (!xd->is_unplugged)
>>>
>>> If I read this right, if you unplug a tree (say a router and then after
>>> that router there is inter-domain link) with this check the reset does not
>>> happen and AMD system still hangs?
>>>
>>
>> It should be a different problem.  The quirk fixed a problem in the USB4
>> router (router wasn't functional when problem occurred).
>>
>> This fixes a deadlock in the kernel that system gets stuck while shutting
>> down.
> 
> Right, but now since this checks !xd->is_unplugged and only then does the
> reset, if you unplug the whole chain including the XDomain connection (i.e.
> the unplug happens say on host router downstream port) then we mark
> everything below that with is_unplugged=1 so now this function will skip
> the quirk and the DMA will get stuck, no?
> 
> Because..
> 
>>
>>>>    		tb_domain_reset_interface(tb);
>>>>    	return 0;
>>>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
>>>> index b7cc6894a598..89dfb3381345 100644
>>>> --- a/drivers/thunderbolt/tb.c
>>>> +++ b/drivers/thunderbolt/tb.c
>>>> @@ -2489,6 +2489,7 @@ static void tb_handle_hotplug(struct work_struct *work)
>>>>    			tb_xdomain_remove(xd);
>>>>    			port->xdomain = NULL;
>>>>    			__tb_disconnect_xdomain_paths(tb, xd, -1, -1, -1, -1);
>>>> +			__tb_domain_reset_interface_locked(tb);
> 
> ... this is not called when the unplug happens elsewhere (like before the
> XDomain link).

Ah yeah.

Juan - take a closer look at this, I think you're gonna have to spin it 
again.

  reply	other threads:[~2026-08-31 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 21:42 [PATCH v2] thunderbolt: Fix tb->lock deadlock during hot-unplug on AMD USB4 routers juan.martinez
2026-08-26  3:02 ` Mario Limonciello
2026-08-27 21:57 ` [PATCH v3] " Juan Martinez
2026-08-28  4:43   ` Mario Limonciello
2026-08-28  5:19   ` [PATCH v4] " Juan Martinez
2026-08-28 14:58     ` Mario Limonciello
2026-08-31 11:11     ` Mika Westerberg
2026-08-31 12:55       ` Mario Limonciello
2026-08-31 13:06         ` Mika Westerberg
2026-08-31 13:07           ` Mario Limonciello [this message]
2026-08-31 16:16           ` [PATCH v5] " juan.martinez
2026-09-01 22:16             ` Mario Limonciello
2026-09-02  5:48               ` Mika Westerberg

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=82d72aff-a9b0-4a07-9a5a-8f591009e43e@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Sanath.S@amd.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=juan.martinez@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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