high_freq_hwp_cap_cppc.c: new test for testing acpi_cppc/highest_perf
PATCH v16 1/1 high_freq_hwp_cap_cppc.c: new test for testing acpi_cppc/highest_perf
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.
The test is valid only for Intel platforms.
---
Previously wrong patch was sent - the older one with mismatch array. Pointed out by the AI bot.
runtest/power_management_tests | 1 + testcases/kernel/power_management/.gitignore | 1 + .../power_management/high_freq_hwp_cap_cppc.c | 128 ++++++++++++++++++ 3 files changed, 130 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 +128 -0
128 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 3 lines · Piotr Kubaj
high_freq_hwp_cap_cppc.c: new test for testing acpi_cppc/highest_perf+// .needs_cpu_vendor = "GenuineIntel",
This field does not exist in the LTP framework. Is this leftover from an earlier prototype? Commented-out code should not be committed.
If the intent is to restrict to Intel, the existing CPUID HWP check in setup() already serves that purpose since HWP is Intel-specific.
Quoted 9 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +8
-0+static void run (void ) +{ +bool status = true; +bool match = msr_highest_perf == sysfs_highest_perf; + +if (!match) { +tst_res (TINFO ,"cpu%d: sysfs=%llu MSR=%llu" , + i, sysfs_highest_perf, msr_highest_perf);
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 105
Quoted 10 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +10
-0+ status = false; + } + +tst_res (TINFO ,"cpu%d: %s" , i, match ?"OK" :"MISMATCH" ); + } + +if (status) +tst_res (TPASS ,"Sysfs and MSR values are equal" ); +else +tst_res (TFAIL ,"Highest performance values differ between sysfs and MSR" );
Results should be reported directly where the outcome is determined, not accumulated in a flag and reported at the end. Per-CPU mismatches are logged as TINFO, meaning they won't appear as test failures in result summaries.
Could this report TFAIL directly for each mismatched CPU and TPASS once at the end if all matched? Something like:
if (msr_highest_perf != sysfs_highest_perf) {
tst_res(TFAIL, "cpu%d: sysfs=%llu MSR=%llu",
i, sysfs_highest_perf, msr_highest_perf);
status = false;
}
...
if (status)
tst_res(TPASS, "...");That way each failing CPU is a proper TFAIL, and the redundant second TINFO on line 99 can be dropped as well.
Verdict: Needs revision
---
Note:
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
2026-06-10 (水) の 13:43 +0000 に [email protected] さんは書きました:
Quoted 6 lines
Hi Piotr,
Quoted 2 lines · Piotr Kubaj
high_freq_hwp_cap_cppc.c: new test for testing
acpi_cppc/highest_perf
Quoted 7 lines
Quoted 1 line
+// .needs_cpu_vendor = "GenuineIntel",
This field does not exist in the LTP framework. Is this leftover from an earlier prototype? Commented-out code should not be committed.
If the intent is to restrict to Intel, the existing CPUID HWP check in
setup()already serves that purpose since HWP is Intel-specific.
The field is to be uncommented once the patch for its addition is pushed.
Quoted 40 lines
Quoted 24 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4
-0+static void run (void ) +{ +bool status = true; + bool match = msr_highest_perf ==
sysfs_highest_perf;testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +3
-0+ +if (!match) { + tst_res(TINFO, "cpu%d: sysfs=%lluMSR=%llu",
(quoted diff) +1
-0+ i, sysfs_highest_perf,
msr_highest_perf);testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4
-0+ status = false; + } + + tst_res(TINFO, "cpu%d: %s", i, match ? "OK" :"MISMATCH");
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +6
-0+ } + +if (status) +tst_res (TPASS ,"Sysfs and MSR values are equal" ); +else + tst_res(TFAIL, "Highest performance values differQuoted 1 line
between sysfs and MSR");
Results should be reported directly where the outcome is determined, not accumulated in a flag and reported at the end. Per-CPU mismatches are logged as TINFO, meaning they won't appear as test failures in result summaries.
Could this report TFAIL directly for each mismatched CPU and TPASS once at the end if all matched? Something like:
if (
msr_highest_perf!=sysfs_highest_perf) {tst_res(TFAIL, "cpu%d: sysfs=%llu MSR=%llu", i, sysfs_highest_perf, msr_highest_perf); status = false;
}
Quoted 7 lines
...
if (status)
tst_res(TPASS, "...");That way each failing CPU is a proper TFAIL, and the redundant second TINFO on line 99 can be dropped as well.
That way of reporting was suggested before.
Quoted 6 lines
Verdict: Needs revision
---
Note:
Quoted 6 lines
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
---------------------------------------------------------------------
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.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 25
Quoted 4 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4
-0+#include "tst_test.h" +#include "tst_safe_prw.h" + +#if defined(__i386__) || defined(__x86_64__)
I've adjusted the test so that the ifdefs are only around the x86 specific bits, with that we get the proper message from the test library about supported architecture and pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Oh, I was under impression that the whole test should be ifdefed. After all, there's just no possibility it will ever run on another architecture.
2026-06-11 (木) の 16:17 +0200 に Cyril Hrubis さんは書きました:
Quoted 10 lines
Hi!
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 25
Quoted 4 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4
-0+#include "tst_test.h" +#include "tst_safe_prw.h" + +#if defined(__i386__) || defined(__x86_64__)I've adjusted the test so that the ifdefs are only around the x86 specific bits, with that we get the proper message from the test library
about supported architecture and pushed, thanks.
---------------------------------------------------------------------
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.
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 3 lines
Oh, I was under impression that the whole test should be ifdefed. After all, there's just no possibility it will ever run on another architecture.
If we do that the tst_test structure with the real metadata will be hidden inside these ifdefs as well (along with the supported architectures field) so the better way to do this is to ifdef only what needs to be ifdefed. We could as well ifdef out all the setup/cleanup/run functions and define dummy functions for non-x86 targets however in this case it was easier just to ifdef the cpuid code.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp