Repository navigation
thunderbolt, pmdomain: apple: tests for the s2idle control channel and the PMP fast-die effort - #2901
RyanTheTide wants to merge 2 commits into
Conversation
A host router that stays awake through suspend-to-idle keeps its control channel when every connection is another host, so that the peer's XDomain discovery is still answered. Nothing tests which suspends retain the channel or what gets through it while the domain is suspended. Add four cases to the thunderbolt suite: - tb_xdp_noirq_request() admits the UUID, properties and link state status requests and no other packet type; - tb_domain_retain_noirq_control() retains only for a suspend-to-idle of a host router with QUIRK_NO_SYSTEM_SLEEP that has an XDomain and no router behind any port; - tb_domain_suspend_noirq() and tb_domain_resume_noirq() leave a retained control channel alone, retain nothing when the connection manager refuses the suspend, and tb_domain_event_cb() drops every event but an XDomain request until the domain has resumed; - tb_xdomain_handle_request() consumes service protocol packets, responses and state-changing discovery requests while retained, without calling a handler or queueing work. The domain in these cases has no control channel, so a path that stops or starts a retained one faults. tb_domain_event_cb(), tb_domain_retain_noirq_control() and tb_xdp_noirq_request() become VISIBLE_IF_KUNIT for this; they stay static without CONFIG_KUNIT. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
apple_pmp_report_fast_die_effort() and the T8142 report layout have no test. A wrong lane shift, a missed "PMP is running" check or a 32-bit read of the T8142's 16-byte entry would hand a CPU cluster the wrong thermal effort, or none. Add the apple-pmp-fast-die suite, on a report in memory published the way probe publishes it: - each lane is one byte of the low word, read 32 or 64 bits wide, and a lane past the report's count is -EINVAL with nothing stored; - a stopped PMP gives -EAGAIN, and status bits other than "ready" count as running only where the SoC's table says so; - the report is found by its node (-EPROBE_DEFER when none is bound) and one without the entry gives -EOPNOTSUPP; - the T8142 table matches its PMP's entry numbers: status 1, fast die 15 (two lanes, wide), device requests 39, acknowledgments 47, DVFS 55..70. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Non-author review of f925bef + 005b8bb. Verdict: no blocker. I read the code; I didn't run the KUnit suites myself. Checked and holding
Points
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial pre-PR checklist (§1–§6) review at 005b8bbfd59868ec13d3804f92187553c05535c0 (CI: 7/7 green — kunit, host-tests, rust-build, source, and all 3 DWC3/ATC builds; MERGEABLE / CLEAN).
Verdict: APPROVE — 0 blockers. Ready for MERGETRAIN-LINUX4.
Audit summary
- Non-test surface: Minimal and clean — only marks
tb_domain_event_cb(),tb_domain_retain_noirq_control(), andtb_xdp_noirq_request()VISIBLE_IF_KUNITwith matching declarations inside#if IS_ENABLED(CONFIG_KUNIT)indrivers/thunderbolt/tb.h(staysstaticwhenCONFIG_KUNIT=n;test.clinks intothunderbolt). - Test correctness & hygiene:
drivers/thunderbolt/test.c:tb_test_noirq_alloc()skips cleanly if!IS_ENABLED(CONFIG_SUSPEND), saves/restorespm_suspend_global_flagsand drops the domain device reference viakunit_add_action_or_reset(), and unregisters the synthetic protocol handler via KUnit action. All four cases matchdomain.c/xdomain.csemantics accurately.drivers/pmdomain/apple/pmp-report-start-test.c: synthetic report is registered and removed viaapple_pmp_reports_lock+list_del_rcu()+synchronize_rcu()in a KUnit action; covers 32/64-bit reads, lane bounds,running_any,-EPROBE_DEFER,-EOPNOTSUPP, and T8142 table offsets.- Strong negative control evidence: 91/91 arm64 QEMU KUnit tests pass with KASAN + lockdep, 27/28 single-line mutants caught,
checkpatch --strictandW=1clean with/withoutCONFIG_KUNIT.
- Minor non-blocking nits: (1) relying on a NULL
tb->ctldereference to catch a mutant that touches a retained control channel will oops the KUnit thread rather than record a clean assertion failure; (2)pmp_fast_die_t8142_test()pins the driver table as a regression guard rather than validating hardware independently. Neither blocks merge.
§1–§6 Checklist Summary
- §1 No model gating: Pass (tests only; no driver gating added).
- §2 Production-ready: Pass (no hacks, no new params, CI 7/7 green).
- §3 Safety: Pass (in-memory fake domain/report only; proper cleanup actions).
- §4 Clean-room & attribution: Pass (both commits carry human author/committer + human
Signed-off-by:only, zero AI trailers in commits,Assisted-by:in PR body). - §5 Evidence: Pass for scope (tests-only; hardware row N/A; thorough KUnit + KASAN/lockdep + 27/28 mutant verification).
- §6 Naming: Pass.
Assisted-by: LLM (Gemini 4 Neon)
|
Review at 005b8bb. Second, non-author pass. I tried to break the tests by reading them against the code. I couldn't run KUnit: no buildslot came free in 30 minutes. Verdict: nits. Nothing blocks, but point 1 is the behaviour linux#2767 exists for, so it's worth fixing before merge.
We'll post the KUnit numbers plus the two mutants above once a buildslot frees up (configs saved). |
Problem
Two recently merged changes have no test:
apple_pmp_report_fast_die_effort()picks a cluster's thermal effort out of that entry and has no test either.Change
Tests only, two commits.
thunderbolt: four cases in the existing suite. They cover the packet types answered while suspended, the retain decision (suspend-to-idle, awake host router, an XDomain and no router behind any port), suspend/resume with a retained channel including a refused suspend, and the XDomain dispatch dropping service packets, responses and state-changing requests without calling a handler or queueing work.pmdomain: apple: pmp-report: a newapple-pmp-fast-diesuite of four cases on a report held in memory. They cover the lane bytes at both read widths, the lane bound, the "PMP is running" rule, lookup by node, reports without the entry, and the T8142 table against its entry numbers.The only non-test change:
tb_domain_event_cb(),tb_domain_retain_noirq_control()andtb_xdp_noirq_request()becomeVISIBLE_IF_KUNIT. WithoutCONFIG_KUNITthey are static as before.Testing
checkpatch.pl --strictclean on both patches; W=1 clean for the touched objects with and withoutCONFIG_KUNIT.Still to run
Nothing on hardware: the tests need none. #2756 (G15 short-prefix VM order) is not covered here; its pick logic needs a live device to build its inputs, so a test would need a small refactor first.
Mutant table
pmp-lane-shiftpmp-lane-boundpmp-no-running-checkpmp-running-any-ignoredpmp-running-any-alwayspmp-wide-upper-halfpmp-wide-ignoredpmp-no-node-matchpmp-einval-before-eopnotsupppmp-t8142-fast-die-offsetpmp-t8142-not-widepmp-t8142-write-offsetpmp-t8142-lanespmp-t8142-no-matchtb-xdp-allows-properties-changedtb-xdp-refuses-link-state-statustb-retain-ignores-remotetb-retain-without-xdomaintb-retain-ignores-quirktb-retain-ignores-platformtb-event-filter-removedtb-xdomain-accepts-responsestb-xdomain-accepts-servicestb-xdomain-queues-any-requesttb-resume-keeps-flagtb-suspend-never-flagstb-retain-after-failed-suspendtb-resume-starts-retained-ctlHow it was run
kunitconfig:
KUNIT,PCI,PM,SUSPEND,OF,ARCH_APPLE,USB4,USB4_KUNIT_TEST,APPLE_PMP_REPORT,APPLE_PMP_REPORT_START_KUNIT_TEST,DEBUG_KERNEL,PROVE_LOCKING,KASAN.The test domain has no control channel, so a path that stops or starts a retained one is a NULL dereference that KASAN reports and KUnit records as a failed case.
Assisted-by: LLM (Claude:Opus 5.5), LLM (Claude:Fable 5.2)