Skip to contentSkip to conversation

thermal: add new test group

PATCH Superseded Piotr Kubaj 2 participants 3 messages Apr 30

v18 of 21 Superseded Latest is v21 →

lore
Share & tools
lore
#0 lore raw

PATCH v18 1/1 thermal: add new test group

Currently consists of only one test for the CPU package thermal sensor interface for Intel platforms.
It works by checking the initial count of thermal interrupts. Then it decreases the threshold for sending a thermal interrupt to just above the current temperature and runs a workload on the CPU. Finally, it restores the original thermal threshold and checks whether the number of thermal interrupts increased.

---
Fix compilation, needs_drivers was removed so switch to needs_kconfigs.

 runtest/thermal                               |   3 +
 testcases/kernel/Makefile                     |   1 +
 testcases/kernel/thermal/.gitignore           |   1 +
 testcases/kernel/thermal/Makefile             |   9 +
 .../kernel/thermal/thermal_interrupt_events.c | 242 ++++++++++++++++++
 5 files changed, 256 insertions(+)
 create mode 100644 runtest/thermal
 create mode 100644 testcases/kernel/thermal/.gitignore
 create mode 100644 testcases/kernel/thermal/Makefile
 create mode 100644 testcases/kernel/thermal/thermal_interrupt_events.c
runtest/thermal new file +3 -0
new file mode 100644
index 000000000..57e3d29f8
@@ -0,0 +1,3 @@
+# Thermal driver API
+# https://docs.kernel.org/driver-api/thermal/
+thermal_interrupt_events thermal_interrupt_events
testcases/kernel/Makefile +1 -0
index 98fd45a9d..ac816e4e8 100644
@@ -36,6 +36,7 @@ SUBDIRS			+= connectors \
 			   sched \
 			   security \
 			   sound \
+			   thermal \
 			   tracing \
 			   uevents \
 			   watchqueue \
testcases/kernel/thermal/.gitignore new file +1 -0
new file mode 100644
index 000000000..1090bdad8
@@ -0,0 +1 @@
+thermal_interrupt_events
testcases/kernel/thermal/Makefile new file +9 -0
new file mode 100644
index 000000000..4657c3fb3
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2025, Intel Corporation. All rights reserved.
+# Author:Piotr Kubaj <[email protected]>
+
+top_srcdir             ?= ../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/thermal/thermal_interrupt_events.c new file +242 -0

242 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] thermal: add new test group

+# Copyright (c) 2025, Intel Corporation. All rights reserved.

Wrong year in the new Makefile -- should be 2026.

testcases/kernel/thermal/thermal_interrupt_events.c line 173

Quoted 5 lines
testcases/kernel/thermal/thermal_interrupt_events.c new file +5 -0
+	while (sleep_time > 0) {
+		[...]
+		tst_reap_children();
+		[...]
+		sleep(sleep_time--);

sleep() must not be used for synchronization (G2). The children are already reaped with tst_reap_children(); this sleep is waiting for a hardware thermal state change. Use a polling loop with tst_timer_start()/tst_timer_expired_ms() instead, which you already use in cpu_workload().

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

2026-04-30 (木) の 09:18 +0000 に [email protected] さんは書きました:

Quoted 9 lines

Hi Piotr,

Quoted 3 lines · Piotr Kubaj

[PATCH] thermal: add new test group

+# Copyright (c) 2025, Intel Corporation. All rights reserved.

Wrong year in the new Makefile -- should be 2026.

Quoted 11 lines

testcases/kernel/thermal/thermal_interrupt_events.c line 173

Quoted 5 lines
testcases/kernel/thermal/thermal_interrupt_events.c new file +5 -0
+	while (sleep_time > 0) {
+		[...]
+		tst_reap_children();
+		[...]
+		sleep(sleep_time--);

sleep() must not be used for synchronization (G2). The children are already reaped with tst_reap_children(); this sleep is waiting for a hardware thermal state change. Use a polling loop with tst_timer_start()/tst_timer_expired_ms() instead, which you already use in cpu_workload().

This sleep is not used for synchronization, but to wait until the CPU cools down. There are some preproduction CPU's that have non- functioning thermal sensors and may be damaged if this sleep is omitted.

While I could use tst_timer_start()/tst_timer_expired_ms() instead, I find it quite pointless. cpu_workload() uses it, because there I want the whole loop to take no more than run_time. Here, I just want to wait sleep_time.

Quoted 4 lines

---
Note:

Quoted 8 lines

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

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