public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Mallesh, Koujalagi" <mallesh.koujalagi@intel.com>
To: Karthik Poosa <karthik.poosa@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <badal.nilawar@intel.com>,
	<riana.tauro@intel.com>, <rodrigo.vivi@intel.com>,
	<raag.jadav@intel.com>
Subject: Re: [PATCH i-g-t] tests/intel/hwmon: Check temperature limit in hwmon-read
Date: Tue, 13 Jan 2026 19:12:03 +0530	[thread overview]
Message-ID: <cd5dbc88-8a0e-4c7d-a0c8-1eb2f3852965@intel.com> (raw)
In-Reply-To: <20251211194251.16988-1-karthik.poosa@intel.com>

Hi Karthik,

On 12-12-2025 01:12 am, Karthik Poosa wrote:
> Improve hwmon-read test to check if current temperature
> is above critical temperature limit in hwmon-read test.
> This will help identify any thermal issues with the
> setups during test runs.
>
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> ---
>   tests/intel/intel_hwmon.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>
> diff --git a/tests/intel/intel_hwmon.c b/tests/intel/intel_hwmon.c
> index 103ae69cd..b19868440 100644
> --- a/tests/intel/intel_hwmon.c
> +++ b/tests/intel/intel_hwmon.c
> @@ -26,6 +26,25 @@
>   
>   IGT_TEST_DESCRIPTION("Tests for intel hwmon");
>   
> +static void check_if_temp_valid(int hwm, char *sysfs_name, u32 cur_val)
> +{
> +	char str[32] = {0};
> +	uint8_t ch = 0;
> +	s32 limit = 0;
> +
> +	sscanf(sysfs_name, "temp%hhu_%s", &ch, str);

Please add sscanf validation

> +
> +	/* If entry is tempX_input, check if it exceeds tempX_crit. */
> +	if (!strncmp(sysfs_name, "temp", 4) && !strncmp(str, "input", 5)) {
> +		sprintf(str, "temp%d_crit", ch);

ch type inconsistency (%hhu and %d)

Thanks

-/Mallesh

> +		if (!faccessat(hwm, str, R_OK, 0)) {
> +			igt_assert_lt(0, igt_sysfs_scanf(hwm, str, "%d", &limit));
> +			igt_debug("current value = %d limit = %d\n", cur_val, limit);
> +			igt_assert_f(cur_val <= limit, "current temperature exceeds limit!\n");
> +		}
> +	}
> +}
> +
>   static void hwmon_read(int hwm)
>   {
>   	struct dirent *de;
> @@ -43,6 +62,8 @@ static void hwmon_read(int hwm)
>   		igt_assert(igt_sysfs_scanf(hwm, de->d_name, "%127s", val) == 1);
>   		igt_debug("'%s': %s\n", de->d_name, val);
>   
> +		check_if_temp_valid(hwm, de->d_name, atoi(val));
> +
>   	}
>   	closedir(dir);
>   }

      parent reply	other threads:[~2026-01-13 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 19:42 [PATCH i-g-t] tests/intel/hwmon: Check temperature limit in hwmon-read Karthik Poosa
2025-12-11 21:10 ` ✓ i915.CI.BAT: success for " Patchwork
2025-12-11 21:26 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-12  8:12 ` ✗ i915.CI.Full: failure " Patchwork
2025-12-12 12:59 ` ✗ Xe.CI.Full: " Patchwork
2026-01-13 13:42 ` Mallesh, Koujalagi [this message]

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=cd5dbc88-8a0e-4c7d-a0c8-1eb2f3852965@intel.com \
    --to=mallesh.koujalagi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@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