Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Kubaj, Piotr" <piotr.kubaj@intel.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>,
	"linuxtestproject.agent@gmail.com"
	<linuxtestproject.agent@gmail.com>
Subject: Re: [LTP] thermal: add new test group
Date: Tue, 9 Jun 2026 14:24:21 +0200	[thread overview]
Message-ID: <aigF9StEMr3oNPFD@yuki.lan> (raw)
In-Reply-To: <21a5a4cec4cbb9a7084b8b5374fa06865a0d74d8.camel@intel.com>

Hi!
I've been debugging the test random failures and it all boils down to
two things:

- the sysfs temperature values are in mC the increment we have is way
  too small

- we need to set the trigger value in the while(sleep_time > 0) loop
  otherwise we can end up running all the iterations with a value that
  is too high (if we enter the function when the CPU temperature was
  high)

The test runs reliably for me with -i 100 with these changes, I can push
the test with these changes added if you agree:

diff --git a/testcases/kernel/thermal/thermal_interrupt_events.c b/testcases/kernel/thermal/thermal_interrupt_events.c
index 42e1532f6..ed55632dc 100644
--- a/testcases/kernel/thermal/thermal_interrupt_events.c
+++ b/testcases/kernel/thermal/thermal_interrupt_events.c
@@ -20,10 +20,10 @@
 #include "tst_timer_test.h"

 #define        TEST_RUNTIME    ((RUNTIME + SLEEPTIME) * (SLEEPTIME / 2) + COOLDOWN)
-#define        RUNTIME         30
+#define        RUNTIME         10
 #define        SLEEPTIME       10
 #define        COOLDOWN        300
-#define        TEMP_INCREMENT  10
+#define        TEMP_INCREMENT  5000

 static bool *x86_pkg_temp_tz;
 static char temp_path[PATH_MAX], trip_path[PATH_MAX];
@@ -135,13 +135,8 @@ static void cpu_workload(double run_time)
        }
 }

-static void test_zone(int i)
+static void set_trippoint(void)
 {
-       int sleep_time = SLEEPTIME;
-       double run_time = RUNTIME;
-
-       snprintf(temp_path, PATH_MAX, "/sys/class/thermal/thermal_zone%d/temp", i);
-       tst_res(TINFO, "Testing %s", temp_path);
        SAFE_FILE_SCANF(temp_path, "%d", &temp);
        if (temp < 0)
                tst_brk(TBROK, "Unexpected zone temperature value %d", temp);
@@ -150,10 +145,21 @@ static void test_zone(int i)

        temp_high = temp + TEMP_INCREMENT;

-       snprintf(trip_path, PATH_MAX, "/sys/class/thermal/thermal_zone%d/trip_point_1_temp", i);
-
        tst_res(TDEBUG, "Setting new trip_point_1_temp value: %d", temp_high);
        SAFE_FILE_PRINTF(trip_path, "%d", temp_high);
+}
+
+static void test_zone(int i)
+{
+       int sleep_time = SLEEPTIME;
+       double run_time = RUNTIME;
+
+       snprintf(temp_path, PATH_MAX, "/sys/class/thermal/thermal_zone%d/temp", i);
+       snprintf(trip_path, PATH_MAX, "/sys/class/thermal/thermal_zone%d/trip_point_1_temp", i);
+
+       tst_res(TINFO, "Testing %s", temp_path);
+
+       set_trippoint();

        while (sleep_time > 0) {
                tst_res(TDEBUG, "Running for %f seconds, then sleeping for %d seconds", run_time, sleep_time);
@@ -173,7 +179,9 @@ static void test_zone(int i)
                if (temp > temp_high)
                        break;
                sleep(sleep_time--);
-               run_time -= 3;
+               run_time--;
+
+               set_trippoint();
        }
 }


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-06-09 12:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 13:34 [LTP] [PATCH v21] thermal: add new test group Piotr Kubaj
2026-05-14 14:19 ` [LTP] " linuxtestproject.agent
2026-05-15 14:42   ` Petr Vorel
2026-05-18  8:11     ` Kubaj, Piotr
2026-05-27  7:28       ` Kubaj, Piotr
2026-05-27 19:45         ` Petr Vorel
2026-06-09 12:24         ` Cyril Hrubis [this message]
2026-06-10  8:02           ` Kubaj, Piotr
2026-06-12 14:12             ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2026-05-14  9:36 [LTP] [PATCH v20] " Piotr Kubaj
2026-05-14 12:00 ` [LTP] " linuxtestproject.agent
2026-05-15 14:39   ` Petr Vorel
2026-05-06 11:24 [LTP] [PATCH v19] " Piotr Kubaj
2026-05-06 14:16 ` [LTP] " linuxtestproject.agent
2026-05-06 14:23   ` Andrea Cervesato via ltp
2026-04-30  8:42 [LTP] [PATCH v18] " Piotr Kubaj
2026-04-30  9:18 ` [LTP] " linuxtestproject.agent
2026-04-30 11:28   ` Kubaj, Piotr
2026-04-28 12:46 [LTP] [PATCH v17] " Piotr Kubaj
2026-04-28 14:41 ` [LTP] " linuxtestproject.agent

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=aigF9StEMr3oNPFD@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=piotr.kubaj@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