Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>
Cc: robh@kernel.org, linux-hwmon@vger.kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [hwmon-next PATCH v5 4/4] hwmon: (adt7470) Add thermal zone sensor support
Date: Thu, 30 Jul 2026 21:43:13 +0000	[thread overview]
Message-ID: <20260730214314.427691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730-adt7470_thermalzone-v5-4-42995a6bb8c5@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Registering the device as a thermal zone exposes the thermal subsystem to severe latency stalls.
--

--- Patch [4]: [hwmon-next PATCH v5 4/4] hwmon: (adt7470) Add thermal zone sensor support ---
commit ee08dfc4b8ac9e072681b3ebf92b63eb473bf1a7
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>

hwmon: (adt7470) Add thermal zone sensor support

This commit registers the ADT7470 temperature channels as thermal zone
sensors.

> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index eeec3db0da88d..f652532f2f32e 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -1396,6 +1396,8 @@ static const struct hwmon_ops adt7470_hwmon_ops = {
>  };
>  
>  static const struct hwmon_channel_info * const adt7470_info[] = {
> +	HWMON_CHANNEL_INFO(chip,
> +			   HWMON_C_REGISTER_TZ),

[Severity: High]
Will registering this device as a thermal zone cause severe latency stalls
for the thermal subsystem?

Looking at the background thread in the driver, it acquires the internal lock
before initiating a slow temperature read:

adt7470_update_thread() {
    ...
    mutex_lock(&data->lock);
    adt7470_read_temperatures(data);
    mutex_unlock(&data->lock);
    ...
}

Inside adt7470_read_temperatures(), the thread can sleep for up to 2 seconds
while still holding this lock:

adt7470_read_temperatures() {
    ...
    res = msleep_interruptible((data->num_temp_sensors >= 0 ?
                                data->num_temp_sensors * 200 :
                                TEMP_COLLECTION_TIME));
    ...
}

Since thermal zone registration causes the thermal core to automatically
and periodically poll the device, the thermal worker thread will attempt to
acquire data->lock. Because the lock is held for up to 2 seconds by the
background kthread, the thermal polling thread will be frequently delayed.

Additionally, while the thermal thread waits for data->lock, it also holds
the core hwdev->lock, which means any other userspace sysfs reads or writes
to this hwmon device will also stall.

Could this delay thermal mitigations for other devices on the system?

>  	HWMON_CHANNEL_INFO(temp,
>  			   HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | HWMON_T_ALARM,
>  			   HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | HWMON_T_ALARM,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-adt7470_thermalzone-v5-0-42995a6bb8c5@gmail.com?part=4

      reply	other threads:[~2026-07-30 21:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 21:29 [hwmon-next PATCH v5 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
2026-07-30 21:29 ` [hwmon-next PATCH v5 1/4] dt-bindings: hwmon: add adi,adt7470 Luiz Angelo Daros de Luca
2026-07-30 21:34   ` sashiko-bot
2026-07-30 21:29 ` [hwmon-next PATCH v5 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
2026-07-30 21:35   ` sashiko-bot
2026-07-30 21:29 ` [hwmon-next PATCH v5 3/4] hwmon: (adt7470) Expose fan control via PWM framework Luiz Angelo Daros de Luca
2026-07-30 21:39   ` sashiko-bot
2026-07-30 21:29 ` [hwmon-next PATCH v5 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
2026-07-30 21:43   ` sashiko-bot [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=20260730214314.427691F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=luizluca@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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