RFC cpuidle: Allow states to be disabled by default (was: Re: [PATCH] cpuidle: Consolidate disabled state checks)
Get series with b4
b4 am 1688511.GgkECGP1XA@kreacherVersions newest first
- v1 RFC Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | cpuidle: Drop disabled field from struct cpuidle_statearch/ drivers/ drivers/ +2 more | +9 | 0 replies | |
| 2/2 | cpuidle: Allow idle states to be disabled by defaultDocumentation/ Documentation/ drivers/ +2 more | +22 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC][PATCH 0/2] cpuidle: Allow states to be disabled by default (was: Re: [PATCH] cpuidle: Consolidate disabled state checks)
Quoted 61 lines · CET Rafael J. Wysocki
Quoted 39 lines · Rafael J. Wysocki
Quoted 13 lines · Len Brown
Quoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
There are two reasons why CPU idle states may be disabled: either because the driver has disabled them or because they have been disabled by user space via sysfs.
In the former case, the state's "disabled" flag is set once during the initialization of the driver and it is never cleared later (it is read-only effectively).
Quoted 8 lines
for x86 (
intel_idleandacpi_idle), no states with disabled=1 are registered with cpuidle. Instead,intel_idle(currently) skips them in the loop that registers states.
(andacpi_idlenever touches the disabled field)And so for x86, governors checking for drv->states[i].disabled is a NOP, and the condition described by
CPUIDLE_STATE_DISABLED_BY_DRIVERdoes not (yet) exist.OK
Quoted 3 lines
Looking at the ARM code, it seems that
cpuidle-imx6q.candcpuidle-tegra20.creach into the cpuidle states at run time and toggle the drv->states[i].disabled.I might have overlooked that, let me check.
Quoted 6 lines
It seems that this patch takes the initial value of
drv->states->disabled, and sets the (per cpu) usage.disable=..BY_DRIVER,
but that subsequent run-time toggles in drv->states[i]disabled by these drivers would be missed,
because you're removed the run-time checking ofdrv->states->disabled?Quoted 16 lines
If it is updated at run time, then yes, the updates will be missed, so thanks for pointing that out.
Quoted 13 lines
Finally, I'd like to change
intel_idleso that it *can* register a state that is disabled, by default.
If I change the driver to NOT skip registering disabled states, and the cpuidle copy has cpuidle_state.disabled=1,
then the state is indeed, unused at run-time. But as you said, it is effectively read-only, and is not indicated in sysfs, and can not be changed via sysfs.One way to do this is to do what you do here and initialize usage.disabled to
drv->state.disabled. (not distinguishing between DRIVER and USER)
That way the user could later over-ride what a driver set, by clearing the disabled attribute.I'd rather get rid of the "disabled" field from struct
cpuidle_stateentirely and introduce a new state flag to indicate the "disabled by default" status.
Quoted 6 lines
I also would expose that new flag in a new sysfs attribute of idle states, say "
disable_default".Then, the
DISABLED_BY_DRIVERbit would be reserved for driver quirks (as per https://patchwork.kernel.org/patch/11249519/) and theDISABLED_BY_USERone could be used for all of the other purposes.
To that end, I have the following two experimental patches (on top of
https://patchwork.kernel.org/patch/11249519/) that IMO are simple enough.
Please let me know what you think.