Skip to contentSkip to conversation

rfim: add new test for verifying RFIM sysfs interface

PATCH Superseded Piotr Kubaj 2 participants 2 messages Jun 22

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 rfim: add new test for verifying RFIM sysfs interface

Validate presence and permissions of the RFIM attributes exposed by the Intel processor_thermal driver under the proc_thermal PCI device.

The kernel creates the dvfs, fivr and dlvr attribute groups independently, each gated on its own per-device feature bit, so the test detects which of the three groups the hardware presents and checks only those. This covers platforms that expose both FIVR and DLVR (e.g. Meteor Lake) as well as those with FIVR but no DVFS (e.g. Tiger Lake).

Read-only attributes (mode 0444) must accept O_RDONLY and reject a write open with EACCES; read-write attributes (mode 0644) must accept O_RDWR. The open() itself is what exercises access, since sysfs can refuse it in kernfs even when the mode bits would allow it.

The test works only on Intel platforms with RFIM and needs root for the read-write attributes, whose write bit is owner-only.

---
Change to fd != -1, as recommended by the bot.
Note: the current version is still hardcoding the PCI bus address. The reason is that all the devices released until now use this address, kernel documentation uses that address exclusively and the upcoming Nova Lake generation also does it. IMO there's no point to overcomplicate this test.

 runtest/power_management_tests               |   1 +
 testcases/kernel/power_management/.gitignore |   1 +
 testcases/kernel/power_management/rfim01.c   | 163 +++++++++++++++++++
 3 files changed, 165 insertions(+)
 create mode 100644 testcases/kernel/power_management/rfim01.c
runtest/power_management_tests +1 -0
index 4da57ee72..d05c95608 100644
@@ -1,5 +1,6 @@
 #POWER_MANAGEMENT
 high_freq_hwp_cap_cppc high_freq_hwp_cap_cppc
+rfim01 rfim01
 runpwtests03 runpwtests03.sh
 runpwtests04 runpwtests04.sh
 runpwtests06 runpwtests06.sh
testcases/kernel/power_management/.gitignore +1 -0
index 03f0c83e4..74f6df14f 100644
@@ -1 +1,2 @@
 high_freq_hwp_cap_cppc
+rfim01
testcases/kernel/power_management/rfim01.c new file +163 -0

163 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

rfim: add new test for verifying RFIM sysfs interface

+#define RFIM_ROOT "/sys/bus/pci/devices/0000:00:04.0"

The PCI BDF 0000:00:04.0 is hardcoded. While this is the common address for the proc_thermal device on Intel client platforms, it is not universal -- multi-die systems or future SOCs could place it elsewhere.

The test gracefully TCONFs when the path is absent, but it also silently skips on systems that DO have RFIM at a different BDF.

Could this discover the device dynamically instead, for example by walking /sys/bus/pci/drivers/proc_thermal_pci/ to find the bound device?

testcases/kernel/power_management/rfim01.c line 72

Quoted 7 lines
testcases/kernel/power_management/rfim01.c new file +7 -0
+static const char * const rw_dvfs_nodes[] = {
+	RFIM_ROOT "/dvfs/rfi_restriction_run_busy",
+	RFIM_ROOT "/dvfs/rfi_restriction_err_code",
+	RFIM_ROOT "/dvfs/rfi_restriction_data_rate_base",
+	RFIM_ROOT "/dvfs/rfi_restriction_data_rate",
+	NULL
+};

The kernel's dvfs group also exposes rfi_disable (RW), ddr_data_rate (RO), and rfi_restriction (RW). Any reason these are excluded?

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