Skip to contentSkip to conversation

rfim: add new test for verifying RFIM sysfs interface

PATCH In review Piotr Kubaj 4 participants 4 messages Jul 2 – Jul 31

lore
Share & tools
lore
#0 lore raw

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

---
Test rewritten according to information from Andrea.

Note that currently any missing path will be shown as separate TCONF, in contrary to the previous approach.
Also, all the paths are readable, so "read" tcase struct member is not necessary.

 runtest/power_management_tests               |   1 +
 testcases/kernel/power_management/.gitignore |   1 +
 testcases/kernel/power_management/rfim01.c   | 150 +++++++++++++++++++
 3 files changed, 152 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 +150 -0

150 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

+ * so open() is what actually exercises access.

The doc block must use the manpage-link format for syscall references. Should be:

* so :manpage:open(2) is what actually exercises access.

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
Reviewed-by Andrea Cervesato on v5 1/1
#2 lore raw
In reply to Piotr Kubaj

Hi Piotr,

sorry for the delay.

Quoted 11 lines

+/*\
+ * Validate presence and permissions of RFIM attributes.
+ * The kernel exposes the dvfs, fivr and dlvr attribute groups
+ * independently, gated on per-device feature bits, so the test checks
+ * whichever of the three groups the hardware presents.
+ *
+ * Permissions are verified by opening each node: read-only attributes
+ * must accept O_RDONLY and reject a write open, while read-write ones
+ * must accept O_RDWR. For sysfs nodes the mode bits alone are not
+ * authoritative - the kernel can still refuse the open in the file's
+ * own syscall handler - so open() is what actually exercises access.

Pleae use :manpage:open(2) and O_RDONLY and O_RDWR.

Quoted 5 lines

+ *
+ * The test requires root because the read-write RFIM attributes are
+ * root-owned and created mode 0644, so only the owner holds the write
+ * bit. An unprivileged user could read them but would get EACCES when
+ * opening them O_RDWR, which the read-write check would misreport as a

Same here for EACCESS and O_RDWR.

In this way we will have a certain consistency inside LTP documentation.

The rest looks ok.

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

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