Conversation
On an Apple NHI the interrupt throttle register (0xd004c) is not the one tb_ring_throttling() programs (0x38c00); the kernel's own ring activation writes it from ring->interval_nsec and skips the write when that field is zero. This module never set the field, so on Apple hosts the throttle was silently skipped and the register kept its firmware default -- measurable as a latency floor that does not move with message size (2 B through 4 KB all ~65.3 us on a USB4 link). Set ring->interval_nsec before activation for every ring on an Apple host (including native-backend rings toward a Linux peer: the NHI is Apple's regardless of the peer), log the before/after value, and guard the field access behind a Makefile compile probe so stock kernels still build. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Hydra reported failures for this PR.
Failed builds:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
On an Apple NHI the interrupt throttle register lives at
0xd004c, not thestock
0x38c00thattb_ring_throttling()programs. The kernel's own ringactivation writes the Apple one from
ring->interval_nsec, and skips thewrite when that field is zero — which it always was, because this module
never set it.
So on Apple hosts the throttle was silently skipped, the register kept its
firmware default, and the link carried a latency floor that did not move with
message size: 2 B through 4 KB all measured ~65.3 us (
ib_send_latacross aUSB4 link).
The change
ring->interval_nsecfor both rings beforetb_ring_start()on Applehosts. This is not gated on the peer's backend: the NHI is Apple's
regardless of who is on the other end of the cable, so native-backend rings
toward a Linux peer need it just as much. (
tbv_path_is_apple()isbackend-based and would skip exactly the leg that needs this.)
Makefilecompile probe(
TBV_HAVE_RING_INTERVAL_NSEC), so stock kernels — wherestruct tb_ringhas no such member — still build.
Measured
Before/after on the same link, same harness (
ib_send_lat, 2 B, warm floor):The stock-NHI half of the same fix (writing
0x38c00directly on a host whosekernel does not export
tb_ring_throttling()) is deliberately not in thisPR — it needs a
nhi_throttle_direct-style opt-in and its own discussion.Verified: builds against the Asahi 7.1.13 USB4 tree with no new warnings.
Context: found while bringing up RDMA over a USB4 cable between an Asahi
host and a stock-kernel AMD host. Write-up:
https://boracode.ai/blog/thunderbolt-no-incarnation