From: sashiko-bot@kernel.org
To: "Sergio Melas" <sergiomelas@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v12] hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoring
Date: Mon, 03 Aug 2026 19:04:50 +0000 [thread overview]
Message-ID: <20260803190450.B57FD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803184206.18465-1-sergiomelas@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The MIN_SAMPLING rate limit fails to prevent excessive ACPI queries to the EC because the check occurs after the ACPI evaluation.
--
--- Patch [1]: [PATCH v12] hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoring ---
commit c15f7b338b1cdd81a16c2f92f8d5807ac9a0b7da
Author: Sergio Melas <sergiomelas@gmail.com>
hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoring
This driver provides fan speed monitoring for modern Lenovo consumer
laptops by interfacing with the Embedded Controller (EC) via ACPI.
To address low-resolution sampling in Lenovo EC firmware, a Rate-Limited
Lag (RLLag) filter is implemented. The filter ensures a consistent physical
curve regardless of userspace polling frequency.
> diff --git a/drivers/hwmon/yogafan.c b/drivers/hwmon/yogafan.c
> index 0a41b8672b56e..371e35895f584 100644
> --- a/drivers/hwmon/yogafan.c
> +++ b/drivers/hwmon/yogafan.c
[ ... ]
> @@ -77,6 +78,18 @@ static const struct yogafan_config loq_15iax9_8bit_dual_cfg = {
> .paths = { "\\_SB.PC00.LPCB.EC0.FA1S", "\\_SB.PC00.LPCB.EC0.FA2S" }
> };
>
> +static const struct yogafan_config xiaoxin_8bit_dual_cfg = {
> + .multiplier = 100,
> + .fan_count = 2,
> + .paths = { "\\_SB.PCI0.LPC0.EC0.FANS", "\\_SB.PCI0.LPC0.EC0.FA2S" }
> +};
> +
> +static const struct yogafan_config yoga_pro_7_14iah10_cfg = {
> + .multiplier = 100,
> + .fan_count = 1,
> + .paths = { "\\_SB.PC00.LPCB.EC0.FANS", NULL }
> +};
> +
> static void apply_rllag_filter(struct yoga_fan_data *data, int idx, long raw_rpm)
> {
[Severity: High]
Does the MIN_SAMPLING rate limit effectively prevent excessive ACPI queries?
Looking at yoga_fan_read(), it appears the expensive ACPI evaluation happens
unconditionally before the filter is applied:
drivers/hwmon/yogafan.c:yoga_fan_read() {
...
status = acpi_evaluate_integer(data->active_handles[channel], NULL, NULL, &raw_acpi);
if (ACPI_FAILURE(status))
return -EIO;
apply_rllag_filter(data, channel, (long)raw_acpi * data->multiplier);
...
}
Even though apply_rllag_filter() skips math updates when dt_ms < MIN_SAMPLING,
the hardware ACPI query has already been executed.
Since the sysfs fanX_input file has 0444 permissions, could an unprivileged
local user continuously read it in a tight loop and cause an EC saturation,
leading to system stalls and keyboard/mouse lag?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803184206.18465-1-sergiomelas@gmail.com?part=1
next prev parent reply other threads:[~2026-08-03 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 18:42 [PATCH v12] hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoring Sergio Melas
2026-08-03 19:04 ` sashiko-bot [this message]
2026-08-05 21:42 ` Guenter Roeck
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=20260803190450.B57FD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sergiomelas@gmail.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