-
Notifications
You must be signed in to change notification settings - Fork 21
CPUFreq: Add policy-aware validation and robust frequency walker #61
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
.../Kernel/FunctionalArea/baseport/CPUFreq_Validation/README_CPUFreq_Validation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# CPUFreq_Validation | ||
|
||
## Overview | ||
|
||
The `CPUFreq_Validation` test validates the CPU frequency scaling capabilities of a system using the Linux `cpufreq` subsystem. It verifies the ability to set and reflect CPU frequencies across shared policy domains (e.g., clusters of CPUs sharing frequency control). | ||
|
||
This test is designed to be **SoC-agnostic**, supporting platforms with per-policy frequency management (e.g., Qualcomm SoCs with `policy0`, `policy4`, etc.). | ||
|
||
## Test Goals | ||
|
||
- Ensure all cpufreq policies are present and functional | ||
- Iterate through all available frequencies and validate correct scaling | ||
- Ensure that CPU governors can be set to `userspace` | ||
- Provide robust reporting per policy (e.g., `CPU0-3 [via policy0] = PASS`) | ||
- Avoid flaky failures in CI by using retries and proper checks | ||
|
||
## Prerequisites | ||
|
||
- Kernel must be built with `CONFIG_CPU_FREQ` and `CONFIG_CPU_FREQ_GOV_USERSPACE` | ||
- `sysfs` access to `/sys/devices/system/cpu/cpufreq/*` | ||
- Root privileges (to write to cpufreq entries) | ||
|
||
## Script Location | ||
|
||
``` | ||
Runner/suites/Kernel/FunctionalArea/baseport/CPUFreq_Validation/run.sh | ||
``` | ||
|
||
## Files | ||
|
||
- `run.sh` - Main test script | ||
- `CPUFreq_Validation.res` - Summary result file with PASS/FAIL | ||
- `CPUFreq_Validation.log` - Full execution log (generated if logging is enabled) | ||
|
||
## How It Works | ||
|
||
1. The script detects all cpufreq policies under `/sys/devices/system/cpu/cpufreq/` | ||
2. For each policy: | ||
- Reads the list of related CPUs | ||
- Attempts to set each available frequency using the `userspace` governor | ||
- Verifies that the frequency was correctly applied | ||
3. The result is logged per policy | ||
4. The overall test passes only if all policies succeed | ||
|
||
## Example Output | ||
|
||
``` | ||
[INFO] CPU0-3 [via policy0] = PASS | ||
[FAIL] CPU4-6 [via policy4] = FAIL | ||
[INFO] CPU7 [via policy7] = PASS | ||
``` | ||
|
||
## Return Code | ||
|
||
- `0` — All policies passed | ||
- `1` — One or more policies failed | ||
|
||
## Integration in CI | ||
|
||
- Can be run standalone or via LAVA | ||
- Result file `CPUFreq_Validation.res` will be parsed by `result_parse.sh` | ||
|
||
## Notes | ||
|
||
- Some CPUs may share frequency domains, so per-core testing is not reliable | ||
- The test includes retries to reduce false failures due to transient conditions | ||
|
||
## License | ||
|
||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
(c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.