cpufreq.c: add new test for cpufreq sysfs interface validation
PATCH v5 1/1 cpufreq.c: add new test for cpufreq sysfs interface validation
Runs various sanity checks for intel_pstate cpufreq sysfs interface.
Checks whether intel_pstate driver is used, whether it is possible to switch scaling_governor to powersave and performance, whether it is possible to disable turbo frequency and whether it is possible to change scaling_min_freq and scaling_max_freq to its minimal valid and maximal valid values.
---
Address bot review.
runtest/power_management_tests | 1 + testcases/kernel/power_management/.gitignore | 1 + testcases/kernel/power_management/cpufreq.c | 396 +++++++++++++++++++ 3 files changed, 398 insertions(+) create mode 100644 testcases/kernel/power_management/.gitignore create mode 100644 testcases/kernel/power_management/cpufreq.c
runtest/power_management_tests +1 -0
@@ -1,4 +1,5 @@ #POWER_MANAGEMENT +cpufreq cpufreq runpwtests03 runpwtests03.sh runpwtests04 runpwtests04.sh runpwtests06 runpwtests06.sh
testcases/kernel/power_management/.gitignore new file +1 -0
@@ -0,0 +1 @@ +cpufreq
testcases/kernel/power_management/cpufreq.c new file +396 -0
396 lines not on this page · raw message
Signature · 13 lines
2.47.3 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Piotr,
Quoted 6 lines · Piotr Kubaj
cpufreq.c: add new test for cpufreq sysfs interface validation+/*\
+ * Runs various sanity checks forintel_pstatecpufreq sysfs interface.
+ * ...
+ */
The doc comment does not state why root is needed. Per ground-rules rule 4, document the reason in the doc block — e.g. "Requires root to write to /sys/devices/system/cpu/intel_pstate/ and per-CPU cpufreq sysfs attributes."
[...]
testcases/kernel/power_management/cpufreq.c line 71
Quoted 2 lines
testcases/kernel/power_management/cpufreq.c new file +2
-0+SAFE_FILE_SCANF ("/sys/devices/system/cpu/intel_pstate/no_turbo" ,"%d" , &no_turbo); +SAFE_FILE_SCANF ("/sys/devices/system/cpu/intel_pstate/status" ,"%15s" , intel_pstate_status);
CONFIG_X86_INTEL_PSTATE=y does not guarantee the driver is active at runtime (acpi_cpufreq may take over, or the driver may be in "off" mode). If the sysfs files are absent, SAFE_FILE_SCANF calls tst_brk(TBROK). Guard with an existence check and use tst_brk(TCONF, "intel_pstate driver not active") instead.
---
Note:
Our agent completed the review of the patch. The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp