Skip to contentSkip to conversation

high_freq_hwp_cap_cppc.c: new test

PATCH Superseded Piotr Kubaj 3 participants 4 messages Apr 20 – Apr 30

v7 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

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

---
Addresses Andrea's feedback.

 runtest/power_management_tests                |  1 +
 testcases/kernel/power_management/.gitignore  |  1 +
 .../power_management/high_freq_hwp_cap_cppc.c | 90 +++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 testcases/kernel/power_management/high_freq_hwp_cap_cppc.c
runtest/power_management_tests +1 -0
index 884e615cd..6d87dfb7f 100644
@@ -1,4 +1,5 @@
 #POWER_MANAGEMENT
+high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc
 runpwtests01 runpwtests01.sh
 runpwtests02 runpwtests02.sh
 runpwtests03 runpwtests03.sh
testcases/kernel/power_management/.gitignore +1 -0
index 0c2a3ed4b..c13bca1c4 100644
@@ -1 +1,2 @@
+high_freq_hwp_cap_cppc
 pm_get_sched_values
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +90 -0

90 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
Reviewed-by LTP AI Reviewer on v7 1/1
#1 lore raw

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
#2 lore raw
In reply to Piotr Kubaj

Hi Piotr,

I commented the wrong patch. Was v6, sorry. Let me complete the review here.

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 30

Quoted 7 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +7 -0
+static void run(void)
+{
+	bool status = true;
+
+	for (int i = 0; i < nproc; i++) {
+		int online = 1;
+		char path[PATH_MAX];

This can stay out of the loop. snprintf() adds a string terminator so there's no issue with this.

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 34

Quoted 4 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +4 -0
+		unsigned long long msr_highest_perf = 0, sysfs_highest_perf = 0;
+
+		snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d/online", i);
+		if (i)

I think I missed a part here. Did you double check if i == 0 creates an issue while using SAFE_FILE_SCANF ? Please verify and eventually remove this check.

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 35

Quoted 1 line
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +1 -0
+			SAFE_FILE_SCANF(path, "%d", &online);

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

2026-04-29 (水) の 07:53 +0000 に Andrea Cervesato さんは書きました:

Quoted 6 lines

Hi Piotr,

I commented the wrong patch. Was v6, sorry. Let me complete the review
here.

Quoted 10 lines

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 30

Quoted 7 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +7 -0
+static void run(void)
+{
+	bool status = true;
+
+	for (int i = 0; i < nproc; i++) {
+		int online = 1;
+		char path[PATH_MAX];

This can stay out of the loop. snprintf() adds a string terminator so there's no issue with this.

Fixed.

Quoted 12 lines

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 34

Quoted 7 lines
(quoted diff) +1 -0
+		unsigned long long msr_highest_perf = 0,

sysfs_highest_perf = 0;

(quoted diff) +2 -0
+
+		snprintf(path, sizeof(path),

"/sys/devices/system/cpu/cpu%d/online", i);

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +1 -0
+		if (i)

I think I missed a part here. Did you double check if i == 0 creates
an issue while using SAFE_FILE_SCANF ? Please verify and eventually remove this check.

Yes, it's necessary. "online" is not available for cpu0, I think it's assumed to be always online.

Quoted 8 lines

testcases/kernel/power_management/high_freq_hwp_cap_cppc.c line 35

Quoted 2 lines
testcases/kernel/power_management/high_freq_hwp_cap_cppc.c new file +1 -0
+			SAFE_FILE_SCANF(path, "%d", &online);

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

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