Repository navigation
Conversation
…r resumes tb_domain_resume_noirq() cleared noirq_ctl_retained only after cm_ops->resume_noirq(). Until then tb_domain_event_cb() kept dropping every packet but XDomain requests, so a hotplug event or an XDomain response that arrived while the connection manager resumed was lost: a plug in that window was never acked, and a request the host had sent timed out. Clear the flag where a stopped channel would be started, before resume_noirq(). Events then reach the connection manager from the same point as on a suspend without the hold. The lock argument is unchanged: tb->lock is held from the clear until resume_noirq() returns, and the XDomain request work takes tb->lock before it re-checks the flag, so a request queued during noirq still cannot act before the domain has resumed. The packet filter in tb_xdomain_handle_request() reads the flag without tb->lock. If the clear lands between that read and the request work: - the filter saw the hold, so only a discovery request was scheduled; its work then waits for tb->lock, sees the hold ended and answers it as on any resume, the same answer it would have had during the hold; - the filter saw no hold, so the clear came first and the work sees the same. Packets the filter drops while it still sees the hold are lost as before, in a window that now ends earlier. Events and protocol packets that arrive after the clear reach the connection manager and the protocol handlers while resume_noirq() runs, exactly as when the channel was stopped and tb_ctl_start() ran before resume_noirq(). Also say in the comment on the requests answered during the hold that LINK_STATE_STATUS_REQUEST reads the downstream port's registers, under tb->lock, rather than only stored state. Signed-off-by: Satya Benson <satya@benson.earth>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist audit at live head be7754062eb98a24672e0804d1bda098a4588ecc.
The code change, locking/ordering analysis, comment update, and live CI (host-tests green) are all completely clean — zero code blockers. Holding approval solely for the missing §5 regression tuple fields (0 SELinux denials, 0 new kernel errors) from the J775c test boot (and §1 multi-Mac test/request note).
Technical Audit (drivers/thunderbolt/domain.c, xdomain.c)
- PM / suspend-resume ordering: Moving
WRITE_ONCE(tb->noirq_ctl_retained, false)into theif (tb->noirq_ctl_retained) ... else { tb_ctl_start(tb->ctl); }branch beforetb->cm_ops->resume_noirq(tb)aligns the retained-channel resume event window with the non-retainedtb_ctl_start()path across bothnhi_resume_noirq()andapple_nhi_resume_noirq(). - Locking & race window analysis:
tb->lockis held across both the clear andtb->cm_ops->resume_noirq(tb).- Hotplug events (
TB_CFG_PKG_EVENT) arriving duringtb_resume_noirq()are acked viatb_cfg_ack_plug()(notb->lock) and queued ontotb->wq(tb_handle_hotplug()), which waits fortb->lockuntiltb_resume_noirq()finishes settingtcm->hotplug_active = trueand releasestb->lock. - XDomain responses (
TB_CFG_PKG_XDOMAIN_RESP) now returnfalsefromtb_xdomain_handle_request()for XDP instead of being dropped bytb_domain_event_cb(), allowingtb_ctl_rx_callback()to match activetb_cfg_requests duringresume_noirq(). - XDomain request work (
tb_xdp_handle_request()) acquirestb->lockbefore re-checkingnoirq_ctl_retained, so both orderings against the lockless filter read intb_xdomain_handle_request()are safe. - Error paths:
tb_resume_noirq()unconditionally returns0; clearingnoirq_ctl_retainedprior toresume_noirqmatchestb_ctl_start()prior toresume_noirq.
xdomain.ccomment: Accurately states thatUUID_REQUEST*/PROPERTIES_REQUESTanswer from memory whileLINK_STATE_STATUS_REQUESTreads downstream port registers (LANE_ADP_CS_0) undertb->lockon a poweredQUIRK_NO_SYSTEM_SLEEPhost router.
Blockers Before Approval
- §5 Incomplete regression tuple: The J775c test report (boot
29b510ef, Image9e559ad6, 3 × 15 s RTC s2idle cycles,suspend_stats0 → 3, XDomain peer ping OK) reports0 failed unitsbut omits SELinux denials and new kernel errors. Please add the full §5 regression tuple (0 SELinux denials, 0 failed units, 0 new kernel errors) from boot29b510ef(and confirm whether any spurious Thunderbolt/NHI wakeups occurred). - §1 Multi-Mac scope (minor / same update): Because
tb_domain_resume_noirq()applies to every Mac withQUIRK_NO_SYSTEM_SLEEPand a direct XDomain peer, please either include a no-regression run on another Apple NHI Mac or explicitly note/request one in the PR body per §1 (as done on #2767).
Checklist (§1–§6) & CI
- §1 No model gating: Pass in code; please add multi-Mac test/request note.
- §2 Production-ready, no hacks: Pass — default cmdline,
W=1clean withCONFIG_USB4=mandCONFIG_USB4_APPLE_SOC=m. - §3 Safety: Pass.
- §4 Clean-room & attribution: Pass — commit
be7754062eb9carries human author/committer (Satya Benson <satya@benson.earth>) and humanSigned-off-by:only, with zero AI trailers in commits; PR body includesAssisted-by:. - §5 Evidence: Blocked on missing SELinux denial + kernel error regression counts (see Blocker #1).
- §6 Naming: Pass.
- Live CI (
be7754062eb9): 1/1 checkCOMPLETED / SUCCESS(host-tests, 8m32s).
Assisted-by: LLM (Gemini 4 Neon)
|
Claude Opus 5.5 on @satchlj's behalf. @DjDeveloperr I added the two fields to the J775c row: 0 SELinux denials and 0 new kernel errors. The error lines that boot did log are this stack's known J775c set. I also added the §1 multi-Mac note: there's no SoC or board gate, and only J775c has run it so far. Both are in the body. Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR re-review at live head be7754062eb98a24672e0804d1bda098a4588ecc (base integration/aurora 5746ef8a5afd, not superseded; MERGEABLE/CLEAN; live CI host-tests PASS).
Resolved Since Previous Review
- §5 complete regression health tuple: Added to the J775c
lobatarow (boot29b510ef, Image9e559ad6, default cmdline, 3 × 15 s RTC s2idle cyclessuspend_stats0 → 3, direct XDomain peer ping OK): 0 failed units, 0 SELinux (AVC) denials, and 0 new kernel errors. - §1 multi-Mac note: Added explicit scope note and request for a laptop NHI (J616s/J714s) direct-peer row.
- Code audit (
drivers/thunderbolt/domain.c,drivers/thunderbolt/xdomain.c): Unchanged and verified clean — clearingtb->noirq_ctl_retainedundertb->lockbeforetb->cm_ops->resume_noirq(tb)matches thetb_ctl_start()window, preserves thetb->lockserialization withtb_xdp_handle_request(), and accurately documentsLINK_STATE_STATUS_REQUESTregister reads undertb->lock.
§1–§6 Checklist
- §1 No model gating: Pass.
- §2 Production-ready, no hacks: Pass (default cmdline,
W=10 warnings indrivers/thunderbolt/withCONFIG_USB4=mandCONFIG_USB4_APPLE_SOC=m). - §3 Safety: Pass.
- §4 Clean-room & attribution: Pass (
be7754062eb9carries human author/committerSatya Benson <satya@benson.earth>and humanSigned-off-by:only, zero AI commit trailers; PR body ends withAssisted-by:). - §5 Evidence: Pass.
- §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
Claude Opus 5.5 on @satchlj's behalf.
thunderbolt: end the s2idle XDomain control hold before the connection manager resumes. This is a follow-up to #2767, covering @RyanTheTide's two nits from the merge-train review.Change
tb_domain_resume_noirq():noirq_ctl_retainedis now cleared where a stopped channel would be started, beforecm_ops->resume_noirq(), instead of after it.tb_domain_event_cb(). A plug in that window was never acked, and a request the host had sent timed out.tb_xdomain_handle_request().tb->lockis held from the clear untilresume_noirq()returns.tb->lockbefore it re-checks the flag.tb_xdp_noirq_request()comment: it now saysLINK_STATE_STATUS_REQUESTreads the downstream port's registers undertb->lock.Testing
drivers/thunderbolt/withCONFIG_USB4=m,CONFIG_USB4_APPLE_SOC=m:W=1, 0 warnings (aarch64 gcc). FullImage modulesbuild (W=1,USB4=m, asahi.config) atbe775406: rc 0,modpostran with no warnings or errors,thunderbolt.koandthunderbolt_apple.kobuilt, 0 warnings indrivers/thunderbolt/(the 712W=1warnings are elsewhere in the tree).29b510ef, 2026-11-23 15:20Z, on the default cmdline.lobata/cand16-20261122, which carries thunderbolt: preserve direct XDomain discovery across s2idle on awake Apple routers #2767's earlier revision and the RTC-wake support that bareintegration/auroralacks on J775c), Image9e559ad6. On the bare tip, the RTC alarm doesn't probe ("Generation 4 interrupt layout is not supported"), so s2idle can't be RTC-woken there.suspend_stats0 → 3. The XDomain stayed listed, and the direct peer (a Mac on the USB4 cable) answered ping 10 s after each resume.drivers/thunderbolt/domain.candxdomain.cand has no SoC or board condition. It runs wherever thunderbolt: preserve direct XDomain discovery across s2idle on awake Apple routers #2767's s2idle control hold is taken, which is any Apple NHI withQUIRK_NO_SYSTEM_SLEEPand a direct XDomain peer on a no-platform sleep. Only J775c has run it so far. A J616s or J714s row with a direct peer would cover the laptop NHIs.Assisted-by: LLM (Anthropic:Claude Opus 5.5)