Skip to content

RFC: API to change CPU frequency #93526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

peter-mitsis
Copy link
Contributor

I know that there have been a few proposals going around recently about controlling CPU clock frequency at runtime.

This is a proposal for a very simple interface.

General gist:
The DTS can define sets of CPU frequency and load threshold pairs. At runtime a selection of CPUs can have their CPU frequency set either manually (by specifying an ID that corresponds to a DTS entry), or by load. (The calculation of the load is outside the scope of this). When done by load, it picks the first frequency whose threshold is less than the supplied 'load'.

Introduce a simple framework to select a CPU frequency at
runtime.

CPU frequency is selected in one of two methods: by ID or by load.
The ID corresponds to an entry in the DTS' cpu-freq property.
The load thresholds and corresponding frequencies are also defined
in the cpu-freq property. CPU frequency selection can be applied to
one or more CPUs via a bitmask.

If selection is done by load (the calculation of which is beyond the
scope of this), it searches the DTS defined frequency-threshold pairs
for the first one that has a threshold less than the specified load.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
A simple set of tests to demo how to use the propsed CPU frequency
selection model.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Copy link

@seankyer
Copy link
Member

Hey @peter-mitsis wondering what the relationship between this PR and #93461 is. I think there may be some overlap.

@peter-mitsis
Copy link
Contributor Author

@seankyer - I've been tinkering on this for a little while before your RFC. There is definitely some overlap, but I think your approach is cleaner.

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

Successfully merging this pull request may close these issues.

4 participants