[PATCH v3 0/7] thunderbolt: Fix DP tunnel teardown while an async DPRX read is running

Sven Peter posted 7 patches 4 weeks ago
drivers/thunderbolt/switch.c |  9 +++++-
drivers/thunderbolt/tb.c     | 34 ++++++++++++++-------
drivers/thunderbolt/test.c   | 58 ++++++++++++++++++++++++++++-------
drivers/thunderbolt/tunnel.c | 73 ++++++++++++++++++++++++++------------------
drivers/thunderbolt/tunnel.h | 12 +++-----
5 files changed, 127 insertions(+), 59 deletions(-)
[PATCH v3 0/7] thunderbolt: Fix DP tunnel teardown while an async DPRX read is running
Posted by Sven Peter 4 weeks ago
Hi,

This series contains a bunch of fixes related to teardown while an async
DPRX read is running. I ran into some of these while bringing up the
Apple Silicon NHI and just haven't implemented DP tunneling support yet
such that the DPRX capabilities read can never complete and will always
time out.

None of it is specific to that hardware though so I figured it
makes sense to already send them out.

Best,

Sven

---
Changes in v3:
- Take the router references in the HopID allocation/release helpers
- Actually call put_device() via a cleanup action for the KUnit tests
- Link to v2: https://patch.msgid.link/20260823-b4-tbt-fixes-v2-0-26a18a426c9f@kernel.org

Changes in v2:
- Make the DP tunnel activation callback mandatory. The DPRX
  caps are now always read inside dprx_work which now also happens to
  discovered tunnels when they are activated again after hibernation
  restore.
- Mark discovered tunnels as active
- Add a cleanup commit to drop the callback data that's always the same now
- Tear down DP tunnels that are inactive in tb_stop instead of
  exposing tb_tunnel_cancel_dprx.
- Use "router" instead of "switch" in the subject
- Added comments how these issues can be reproduced
- Link to v1: https://patch.msgid.link/20260817-b4-tbt-fixes-v1-0-eded2461f5fc@kernel.org

To: Andreas Noever <andreas.noever@gmail.com>
To: Mika Westerberg <westeri@kernel.org>
To: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Konrad Dybcio <konradybcio@kernel.org>
Cc: asahi@lists.linux.dev
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

---
Sven Peter (7):
      thunderbolt: Hold a router reference for each allocated HopID
      thunderbolt: Make the DP tunnel activation callback mandatory
      thunderbolt: Fix domain reference leak when DPRX read is canceled
      thunderbolt: Don't access a DP tunnel after its DPRX read was canceled
      thunderbolt: Mark discovered tunnels as active
      thunderbolt: Tear down inactive DP tunnels when the domain is stopped
      thunderbolt: Drop the DP tunnel activation callback data

 drivers/thunderbolt/switch.c |  9 +++++-
 drivers/thunderbolt/tb.c     | 34 ++++++++++++++-------
 drivers/thunderbolt/test.c   | 58 ++++++++++++++++++++++++++++-------
 drivers/thunderbolt/tunnel.c | 73 ++++++++++++++++++++++++++------------------
 drivers/thunderbolt/tunnel.h | 12 +++-----
 5 files changed, 127 insertions(+), 59 deletions(-)
---
base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f
change-id: 20260815-b4-tbt-fixes-a2689186016d

Best regards,
--  
Sven Peter <sven@kernel.org>
Re: [PATCH v3 0/7] thunderbolt: Fix DP tunnel teardown while an async DPRX read is running
Posted by Mika Westerberg 3 weeks, 4 days ago
Hi,

On Sat, Aug 29, 2026 at 10:08:32AM +0200, Sven Peter wrote:
> Hi,
> 
> This series contains a bunch of fixes related to teardown while an async
> DPRX read is running. I ran into some of these while bringing up the
> Apple Silicon NHI and just haven't implemented DP tunneling support yet
> such that the DPRX capabilities read can never complete and will always
> time out.
> 
> None of it is specific to that hardware though so I figured it
> makes sense to already send them out.
> 
> Best,
> 
> Sven
> 
> ---
> Changes in v3:
> - Take the router references in the HopID allocation/release helpers
> - Actually call put_device() via a cleanup action for the KUnit tests
> - Link to v2: https://patch.msgid.link/20260823-b4-tbt-fixes-v2-0-26a18a426c9f@kernel.org
> 
> Changes in v2:
> - Make the DP tunnel activation callback mandatory. The DPRX
>   caps are now always read inside dprx_work which now also happens to
>   discovered tunnels when they are activated again after hibernation
>   restore.
> - Mark discovered tunnels as active
> - Add a cleanup commit to drop the callback data that's always the same now
> - Tear down DP tunnels that are inactive in tb_stop instead of
>   exposing tb_tunnel_cancel_dprx.
> - Use "router" instead of "switch" in the subject
> - Added comments how these issues can be reproduced
> - Link to v1: https://patch.msgid.link/20260817-b4-tbt-fixes-v1-0-eded2461f5fc@kernel.org
> 
> To: Andreas Noever <andreas.noever@gmail.com>
> To: Mika Westerberg <westeri@kernel.org>
> To: Yehezkel Bernat <YehezkelShB@gmail.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Konrad Dybcio <konradybcio@kernel.org>
> Cc: asahi@lists.linux.dev
> Cc: linux-usb@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> ---
> Sven Peter (7):
>       thunderbolt: Hold a router reference for each allocated HopID
>       thunderbolt: Make the DP tunnel activation callback mandatory
>       thunderbolt: Fix domain reference leak when DPRX read is canceled
>       thunderbolt: Don't access a DP tunnel after its DPRX read was canceled
>       thunderbolt: Mark discovered tunnels as active
>       thunderbolt: Tear down inactive DP tunnels when the domain is stopped

Applied 1-6 to thunderbolt.git/fixes, with minor changes in the commit
messages and the condition in patch 6, thanks! Please check that it is
okay. My testing at least it works as expected.

>       thunderbolt: Drop the DP tunnel activation callback data

Since this one is a cleanup, I wonder if you can send it again later when
the DPRX fixes have landed? I typically base my next branch after -rc1 and
don't merge fixes/rc's there constantly so preferably after v7.4-rc1 is
released.
Re: [PATCH v3 0/7] thunderbolt: Fix DP tunnel teardown while an async DPRX read is running
Posted by Sven Peter 3 weeks, 4 days ago
Hi,

On 9/1/26 10:19, Mika Westerberg wrote:
>> ---
>> Sven Peter (7):
>>        thunderbolt: Hold a router reference for each allocated HopID
>>        thunderbolt: Make the DP tunnel activation callback mandatory
>>        thunderbolt: Fix domain reference leak when DPRX read is canceled
>>        thunderbolt: Don't access a DP tunnel after its DPRX read was canceled
>>        thunderbolt: Mark discovered tunnels as active
>>        thunderbolt: Tear down inactive DP tunnels when the domain is stopped
> Applied 1-6 to thunderbolt.git/fixes, with minor changes in the commit
> messages and the condition in patch 6, thanks! Please check that it is
> okay. My testing at least it works as expected.

Looks good to me, thanks!

>
>>        thunderbolt: Drop the DP tunnel activation callback data
> Since this one is a cleanup, I wonder if you can send it again later when
> the DPRX fixes have landed? I typically base my next branch after -rc1 and
> don't merge fixes/rc's there constantly so preferably after v7.4-rc1 is
> released.

Sure, I can resend it after 7.4-rc1 is out.


Sven