Skip to contentSkip to conversation

high_freq_hwp_cap_cppc.c: new test

PATCH Superseded Piotr Kubaj 2 participants 2 messages May 6

v11 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

PATCH v11 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.

---
Address review from Andrea:
1. removal of fd = -1.
2. printing pass / fail only once at the end of the test.

 runtest/power_management_tests                |   1 +
 testcases/kernel/power_management/.gitignore  |   1 +
 .../power_management/high_freq_hwp_cap_cppc.c | 112 ++++++++++++++++++
 3 files changed, 114 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
index b670da6ec..4da57ee72 100644
@@ -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
new file mode 100644
index 000000000..03f0c83e4
@@ -0,0 +1 @@
+high_freq_hwp_cap_cppc
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +112 -0

112 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
#1 lore raw

Hi Piotr,

Quoted 3 lines · Piotr Kubaj

[PATCH] high_freq_hwp_cap_cppc.c: new test

+static int *mismatch;

[...]

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 83

Quoted 4 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4 -0
+		if (msr_highest_perf != sysfs_highest_perf) {
+			tst_res(TINFO, "cpu%d: sysfs=%llu MSR=%llu",
+				i, sysfs_highest_perf, msr_highest_perf);
+			mismatch[i] = 1;

mismatch[] is zeroed by SAFE_CALLOC in setup() but never cleared at the start of run(). With -i N, stale flags from a prior iteration persist and the per-CPU summary falsely reports "MISMATCH" for CPUs that are now matching. Add:

    memset(mismatch, 0, nproc * sizeof(*mismatch));

at the top of run().

---
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