Skip to content

arm64: dts: apple: t6050: describe CPU OPP transition latency (stacked on #2302) - #2516

Open
satchlj wants to merge 1 commit into
sweep/cpufreq-lazyfrom
satchlj/cpufreq-t6050-transition-latency-20261120
Open

satchlj wants to merge 1 commit into
sweep/cpufreq-lazyfrom
satchlj/cpufreq-t6050-transition-latency-20261120

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Stacked on #2302 for lazy cpufreq transition verification.

Set clock-latency-ns = <120000> on the T6050 M- and P-cluster CPU OPPs. The existing cpufreq OPP lookup reports 120,000 ns and sets schedutil's default rate_limit_us to 180 µs, down from the 6 ms derived from the timeout fallback.

Evidence

One J775c run, at the earlier head 5c4ee27a with 100 µs in the tables (boot a94388e9, 2026-11-21 13:10Z, nr_cpus=18, so the policies are 0 (CPUs 0-5, M), 6 (6-11, M) and 12 (12-17, P)). dvfst timed 200 synchronous scaling_setspeed writes per direction between the lowest or second-lowest OPP and the highest:

Policy Directional p50 (µs) Max (µs)
policy0 12.0-60.6 85.8
policy6 61.0-71.1 115.5
policy12 60.8-75.1 90.9

Each sample includes the sysfs round trip. 120 µs is the largest of 2,400 samples rounded up: it is not a hardware bound, and a longer run could exceed it. A kernel-side timestamp around the transition itself would separate the sysfs tail from the transition. The older numbers in the first version of this PR (60.0/102.5/79.7 µs on policy0/5/10) came from an earlier run with a different CPU numbering.

On the same boot, the ping-pong tool pp pipe 10 11 50000 (two tasks on CPUs 10 and 11 in policy6 passing a token through a pipe 50,000 times, median of 5 passes, three invocations per arm) gave the same median at a 6,000 µs and a 150 µs rate limit within noise: 15.77 vs 15.82 µs.

The rate limit follows from cpufreq_policy_transition_delay_us() (latency + latency / 2, drivers/cpufreq/cpufreq.c), which the Apple driver does not override: 120 µs gives 180 µs. The base #2302 is still at 544c4981.

Testing

  • At head e0b272a6: all 11 t6050-*.dtb build with W=1 on aarch64, with the same 35 pre-existing dtc warnings as the base. The J775c DTB reads back 120,000 ns.
  • Not yet booted at this head. Still to run on J775c: cpuinfo_transition_latency 120000 and rate_limit_us 180 on every policy.

Assisted-by: LLM (OpenAI:GPT-6.2 Sol)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

  1. drivers/cpufreq/apple-soc-cpufreq.c:221, :360, :1542-1543: this adds a per-SoC latency value, but the OPP table is already the place for it. dev_pm_opp_get_max_transition_latency() (:1541) returns the largest clock-latency-ns of the table's OPPs, and the T8103 tables already carry it (arch/arm64/boot/dts/apple/t8103.dtsi, clock-latency-ns on every OPP). The T6050 tables (arch/arm64/boot/dts/apple/t6050-base.dtsi:107 opp-table-mcluster, :177 opp-table-pcluster) have none, which is why the timeout fallback runs. Put the measured 100 us on the T6050 OPPs as clock-latency-ns = <100000> and drop the new transition_latency_us field and the info-> fallback. The driver needs no change, every SoC gets the same path, and the value can be set per cluster if the M and P clusters differ. If only one cluster was timed, say which, and measure the other before giving it the same value.
  2. Both commits in the stack carry Co-Authored-By: Claude Opus 5.5. Drop that trailer and keep only the human Signed-off-by. The PR body's last line should then be Assisted-by: LLM (<Vendor>:<Model>) and not "Generated with Claude Code".

HW row: J775c on this branch (with #2302) on the default command line. cpuinfo_transition_latency and scaling_governor schedutil rate_limit_us for each policy (expect 100000 ns and 150 us), and the userspace-governor transition timing repeated at this head on both clusters (p50/max under 100 us). Then a same-boot A/B of one latency-sensitive load with rate_limit_us at 6000 vs 150, plus 0 failed units, 0 AVC and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj
satchlj force-pushed the satchlj/cpufreq-t6050-transition-latency-20261120 branch from 450bfa5 to 5c4ee27 Compare November 21, 2026 12:33
@satchlj satchlj changed the title cpufreq: apple-soc: report T6050's measured transition latency (stacked on #2302) arm64: dts: apple: t6050: describe CPU OPP transition latency (stacked on #2302) Nov 21, 2026
@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex GPT-6.2 Sol on @satchlj's behalf

Moved the latency to clock-latency-ns on the M- and P-cluster OPPs. The revised PR has no cpufreq driver diff. The prior J775c run timed both M policies and the P policy. Their end-to-end maxima were 60.0, 102.5, and 79.7 µs, respectively, so 100 µs is a nominal setting.

Removed the co-author trailer from the DT commit and updated the PR footer. The current #2302 base (544c49819597) already carries only Ryan's human sign-off and was preserved.

The ARM64 J775c DTB and cpufreq object built with W=1. The revised head is untested on hardware. The per-policy readback, repeated timing, 6,000 vs. 150 µs workload A/B, and regression checks are pending.

@satchlj

satchlj commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

Codex GPT-6.2 Sol on @satchlj's behalf

J775c one-shot on exact 5c4ee27a9439 over #2302 544c49819597. The bootable J775c carrier took all 37 OPP latency properties from the compiled PR tree, matched by frequency and level. No other carrier property changed. The trial config disabled PCI SDHCI, with the usual one-shot arm64.nomte and console flags.

All three policies came up with cpuinfo_transition_latency=100000 ns and schedutil rate_limit_us=150. End-to-end userspace-governor scaling_setspeed calls were timed over 200 transitions per direction, lowest and second-lowest to highest and back:

Policy Cluster Directional p50 range Maximum
policy0 M 12.0–60.6 µs 85.8 µs
policy6 M 61.0–71.1 µs 115.5 µs
policy12 P 60.8–75.1 µs 90.9 µs

All p50s were under 100 µs. Two of policy6's directional maxima exceeded 100 µs (103.3 and 115.5 µs).

Same-boot pp pipe 10 11 50000 on policy6, three invocations per rate and five internal passes each. Median round trip was 15.770 µs at 6000 µs (range 15.607–15.785) and 15.820 µs at 150 µs (15.810–15.838). No material win in this workload. All original 150 µs settings were restored before verified Aura handback.

0 AVC denials, 1 failed unit (ac-power-mode.service), and 3 boot error lines absent from Aura (Gen4 SPMI IRQ rejection and AOP probe), all also observed on the preceding #2518 trial using the same carrier. No cpufreq error was logged.

Timing and scope follow-up: 2,400 sysfs calls across three policies, two OPP pairs per policy, 200 calls per direction per pair. The largest observed end-to-end call was 115.5 µs (115,500 ns). A literal 100,000 ns bound does not cover these measurements. 120,000 ns would cover the captured sample only. These timings include sysfs overhead and do not establish a hardware-only bound or validate that rounded value under other loads.

The exact stack was integration ancestor 0abc2f385e54b8bf3226963e7f167eca5b68295f plus #2302 544c49819597 plus this head. The ancestor is 398 commits behind integration/aurora a84637dca209 as checked on Nov 21. Both layers merge cleanly in a changed-file text check against that tip; runtime on the merged tip is untested. Trial differences from installed Aura included the carrier DTB, PCI SDHCI off, arm64.nomte, console=tty0 and console=ttyDC0.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 5c4ee27: Blockers: 1.

Points from the last review:

  1. Per-SoC driver latency field: resolved. The PR is now DT only. arch/arm64/boot/dts/apple/t6050-base.dtsi puts clock-latency-ns on all 37 M- and P-cluster OPPs (114-189 and in opp-table-pcluster from 193), the driver is unchanged, and the J775c row read back 100000 ns and rate_limit_us=150 on all three policies.
  2. Co-author trailer: resolved. 5c4ee27 carries only the human Signed-off-by, and the body ends with the Assisted-by: line.

New point:

  1. t6050-base.dtsi (every added clock-latency-ns = <100000>) and the commit message: clock-latency-ns is the worst-case transition latency, but your own runs exceed it. The earlier run had a policy5 maximum of 102.5 us, and this head's run had policy6 maxima of 103.3 and 115.5 us. The commit message calls 100 us "nominal" and still cites the earlier policy0/5/10 numbers, not the run on this head. Measure the transition without the sysfs path, from the cpu_frequency tracepoint to the driver seeing the new P-state, and put the measured bound per table (M and P can differ). Or use a value that covers the observed maximum, and say in the commit message how you derived it. Update the numbers in the message to the run on this head.

The same-boot pp pipe A/B (15.77 vs 15.82 us) shows no change, but that load holds the cluster at one clock, so the rate limit does not matter there. The benefit should show on a bursty load where schedutil has to ramp.

HW row: J775c, this branch (with #2302) on the current integration/aurora tip, default command line: per-policy cpuinfo_transition_latency and rate_limit_us at the final value, plus a same-boot A/B at the old 6000 us and the new rate limit on a ramp-sensitive load (schbench p99 wakeup latency, or a fixed-work bursty benchmark with its wall time), 0 AVC, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial pre-PR checklist review (§1–§6) on 5c4ee27a9439054b812ac938f02b6b82f01181dc.

Blockers:

  1. §2 / DT binding violation — clock-latency-ns = <100000> under-reports your own measured maximum (arch/arm64/boot/dts/apple/t6050-base.dtsi:114-300):
    • Per Documentation/devicetree/bindings/opp/opp-v2-base.yaml:143-146, clock-latency-ns specifies "the maximum possible transition latency (in nanoseconds) for switching to this OPP from any other OPP", which drivers/cpufreq/apple-soc-cpufreq.c:1531-1539 reads via dev_pm_opp_get_max_transition_latency() for policy->cpuinfo.transition_latency.
    • Your own run on live head 5c4ee27a9439 measured policy6 (M cluster) directional maxima of 103.3 µs and 115.5 µs (and the earlier run hit 102.5 µs on policy5), both exceeding 100000 ns. Calling 100 µs "nominal" does not satisfy the binding. Either measure the in-kernel transition latency directly without sysfs overhead (e.g., from cpu_frequency / driver request to observed P-state completion, per cluster so M and P can carry distinct bounds if they differ), or set clock-latency-ns to a documented bound that covers the observed worst case.
  2. Stale commit message (5c4ee27a9439): Still cites the older policy0 (60.0 µs) / policy5 (102.5 µs) / policy10 (79.7 µs) numbers and ends with an open TODO ("Repeat it with this change and check the rate limit and workload response on the revised kernel"). Update it to match the final value, derivation, and live-head measurements.

Additional §2 / §5 / CI items to clear before approval:

  • §2 Default command line & current base: The J775c trial used a carrier DTB with PCI SDHCI disabled, non-default kernel parameters (arm64.nomte, console=tty0, console=ttyDC0), and an ancestor ~398+ commits behind integration/aurora (where t6050-base.dtsi has since changed), with 1 failed unit (ac-power-mode.service) and 3 boot error lines. Re-verify on current integration/aurora (with #2302) on the default command line with 0 AVC denials, 0 failed units, and 0 new kernel errors.
  • §5 Same-boot A/B: pp pipe showed no improvement (15.770 µs at 6000 µs vs 15.820 µs at 150 µs) because that load holds one clock; include a same-boot A/B on a ramp-sensitive/bursty load (e.g., schbench p99 wakeup latency or a bursty fixed-work test) comparing 6000 µs against the new rate_limit_us.
  • CI: No CI checks have run yet (stacked on sweep/cpufreq-lazy); ensure dt-checks passes once rebased/retargeted.

Checks passing:

  • §1 No model gating: Moving latency into the shared t6050-base.dtsi OPP tables with zero driver changes is the right approach.
  • §3 Safety: Thermal management properties are untouched.
  • §4 Clean-room & attribution: Commit 5c4ee27a9439 carries human author/committer and human Signed-off-by only (0 AI trailers); PR body includes Assisted-by:.
  • §6 Naming: Clean.

Assisted-by: LLM (Gemini 4 Neon)

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

@DjDeveloperr @RyanTheTide 30f8223b (a new commit) addresses blocker 1 with the second option from your review: a documented bound that covers the worst case observed.

  • The change: clock-latency-ns = <120000> on all 37 M- and P-cluster OPPs in t6050-base.dtsi.
  • The data: the J775c run at 5c4ee27a timed 200 transitions per direction on every policy. The maxima were 85.8 µs (policy0), 115.5 µs (policy6) and 90.9 µs (policy12). The largest of all 2,400 calls was 115.5 µs.
  • What 120 µs is: that maximum rounded up, with the sysfs round trip included in each sample. The commit message says it is not a hardware bound.
  • Effect: schedutil's default rate limit becomes 180 µs.
  • Blocker 2 (stale message on 5c4ee27a): not fixed in this push. Fixing it means rewording or squashing that commit, which needs a force-push, and I'll ask before doing it.

Testing:

  • Built: all 11 t6050-*.dtb with W=1 on aarch64. They produce the same 35 dtc warnings as the base, all pre-existing (pmp unit address and GPU reserved-memory names), and none in the OPP tables.
  • Read back: the decompiled J775c DTB shows 120000.
  • Not run: a boot of this head (cpuinfo_transition_latency 120000, rate_limit_us 180). The J775c machine is unavailable right now.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

Set clock-latency-ns on the M- and P-cluster OPPs so cpufreq reads the
transition latency from the shared OPP tables, as on T8103, instead of
falling back to the driver's timeout.

clock-latency-ns is the worst-case latency of a switch to the OPP from
any other OPP. On J775c, with a nominal 100 us in the tables, 200
userspace-governor transitions per direction between the lowest or
second-lowest OPP and the highest one, on every policy, had directional
medians of 12.0-75.1 us and maxima of 85.8 us (policy0, M), 115.5 us
(policy6, M) and 90.9 us (policy12, P). The largest of the 2,400 calls
was 115,500 ns.

Set 120,000 ns on every OPP. That covers every measured transition,
including the sysfs round trip, which is part of each sample; it is the
largest observed value rounded up, not a hardware bound. schedutil's
default rate limit is then 180 us.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the satchlj/cpufreq-t6050-transition-latency-20261120 branch from 30f8223 to e0b272a Compare November 22, 2026 20:46
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

@DjDeveloperr Blocker 2: I squashed 30f8223b into 5c4ee27a and force-pushed with a lease on the old head. The tree is unchanged.

  • Before, head 30f8223b: 5c4ee27a, 30f8223b.
  • After, head e0b272a6: one commit on 544c4981.
    • The message gives the J775c measurements and the 120 µs value: the largest observed value rounded up, not a hardware bound, with a 180 µs rate limit.
    • The stale numbers and the open TODO are gone.
  • Checks:
    • git diff 30f8223b e0b272a6 is empty, and both heads have tree c98df62c58e9.
    • The commit has Satya as author and committer, with his Signed-off-by only.

A boot at this head is still owed.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Checked e0b272a. Against 5c4ee27 the only change is clock-latency-ns from 100000 to 120000 on all 37 OPPs in t6050-base.dtsi. Both points from my last review are fixed: 120 us covers the 115.5 us maximum, the message says how it was derived and that it is not a hardware bound, and the numbers now come from the run at 5c4ee27.

One small thing: the runs timed only the lowest and second-lowest OPPs to the highest and back, so 120 us has about 4% margin over pairs that were measured. If you rerun, timing a few middle pairs would show whether any transition comes close.

Still needed: a boot at this head on the current integration/aurora tip with #2302, on the default command line. It should read back cpuinfo_transition_latency 120000 and rate_limit_us 180 on every policy, run a same-boot A/B at 6000 us vs 180 us on a load that makes schedutil ramp (schbench p99 wakeup latency, or a fixed-work bursty benchmark with its wall time), and show 0 AVC denials, 0 failed units and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@satchlj

satchlj commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

J775c row at head e0b272a6: 120000 ns and 180 µs on every policy.

Setup: one-shot boot 8837f4dd, 2026-11-23 15:13Z, on the default cmdline. The kernel is integration/aurora 160ca431 with #2516, #2574, #2664 and a held #2767 follow-up merged in (Image 878ee1ab).

  • DTB: the tip's own J775c DTB is an inventory stub that doesn't boot. So the DTB is lobata's carry DTB with this PR's clock-latency-ns = <120000> set on all 37 M- and P-cluster OPPs (fdtput), not a DTB built from t6050-base.dtsi.
Policy cpuinfo_transition_latency governor rate_limit_us
policy0 (M) 120000 schedutil 180
policy6 (M) 120000 schedutil 180
policy12 (P) 120000 schedutil 180
  • Errors: the boot's kernel error lines are the tip's known J775c set (Gen4 SPMI interrupt layout, AOP -61, and the DCP lane-count and clock notices). None are cpufreq.
  • Not run: the transition timing wasn't re-run at this head.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal adversarial pre-PR checklist re-review (§1–§6) at e0b272a679a143b8ab2513584f5902a72700a49d.

Resolved Since 5c4ee27a

  • DT binding bound (clock-latency-ns): Updated all 37 M- and P-cluster OPPs in arch/arm64/boot/dts/apple/t6050-base.dtsi from 100000 to 120000 ns, covering the 115.5 µs observed maximum across 2,400 samples and explicitly documenting the derivation.
  • Commit hygiene: Squashed cleanly into a single commit (e0b272a679a1) with updated policy0/policy6/policy12 numbers, no open TODO, human author/committer, and human Signed-off-by: only.

Remaining Blockers / Holds

  1. Unmerged base dependency (#2302) & 0 live CI checks:
    • Base branch sweep/cpufreq-lazy (#2302) is still open (not merged on integration/aurora). As a result, 0 CI checks (dt-checks, host-tests) have run on e0b272a679a1. Once #2302 merges, rebase and retarget onto integration/aurora (noting t6050-base.dtsi on integration/aurora has since added CPU cache macros, though OPP tables remain conflict-free) and confirm dt-checks passes.
  2. §5 Evidence incomplete on e0b272a679a1:
    • The J775c boot row (2026-11-23 15:13Z) confirmed cpuinfo_transition_latency = 120000 and rate_limit_us = 180 across policy0/policy6/policy12 on the default command line via an fdtput-patched carry DTB, but is still missing:
      • Explicit §5 regression gate counts (0 SELinux denials / 0 failed units / 0 new kernel errors) on that boot.
      • A same-boot A/B on a ramp-sensitive / bursty workload (e.g., schbench p99 wakeup latency or fixed-work bursty test) comparing rate_limit_us 6000 µs vs 180 µs (the prior pp pipe check held one clock and showed no change).
      • Verification booting a compiled t6050-base.dtsi DTB on a T6050 Mac with an in-tree bootable DTB (since J775c's in-tree DTB is currently a stub and required a patched carry DTB).

Checklist Summary (§1–§6)

  • §1 No model gating: Pass (shared t6050-base.dtsi OPP tables, zero driver changes; multi-T6050 compiled-DTB check still owed under §1/§5).
  • §2 Production-ready, no hacks: Pass (code/DT clean; default cmdline exercised on J775c).
  • §3 Safety: Pass.
  • §4 Clean-room & attribution: Pass (e0b272a679a1 carries human author/committer and human Signed-off-by: only, 0 AI commit trailers; PR body includes Assisted-by:).
  • §5 Evidence: Incomplete (0 live CI checks; missing 0 AVC / 0 failed units counts, ramp-sensitive same-boot A/B at 180 µs vs 6000 µs, and compiled-DTB T6050 boot).
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants