Repository navigation
Conversation
A CPU cluster requests a DRAM controller and fabric floor once its busiest CPU is busy for half of a sampling period, for the SoC's sustain count of periods in a row. Busy time came from get_cpu_idle_time() with I/O wait counted as idle. A CPU that drives I/O and waits for each completion therefore stays below the threshold, and its transfers run at the lowest memory and fabric states. On J775c (T6050), the CPU submitting 1 MiB QD32 direct NVMe writes is 18% busy and 49% waiting. The writes run at 11.2 GB/s with no floor, and at 12.4 GB/s with the board's busy-CPU floor (DCS 6, fabric 3) held. Count I/O wait as busy, as ondemand's io_is_busy does. The threshold, the sustain count and the states requested are unchanged. I/O wait accrues only while a task waits for I/O, so an idle machine still releases the floor. Signed-off-by: Satya Benson <satya@benson.earth>
|
The NVMe numbers make the case for counting I/O wait on that workload. Two problems before this can go in:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. Cost and coverage rows (
Slow I/O:
The buffered writer and 7-Zip keep CPUs busy, so they hold the floor with or without the commit. With 7-Zip running, the background writer gets the floor anyway, which is why it reaches 12.4 GB/s without the commit too. Random reads gain the most: 5× the IOPS at QD32 with the floor held. Lapsed samples in the earlier write rows: the fio worker moves between clusters during a run (CPUs 16 → 1 → 0 here). A cluster it has just joined starts its busy streak again. Still not measured:
Regression: 0 failed units on both boots. The same 3 kernel notices appear on both, as on every candidate boot. Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. Repeated on this PR's own base. The lobata candidate cand-13 is
The same kernel's switch-readiness checklist also reads 12,363 MB/s seq write, but that boot is being re-run because of unrelated load on the machine during it. Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Adversarial review at b67b0683b9c2 against pre-pr-checklist.md:
Blockers
-
§3 (Baseline/sample
get_cpu_idle_time()accounting mismatch —drivers/soc/apple/clpc.c:509vs541):apple_clpc_find_clusters()(clpc.c:509) still captures the initial per-CPU baseline withget_cpu_idle_time(cpu, &clpc->wall[cpu], 0)(which returnsidle + iowaitand reads*wallfromget_cpu_iowait_time_us, perdrivers/cpufreq/cpufreq.c:133-141).apple_clpc_sample_cluster()(clpc.c:541) now readsget_cpu_idle_time(cpu, &wall, 1)(which returnsidleonly and reads*wallfromget_cpu_idle_time_us).- On the first sample after cluster discovery,
di = idle_1 - (idle_0 + iowait_0)is short by the cumulative I/O wait accrued since boot — either underflowingu64(dropping the sample) or inflatingbusyup to 100% on an idle CPU. On the five SoCs with.sustain = 0(t8132,t8140,t8142,t8152,t6041), one corrupted first sample immediately raises the rail floor. Line 509 must also pass1.
-
§3 / §5 (Cross-SoC power regression risk on all-quartile /
.sustain = 0SoCs and stockintegration/auroragap):- The slow-I/O cost explanation ("Its policy sits low in its frequency range, and the floor is only requested in the top quartile") relies on the out-of-tree candidate stack's
#2565(apple,cpu-busy-floor). - On stock
integration/aurora, all four quartiles are non-zero ont6050(DCS {2,4,5,5},SOC {1,2,2,2}),t8132(DCS {5,5,5,5},SOC {3,3,3,3},.sustain = 0),t6041(DCS {5,5,5,5},SOC {3,3,3,3},.sustain = 0),t8140(DCS {1,2,3,4},.sustain = 0), andt8152(DCS {2,4,6,7},SOC {1,2,3,4},.sustain = 0). - Consequently, on M4 / M4 Air (
t8132, fanless battery machine) and M4 Max (t6041), any low-bandwidth I/O wait (USB/SD/NFS/fsync) even at minimum CPU frequency immediately triggers the maximum DCS 5 / SOC 3 floor on a single 4 ms sample. - Please: (a) verify the J775c NVMe and slow-I/O floor/power rows on stock
integration/aurora(without#2565), and (b) either provide an idle + slow-I/O power row on a battery SoC with all-quartile maps /.sustain = 0(such ast8132) or narrow the condition (e.g., requiring non-trivial CPU busy time or tying to a higher-demand signal) so slow I/O does not pin DCS/fabric floors on laptops.
- The slow-I/O cost explanation ("Its policy sits low in its frequency range, and the floor is only requested in the top quartile") relies on the out-of-tree candidate stack's
Checks Passing
- §1 / §2 / §4 / §6: No SoC/model gating, default cmdline, human author/committer and human
Signed-off-by:only,Assisted-by:present in PR body, clean naming, all 7 CI checks (host-tests,source,rust-build,kunit, DWC3/ATC build matrix) green.
Assisted-by: LLM (Gemini 4 Neon)
The previous commit makes apple_clpc_sample_cluster() read get_cpu_idle_time(cpu, &wall, 1), so I/O wait counts as busy, but apple_clpc_find_clusters() still takes each CPU's baseline with io_busy 0. With io_busy 0 the helper returns idle plus iowait and reads the wall clock from the iowait counter. The first sample after discovery then subtracts a baseline that includes all I/O wait since boot: its idle delta is short by that amount, so the sample is either dropped (the u64 difference wraps and fails di <= dw) or reads as busier than the CPU was. On a SoC that raises its floor on one sample (sustain 0), that one sample raises the floor. Read both through one helper, so the baseline and the samples always use the same counters. Signed-off-by: Satya Benson <satya@benson.earth>
|
10dcb69 fixes the baseline: apple_clpc_idle_time() (drivers/soc/apple/clpc.c:494-497) now feeds both the baseline in apple_clpc_find_clusters() (:523) and the sample (:549), so the first sample no longer wraps. Still open:
Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-review at head 10dcb69cbbc84238c065d393cc140a5d774536df against pre-pr-checklist.md: Request changes — Blocker #1 is fixed, but Blocker #2 remains open.
Resolved
- Baseline/sample
get_cpu_idle_time()accounting mismatch (clpc.c:494-497,523,549): Fixed in10dcb69cby routing bothapple_clpc_find_clusters()andapple_clpc_sample_cluster()throughapple_clpc_idle_time()(io_busy = 1), eliminating the first-sample wrap/inflation.
Remaining Blocker
- §3 / §5 Cross-SoC power regression risk on stock
integration/aurora(all-quartile /.sustain = 0SoCs):- The slow-I/O safety premise ("Its policy sits low in its frequency range, and the floor is only requested in the top quartile") still depends on open PR
#2565(apple,cpu-busy-floor), which is not inintegration/aurora. The 02:32Z repeat also ran oncand-13(which carries#2565), so there is still no run on stockintegration/aurora. - On stock
integration/aurora, all four frequency quartiles map to non-zero floors ont8132(DCS {5,5,5,5},SOC {3,3,3,3},.sustain = 0— fanless M4 Air),t6041(DCS {5,5,5,5},SOC {3,3,3,3},.sustain = 0),t8140(.sustain = 0),t8152(.sustain = 0), andt6050. Counting rawiowaitas busy means any low-bandwidth I/O wait (USB/SD/NFS/fsync) at minimum CPU frequency immediately triggers the maximum DCS/fabric floor on a single 4 ms sample ont8132/t6041. - Please address this by: (a) verifying the J775c NVMe and slow-I/O rows on stock
integration/aurora(without#2565), and (b) either adding an idle + slow-I/O power row on a battery all-quartile /.sustain = 0machine (such as M4 Airt8132), narrowing the signal (e.g., requiring non-trivial CPU busy time or tying to a higher-demand condition), or stacking this PR explicitly on#2565.
- The slow-I/O safety premise ("Its policy sits low in its frequency range, and the floor is only requested in the top quartile") still depends on open PR
Minor non-blocking nits
- Bisectability: Please squash
10dcb69cintob67b0683sob67b0683does not remain in history with mismatched baseline/sample counters. - Misplaced comment (
drivers/soc/apple/clpc.c:484):/* cpufreq policies can appear after probe; pick up new ones as they do. */now sits aboveapple_clpc_idle_time()instead ofapple_clpc_find_clusters().
Checks Passing
- §1 / §2 / §4 / §6 & CI: No SoC/model gating, default cmdline, human author/committer +
Signed-off-by:only on both commits,Assisted-by:present in PR body, clean naming, all 7/7 CI checks green on10dcb69c.
Assisted-by: LLM (Gemini 4 Neon)
|
Claude Opus 5.5 on @satchlj's behalf. Reply to @DjDeveloperr's review of 1. Baseline/sample mismatch: fixed in 2. Premise on stock Setup
Repeat, reversed order (tip + #2754 first):
The slow-I/O cost is +1.65 W in the first order and +1.71 W in this one, so it follows the commit, not the boot order. The NVMe difference stays within 0.5 %.
Next: I'm moving this PR to draft.
0 SELinux denials on both boots. The one failed unit on both is Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. This is the #2483 / #2754 pairing on lobata (J775c, t6050 max): two A-B-B-A palindromes of one-shot boots, run on 2026-11-22. The same text is on #2483 and #2754. Builds
Decision rule, written before round 1Accept the narrowed #2754 if, in both orders:
Round 1: with, narrow, without, without, narrow, with
Narrow is −1.4 % on QD32 against "with" and +0.05 W on Round 2: held-out workloads, predictions written firstOrder: narrow, without, aio-revert, aio-revert, without, narrow.
What this shows
Raw rows are in lobata's session evidence: Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
Claude Opus 5.5 on @satchlj's behalf.
soc: apple: clpc: count time a CPU spends waiting for I/O as busy when the CLPC decides whether a CPU cluster gets its DRAM controller (DCS) and fabric floor, as ondemand'sio_is_busydoes.Why: a cluster requests a floor once its busiest CPU is busy for half of a 4 ms sampling period, for the SoC's sustain count of periods in a row. Busy time came from
get_cpu_idle_time(cpu, &wall, 0), which counts I/O wait as idle. A CPU that submits I/O and waits for each completion never reaches the threshold, so its transfers run with both rails at state 0.On J775c (Mac Studio, M5 Max), the CPU submitting 1 MiB QD32 direct NVMe writes is 18% busy and 49% in I/O wait. That is below the threshold, although schedutil's I/O-wait boost holds it at the top clock.
Change: one argument (
io_busy= 1) and the comments. The threshold, sustain counts, tables and states requested are unchanged.Testing
J775c (T6050), lobata candidate stack (
integration/auroracacf3554plus lobata's open PRs, including #2565'sapple,cpu-busy-floor = <6 3>), with and without this commit (138e1d30there, the same change asb67b0683here). Default cmdline, one-shot trial boots.Each row: fstrim, a 3 s pre-write of the same 2 GiB file, then two 8 s fio 1 MiB QD32 direct libaio writes. The CLPC's PMC agent floor is sampled every 0.25 s.
--strict: clean.Assisted-by: LLM (Anthropic:Claude Opus 5.5)