From: Petr Vorel <pvorel@suse.cz>
To: Piotr Kubaj <piotr.kubaj@intel.com>
Cc: helena.anna.dubel@intel.com, tomasz.ossowski@intel.com,
rafael.j.wysocki@intel.com, ltp@lists.linux.it,
daniel.niestepski@intel.com
Subject: Re: [LTP] [PATCH v14] thermal: add new test group
Date: Wed, 25 Mar 2026 13:49:30 +0100 [thread overview]
Message-ID: <20260325124930.GA114080@pevik> (raw)
In-Reply-To: <20260325105533.259287-2-piotr.kubaj@intel.com>
Hi Piotr,
Minor notes:
> +static void setup(void)
> +{
> + char line[8192];
> +
> + nproc = tst_ncpus();
> + tst_res(TDEBUG, "Number of logical cores: %d", nproc);
> + interrupt_init = calloc(nproc, sizeof(uint64_t));
> + interrupt_later = calloc(nproc, sizeof(uint64_t));
You correctly had SAFE_CALLOC() in v13, here you accident start using calloc()
again.
> +
> + DIR *dir = SAFE_OPENDIR("/sys/class/thermal/");
> + struct dirent *entry;
> +
> + while ((entry = SAFE_READDIR(dir))) {
> + if ((!strncmp(entry->d_name, "thermal_zone", sizeof("thermal_zone") - 1)))
> + tz_counter++;
> + }
> + SAFE_CLOSEDIR(dir);
> + tst_res(TDEBUG, "Found %d thermal zone(s)", tz_counter);
> +
> + x86_pkg_temp_tz = calloc(tz_counter, sizeof(bool));
And here as well.
...
> + memset(interrupts, 0, nproc * sizeof(*interrupts));
> + FILE *fp = SAFE_FOPEN("/proc/interrupts", "r");
> +
> + while (fgets(line, sizeof(line), fp)) {
> + if (strstr(line, "Thermal event interrupts")) {
> + interrupts_found = true;
> + char *ptr = strchr(line, ':');
> +
> + for (int i = 0; i < nproc; i++) {
> + char *endptr;
> +
> + while (*ptr && !isdigit(*ptr))
> + ptr++;
> +
> + errno = 0;
> +
> + interrupts[i] = strtoull(ptr, &endptr, 10);
> +
> + if (ptr == endptr)
> + tst_brk(TBROK, "interrupt not found");
Printing CPU would help to debug on error, right?
tst_brk(TBROK, "CPU %d: interrupt not found", nproc);
> +
> + if (errno == ERANGE)
> + tst_brk(TCONF, "interrupt out of range");
I would expect this is quite serious error (test bug), therefore TBROK should be
used, right? TCONF is really for skipping the test due SUT not suitable for
running the test. But if the only error, it can be changed before merge.
tst_brk(TBROK, "CPU %d: interrupt out of range", nproc);
...
> +static struct tst_test test = {
> + .cleanup = cleanup,
> + .forks_child = 1,
> + .needs_drivers = (const char *const []) {
> + "x86_pkg_temp_thermal",
> + NULL
> + },
> + .min_runtime = 180,
You had .min_runtime = 5 sec in the v13, now again back 3 min.
As I wrote earlier, using tst_set_runtime() would be much better than expect 3
min run (on my laptop the test needs few sec, but it will waste time in case of
the test get stuck for whatever reason or might not enough for really big machine).
+#define TEST_RUNTIME 3
#define RUNTIME 30
#define SLEEP 10
#define TEMP_INCREMENT 10
...
@@ -73,9 +74,10 @@ static void setup(void)
char line[8192];
nproc = tst_ncpus();
+ tst_set_runtime(nproc * TEST_RUNTIME);
This will lead to run in my machine:
tst_test.c:1887: TINFO: Overall timeout per run is 0h 00m 30s
tst_test.c:1908: TINFO: Updating runtime to 0h 00m 12s
tst_test.c:1887: TINFO: Overall timeout per run is 0h 00m 42s
I'd be ok to apply the following changes before merge. But I'd really prefer
Cyril to give ack to this before merge.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
> + .needs_root = 1,
> + .setup = setup,
> + .supported_archs = (const char *const []) {
> + "x86",
> + "x86_64",
> + NULL
> + },
> + .tags = (const struct tst_tag[]) {
> + {"linux-git", "9635c586a559ba0e45b2bfbff79c937ddbaf1a62"},
> + {}
> + },
> + .test_all = run
> +};
+++ testcases/kernel/thermal/thermal_interrupt_events.c
@@ -19,6 +19,7 @@
#include "tst_test.h"
#include "tst_timer_test.h"
+#define TEST_RUNTIME 3
#define RUNTIME 30
#define SLEEP 10
#define TEMP_INCREMENT 10
@@ -52,10 +53,10 @@ static void read_interrupts(uint64_t *interrupts, const int nproc)
interrupts[i] = strtoull(ptr, &endptr, 10);
if (ptr == endptr)
- tst_brk(TBROK, "interrupt not found");
+ tst_brk(TBROK, "CPU %d: interrupt not found", nproc);
if (errno == ERANGE)
- tst_brk(TCONF, "interrupt out of range");
+ tst_brk(TBROK, "CPU %d: interrupt out of range", nproc);
ptr = endptr;
tst_res(TDEBUG, "interrupts[%d]: %ld", i, interrupts[i]);
@@ -73,9 +74,10 @@ static void setup(void)
char line[8192];
nproc = tst_ncpus();
+ tst_set_runtime(nproc * TEST_RUNTIME);
tst_res(TDEBUG, "Number of logical cores: %d", nproc);
- interrupt_init = calloc(nproc, sizeof(uint64_t));
- interrupt_later = calloc(nproc, sizeof(uint64_t));
+ interrupt_init = SAFE_CALLOC(nproc, sizeof(uint64_t));
+ interrupt_later = SAFE_CALLOC(nproc, sizeof(uint64_t));
DIR *dir = SAFE_OPENDIR("/sys/class/thermal/");
struct dirent *entry;
@@ -87,7 +89,7 @@ static void setup(void)
SAFE_CLOSEDIR(dir);
tst_res(TDEBUG, "Found %d thermal zone(s)", tz_counter);
- x86_pkg_temp_tz = calloc(tz_counter, sizeof(bool));
+ x86_pkg_temp_tz = SAFE_CALLOC(tz_counter, sizeof(bool));
for (int i = 0; i < tz_counter; i++) {
char path[PATH_MAX];
@@ -214,7 +216,6 @@ static struct tst_test test = {
"x86_pkg_temp_thermal",
NULL
},
- .min_runtime = 180,
.needs_root = 1,
.setup = setup,
.supported_archs = (const char *const []) {
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-03-25 12:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 10:55 [LTP] [PATCH v14] thermal: add new test group Piotr Kubaj
2026-03-25 12:49 ` Petr Vorel [this message]
2026-03-26 8:58 ` Andrea Cervesato via ltp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260325124930.GA114080@pevik \
--to=pvorel@suse.cz \
--cc=daniel.niestepski@intel.com \
--cc=helena.anna.dubel@intel.com \
--cc=ltp@lists.linux.it \
--cc=piotr.kubaj@intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tomasz.ossowski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox