high_freq_hwp_cap_cppc.c: new test
PATCH v10 1/1 high_freq_hwp_cap_cppc.c: new test
Verify for all online logical CPUs that their highest performance value are the same for HWP Capability MSR 0x771 and CPPC sysfs file.
On HWP-capable x86 platforms the acpi_cppc/highest_perf sysfs attribute is expected to reflect the same highest-performance value that firmware programs into the HWP Capabilities MSR (0x771, bits 7:0). A mismatch between the two interfaces indicates a kernel regression in how CPPC values are exposed to userspace, and would break tools (e.g. cpupower, intel_pstate tuning scripts) that rely on the sysfs interface to make frequency-scaling decisions.
---
Addressed both points raised in a review:
1. motivation for the test.
2. fd leak.
runtest/power_management_tests | 1 + testcases/kernel/power_management/.gitignore | 1 + .../power_management/high_freq_hwp_cap_cppc.c | 105 ++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 testcases/kernel/power_management/.gitignore create mode 100644 testcases/kernel/power_management/high_freq_hwp_cap_cppc.c
runtest/power_management_tests +1 -0
@@ -1,4 +1,5 @@ #POWER_MANAGEMENT +high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc runpwtests03 runpwtests03.sh runpwtests04 runpwtests04.sh runpwtests06 runpwtests06.sh
testcases/kernel/power_management/.gitignore new file +1 -0
@@ -0,0 +1 @@ +high_freq_hwp_cap_cppc
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +105 -0
105 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 1 line · Piotr Kubaj
high_freq_hwp_cap_cppc.c: new test
---
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
Hi Piotr,
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 73
Quoted 3 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +3
-0+SAFE_PREAD (1 , fd, &msr_highest_perf,sizeof (msr_highest_perf),MSR_HWP_CAPABILITIES ); +SAFE_CLOSE (fd); + fd =-1 ;
This is not needed because it's done by SAFE_CLOSE() already.
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 80
Quoted 7 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +7
-0+ msr_highest_perf &=HIGHEST_PERF_MASK ; +tst_res (TDEBUG ,"%s: %llu" , path, msr_highest_perf); + +if (msr_highest_perf != sysfs_highest_perf) { +tst_res (TINFO ,"cpu%d: sysfs=%llu MSR=%llu" , + i, sysfs_highest_perf, msr_highest_perf); + status = false;
After this we should return, otherwise we keep cycling and next status value might change again. I would just add here the TFAIL and return at this point, so status variable goes away.
Unless, we want to track _all_ CPUs and then (at the end) print the result. In this case, you need an array of int, assiging 1 in case of error and 0 in case of success.
And the ending check, after the loop, will print the status of all CPUs.
I'm not a driver expert, but I guess having an ending result printing all results for all CPUs in case of mismatch is the best choice.
Kind regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp