From: Basavaraj Natikar <bnatikar@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-usb@vger.kernel.org, linux-doc@vger.kernel.org,
Mario Limonciello <Mario.Limonciello@amd.com>,
Sanath S <Sanath.S@amd.com>
Subject: Re: [PATCH 2/3] thunderbolt: Reset the host interface before reusing a DMA HopID
Date: Tue, 6 Oct 2026 20:17:30 +0530 [thread overview]
Message-ID: <2338ba8b-ddec-4727-89c7-7760937d690b@amd.com> (raw)
In-Reply-To: <20261006043306.GO176164@black.igk.intel.com>
Hi Mika,
On 10/6/2026 10:03 AM, Mika Westerberg wrote:
> Hi,
>
> On Mon, Oct 05, 2026 at 07:13:40PM +0530, Basavaraj Natikar wrote:
>> Reusing a DMA HopID without an intervening host interface reset can hang
>> the TX ring on some host routers. Resetting on every DMA tunnel teardown
>> clears the state but, as the reset affects all rings, also disturbs
>> unrelated active tunnels.
>>
>> Hence, track the DMA HopIDs programmed since the last reset, prefer unused
>> HopIDs when allocating rings, and check for reuse at tb_ring_start() too,
>> since networking retains its rings across reconnect. Return -EAGAIN instead
>> of programming a HopID that still needs a reset.
>>
>> Run the reset from a work item once all DMA rings are idle: serialize it
>> with the connection manager, stop the control channel around it, and block
>> DMA rings from starting during the reset. Fence the work across domain
>> removal and PM transitions, preserve live DMA rings across freeze/thaw, and
>> restore the interrupt-mask shadow under the NHI lock after the reset.
>>
>> On -EAGAIN, retry the networking login asynchronously and block the work
>> producers before teardown cancels the workers. Keep peer disconnection
>> separate from administrative shutdown so it cannot reopen the login gate,
>> while stream and DMA-test callers unwind immediately and return the error
>> to userspace.
>>
>> Enable this only for reset-capable host interfaces marked with
>> QUIRK_RESET_DMA_ON_REUSE. A competing DMA tunnel must stop before its dirty
>> HopID can be reused, and retrying does not interrupt that tunnel.
>>
>> Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Yeah, I'm not really sure I suggested this :(
>
> My idea was to done it so that it is nicely contained inside nhi.c without
> distracting the service drivers. What you are doing is complete opposite of
> that.
>
> Given the complexity I would then rather just take the previous quirk with
> the deadlock fixed.
Agreed. The current approach spreads the handling into the service drivers
and is more complex than intended.
Thanks,
--
Basavaraj
next prev parent reply other threads:[~2026-10-06 14:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 13:43 [PATCH 0/3] thunderbolt: Reset affected AMD host interfaces before DMA HopID reuse Basavaraj Natikar
2026-10-05 13:43 ` [PATCH 1/3] thunderbolt: Allow tb_ring_start() to fail Basavaraj Natikar
2026-10-06 4:27 ` Mika Westerberg
2026-10-06 16:24 ` sashiko-bot
2026-10-05 13:43 ` [PATCH 2/3] thunderbolt: Reset the host interface before reusing a DMA HopID Basavaraj Natikar
2026-10-05 14:35 ` Mika Westerberg
2026-10-05 15:12 ` Mario Limonciello
2026-10-05 16:50 ` Basavaraj Natikar
2026-10-06 4:33 ` Mika Westerberg
2026-10-06 14:47 ` Basavaraj Natikar [this message]
2026-10-06 16:35 ` sashiko-bot
2026-10-05 13:43 ` [PATCH 3/3] thunderbolt: Add quirk to reset host interface for AMD USB4 routers Basavaraj Natikar
2026-10-06 16:49 ` sashiko-bot
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=2338ba8b-ddec-4727-89c7-7760937d690b@amd.com \
--to=bnatikar@amd.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Sanath.S@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=pabeni@redhat.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