Linux USB
 help / color / mirror / Atom feed
* thunderbolt: second DP tunnel permanently reduced while first tunnel's DPRX read is pending (tiled 5K display comes up split)
@ 2026-11-28 17:01 mrmrossi
  2026-11-30 11:45 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: mrmrossi @ 2026-11-28 17:01 UTC (permalink / raw)
  To: Mika Westerberg, Andreas Noever, Yehezkel Bernat
  Cc: linux-usb@vger.kernel.org

Hi,
first of all, this is a report Claude created, had a quick review and it looks legit so I decided to report as the workaround actually fixed the issue.

Here you have it:

On an Alder Lake laptop with an LG UltraWide 5K (Thunderbolt 3, tiled
2x1, two SST DP streams), the second DP tunnel is often reduced to HBR x4
when the monitor connects. The right tile then comes up with a different
link rate and bpp than the left one, i915 does not enable transcoder port
sync for the tile group, and the picture is split and flickering until
the next replug. Roughly 3 out of 5 replugs fail.

Hardware / software
-------------------
- Lenovo ThinkPad X1 Carbon Gen 10, Alder Lake-P Iris Xe [8086:46a6], i915
- LG UltraWide 5K, TB3 device vendor=0x1e device=0x1112, connected directly
- Thunderbolt link 20 Gb/s x2, software connection manager
- Kernel 7.3.4 and 7.3.6 (Fedora 45, no Fedora patches to
  drivers/thunderbolt); also seen on 7.3.4 Fedora 44
- Happens with both bw_alloc_mode=1 (default) and bw_alloc_mode=0

Root cause
----------
When tunnel 2 is set up before tunnel 1's DPRX capability read has
completed, tunnel 1 is accounted at the full DP IN/OUT capability (HBR3 x4
= 25920 Mb/s), although the sink only does HBR2 x4. Tunnel 2 gets the
remaining 10080 Mb/s and is reduced to HBR x4. Once the DPRX read
completes, tunnel 1 drops to 17280 Mb/s and ~18.7 Gb/s is free again, but
tunnel 2 is never re-expanded.

Failing sequence (thunderbolt.dyndbg=+p, bw_alloc_mode=0):

  0:5 <-> 1:10 (DP): activating
  0:5 <-> 1:10 (DP): DPRX read timeout
  0:5 <-> 1:10 (DP): consumed bandwidth 0/25920 Mb/s
  available bandwidth for new DP tunnel 36000/10080 Mb/s
  0:6 <-> 1:11 (DP): activating
  0:6 <-> 1:11 (DP): bandwidth reduced to 2700 Mb/s x4 = 8640 Mb/s
  0:5 <-> 1:10 (DP): DPRX capabilities read completed
  0:5 <-> 1:10 (DP): consumed bandwidth 0/17280 Mb/s
  0:6 <-> 1:11 (DP): DPRX read timeout
  0:6 <-> 1:11 (DP): consumed bandwidth 0/8640 Mb/s

Good sequence (DPRX of tunnel 1 completed first):

  0:5 <-> 1:10 (DP): consumed bandwidth 0/17280 Mb/s
  available bandwidth for new DP tunnel 36000/18720 Mb/s
  0:6 <-> 1:11 (DP): activating
  0:6 <-> 1:11 (DP): bandwidth reduced to 5400 Mb/s x4 = 17280 Mb/s

Five consecutive replugs:

  time      tunnel 1 at tunnel 2 setup   avail. for t2   t2 reduced to   result
  19:29:34  DPRX done (17280)            18720           5400 x4         OK
  19:30:25  DPRX timeout (25920)         10080           2700 x4         split
  19:31:03  DPRX timeout (25920)         10080           2700 x4         split
  19:31:26  DPRX done (17280)            18720           5400 x4         OK
  19:32:00  DPRX timeout (25920)         10080           2700 x4         split

Effect on i915 (drm.debug=0x116)
--------------------------------
Split case: the DP-4 sink reports MAX_LINK_RATE 0x0a instead of 0x14.

  DPCD DP-3 (TC3): 12 14 c4 01 01 00 01 00 02 02 06 00 00 00 04
  DPCD DP-4 (TC4): 12 0a c4 01 01 00 01 00 02 02 06 00 00 00 04

  pipe B (DP-3): link 4x540000, pipe bpp 30,
                 port sync: master transcoder: <invalid>, slave transcoder bitmask = 0x0
  pipe C (DP-4): DP link limits ... max link 4x270000, pipe bpp 24,
                 port sync: master transcoder: <invalid>, slave transcoder bitmask = 0x0

Good case: both tiles at 4x540000 and pipe bpp 30, and port sync is
enabled (pipe B slave bitmask 0x4, pipe C master transcoder B).

Workaround tested
-----------------
Capping the bandwidth a new DP tunnel may reserve, in tb_tunnel_one_dp()
right after tb_available_bandwidth(), to 17280 Mb/s (HBR2 x4) fixes it.
Tunnel 1 is then reduced to HBR2 x4 straight away, so it is accounted at
17280 Mb/s even while its DPRX read is pending, and tunnel 2 always gets
HBR2 x4:

  available bandwidth for new DP tunnel 17280/17280 Mb/s
  0:5 <-> 1:11 (DP): bandwidth reduced to 5400 Mb/s x4 = 17280 Mb/s
  available bandwidth for new DP tunnel 17280/17280 Mb/s
  0:6 <-> 1:10 (DP): bandwidth reduced to 5400 Mb/s x4 = 17280 Mb/s

This was correct on 5 out of 5 replugs. The cap is from the out-of-tree
patch at https://github.com/mdimura/thunderbolt-dpcap-dkms, which
describes the same race with two 4K monitors on a TB4 dock. It is only a
workaround, though. A real fix would be to wait for the pending DPRX read
before sizing the next tunnel, or to re-expand a reduced tunnel once the
real consumption of the others is known.

I can provide full logs, the EDIDs of both tiles, or test patches.

Thanks



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 17:01 thunderbolt: second DP tunnel permanently reduced while first tunnel's DPRX read is pending (tiled 5K display comes up split) mrmrossi
2026-11-30 11:45 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox