Skip to content

cpufreq: apple: keep T8140 policy->cur in step with the cluster - #471

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/t8140-cpufreq-policy-cur-20261026
Oct 27, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/t8140-cpufreq-policy-cur-20261026

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Summary

This is a follow-up to #443 and omacom/linux-aurora#227, for the hole maralcbr found in its last review.

The fast die-temperature limit moves a lazy_verify cluster without a scheduler request. It lowers a request above a new limit, and it restores the scheduler's request when the limit rises again before the QoS request was updated. policy->cur kept the value the last fast-switch request returned. If that was a capped frequency equal to the suspend frequency, cpufreq_generic_suspend() skipped the driver after the limit rose, and the cluster suspended at the restored, higher state.

  • Suspend: the suspend step records the state it settled the cluster in as policy->cur before the generic suspend, so the suspend frequency is written whenever the cluster is elsewhere.
  • Limit moves: when the fast die limit moves the cluster, policy->cur follows, for scaling_cur_freq and the statistics, until the next fast-switch request sets it.

Only lazy_verify SoCs (T8140) run either path.

Testing

On Neo (7.3), with a diagnostic build that sets the cap without touching the QoS request and prints the cluster's state at suspend. Each case set the cap to suspend_freq (744000 kHz) while a spinner ran, restored it, then ran a pm_test=devices suspend.

before after
after the cap is restored cluster back at P-state 17/15, policy->cur still 744000 cluster at P-state 15/17/12, policy->cur 3924000 / 4044000 / 3648000
suspend with policy->cur == suspend_freq generic suspend skipped the driver; cluster suspended at P-state 10 (3336 MHz) in both runs settled state recorded, then the suspend P-state 1 was written and verified

The E-cluster wrote its suspend frequency in every run. There were no DVFS errors and no driver suspend errors.

Under real load the stale policy->cur rarely survives to suspend, because the real fast die limit changes the QoS request within about 0.3 s and schedutil asks again. The diagnostic therefore restores that state at suspend entry, to exercise the case.

Builds with W=1. checkpatch --strict is clean.

The fast die-temperature limit moves a lazy_verify cluster without a
scheduler request. It lowers a request above a new limit, and it
restores the scheduler's request when the limit rises again before the
QoS request was updated. policy->cur kept the value the last fast-switch
request returned. If that was a capped frequency equal to the suspend
frequency, cpufreq_generic_suspend() skipped the driver after the limit
rose, and the cluster suspended at the restored, higher state.

The suspend step now records the state it settles the cluster in as
policy->cur before the generic suspend, so the suspend frequency is
written whenever the cluster is elsewhere. When the limit moves the
cluster, policy->cur is updated too, for scaling_cur_freq and the
statistics, until the next fast-switch request sets it.

Checked on T8140 with a diagnostic build. The limit was set to the
suspend frequency under load, then restored before the QoS request
changed, and policy->cur was left at the suspend frequency. A
pm_test=devices suspend then left the cluster at 3336 MHz, because the
generic suspend skipped the driver. With this change, policy->cur
followed the restored state, and the suspend frequency was written and
verified.
@DjDeveloperr
DjDeveloperr merged commit 39f897e into integration/aurora Oct 27, 2026
@RyanTheTide
RyanTheTide deleted the fix/t8140-cpufreq-policy-cur-20261026 branch November 7, 2026 12:06
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.

1 participant