Skip to contentSkip to conversation

pmc_core: cover the PkgC LTR blocker counters

PATCH In review Piotr Kubaj 2 participants 5 messages Nov 30

lore
Share & tools
lore
#0 lore raw

v6 cover pmc_core: cover the PkgC LTR blocker counters

Tests for the pkgc_ltr_blocker_show debugfs file of intel_pmc_core (kernel v7.2). Depends on "lib: add tst_test.needs_debugfs flag" (v5 1/3) with the implied needs_root removed, which is not resent here.

Tested on Nova Lake-S running 7.4.0-rc1.

v5 -> v6:
- Both tests set .needs_root themselves and drop .tags.
- New SAFE_SCHED_GETAFFINITY() and SAFE_SCHED_SETAFFINITY().
- pkgc_ltr_blocker_show: strtoull() end pointer check, no global fails counter, count check moved into second_sample_differs().
- ltr_counter: idle phase bounded by .runtime, TCONF in a VM or with a restricted affinity mask, two burst periods of silence required.
- Dropped the claim that the tests catch a wrong telemetry offset.

Piotr Kubaj (3):
pmc_core: add test for pkgc_ltr_blocker_show
lib: add SAFE_SCHED_GETAFFINITY() and SAFE_SCHED_SETAFFINITY()
pmc_core: add ltr_counter test

 doc/developers/api_c_tests.rst                |   4 +
 include/tst_safe_sched.h                      |  83 ++++
 runtest/power_management_tests                |   2 +
 testcases/kernel/power_management/.gitignore  |   2 +
 .../kernel/power_management/ltr_counter.c     | 363 ++++++++++++++++++
 .../power_management/pkgc_ltr_blocker_show.c  | 291 ++++++++++++++
 6 files changed, 745 insertions(+)
 create mode 100644 include/tst_safe_sched.h
 create mode 100644 testcases/kernel/power_management/ltr_counter.c
 create mode 100644 testcases/kernel/power_management/pkgc_ltr_blocker_show.c

base-commit: 0e2b5ce4294ec8642853688ef47c35eb0e35da08
prerequisite-patch-id: 1d5717365b9b15d4bd8f5e80d78a0498f8ef70c5

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

PATCH v6 1/3 pmc_core: add test for pkgc_ltr_blocker_show

Cover the pkgc_ltr_blocker_show debugfs file added in kernel commit 38c79dd63b72 ("platform/x86/intel/pmc: Enable PkgC LTR blocking counter"), released in v7.2. It reports how many times an LTR posted by each source blocked a package C-state entry.

The counter set is platform specific, so rather than matching a list of names the test samples the file twice and checks that it reads to EOF, that every line is a PKGC_PREVENT_LTR_<SOURCE> token followed by one u32 value, that the counter set is stable, and that no counter advances by more entries than the package could have attempted over the interval.

The test validates the format and the rate only. A value that does not change between the two reads passes whatever it is, so it does not prove that the driver reads the right telemetry offset.

Tested on Nova Lake-S running 7.4.0-rc1.

---
 runtest/power_management_tests                |   1 +
 testcases/kernel/power_management/.gitignore  |   1 +
 .../power_management/pkgc_ltr_blocker_show.c  | 291 ++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 testcases/kernel/power_management/pkgc_ltr_blocker_show.c
runtest/power_management_tests +1 -0
index 5a22283d6..7708d3fd4 100644
@@ -2,6 +2,7 @@
 cpufreq_intel cpufreq_intel
 rfim01 rfim01
 high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc
+pkgc_ltr_blocker_show pkgc_ltr_blocker_show
 runpwtests03 runpwtests03.sh
 runpwtests04 runpwtests04.sh
 runpwtests06 runpwtests06.sh
testcases/kernel/power_management/.gitignore +1 -0
index 766f07901..b96084eca 100644
@@ -1,3 +1,4 @@
 high_freq_hwp_cap_cppc
 cpufreq_intel
 rfim01
+pkgc_ltr_blocker_show
testcases/kernel/power_management/pkgc_ltr_blocker_show.c new file +291 -0

291 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
#2 lore raw

Re: [LTP] pmc_core: add test for pkgc_ltr_blocker_show

Hi Piotr,

Quoted 1 line · Piotr Kubaj

pmc_core: add test for pkgc_ltr_blocker_show

Verdict - Reviewed

---
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
#3 lore raw

PATCH v6 2/3 lib: add SAFE_SCHED_GETAFFINITY() and SAFE_SCHED_SETAFFINITY()

In reply to Piotr Kubaj

Add safe wrappers for sched_getaffinity() and sched_setaffinity() in a new tst_safe_sched.h header and list it in the C API documentation. Both calls are GNU extensions, so the header is separate from tst_safe_macros.h and tests using it have to define _GNU_SOURCE.

---
 doc/developers/api_c_tests.rst |  4 ++
 include/tst_safe_sched.h       | 83 ++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 include/tst_safe_sched.h
doc/developers/api_c_tests.rst +4 -0
index af7d84ce1..53ff5429f 100644
@@ -95,6 +95,10 @@ Safe file operations
 --------------------
 .. kernel-doc:: ../../include/tst_safe_file_ops.h
 
+Safe scheduler operations
+-------------------------
+.. kernel-doc:: ../../include/tst_safe_sched.h
+
 Saving and restoring /proc|sys values
 -------------------------------------
 .. kernel-doc:: ../../include/tst_sys_conf.h
include/tst_safe_sched.h new file +83 -0

83 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
#4 lore raw

PATCH v6 3/3 pmc_core: add ltr_counter test

In reply to Piotr Kubaj

Test the invariant behind the pkgc_ltr_blocker_show counters: they only advance while a package C-state entry can be attempted, which needs every CPU in the package idle. A counter that keeps advancing with every CPU busy is not counting blocked entries.

The test idles until it sees a counter advance, so that a stuck counter cannot pass for free, then pins a busy loop to every CPU and requires the counters to hold still. How often the counters advance while idle depends on the system, on Nova Lake they were seen moving continuously and in bursts roughly six seconds apart, so the load phase waits for two burst periods of silence rather than sampling after a fixed delay: a counter that keeps running is silent for one period between two bursts. The idle phase is bounded by the test runtime.

The test cannot keep the package busy when it is confined to a subset of the online CPUs or runs in a VM, so it exits with TCONF in both cases.

Tested on Nova Lake-S running 7.4.0-rc1.

---
 runtest/power_management_tests                |   1 +
 testcases/kernel/power_management/.gitignore  |   1 +
 .../kernel/power_management/ltr_counter.c     | 363 ++++++++++++++++++
 3 files changed, 365 insertions(+)
 create mode 100644 testcases/kernel/power_management/ltr_counter.c
runtest/power_management_tests +1 -0
index 7708d3fd4..c4f661257 100644
@@ -3,6 +3,7 @@ cpufreq_intel cpufreq_intel
 rfim01 rfim01
 high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc
 pkgc_ltr_blocker_show pkgc_ltr_blocker_show
+ltr_counter ltr_counter
 runpwtests03 runpwtests03.sh
 runpwtests04 runpwtests04.sh
 runpwtests06 runpwtests06.sh
testcases/kernel/power_management/.gitignore +1 -0
index b96084eca..f54cec368 100644
@@ -2,3 +2,4 @@ high_freq_hwp_cap_cppc
 cpufreq_intel
 rfim01
 pkgc_ltr_blocker_show
+ltr_counter
testcases/kernel/power_management/ltr_counter.c new file +363 -0

363 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