From: sashiko-bot@kernel.org
To: "Changhuang Liang" <changhuang.liang@starfivetech.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 2/2] hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100
Date: Wed, 19 Aug 2026 15:58:46 +0000 [thread overview]
Message-ID: <20260819155846.A3FCC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819091601.41077-3-changhuang.liang@starfivetech.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Alarm attributes violate the hwmon ABI (sticky semantics) and hold a global mutex across a 200ms sleep, forcing strict serialization and massive latency.
--
--- Patch [2]: [PATCH v2 2/2] hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100 ---
commit f832cfa14cd6c4c786efa0a34afc865eca6dcf71
Author: Changhuang Liang <changhuang.liang@starfivetech.com>
Subject: hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100
This commit adds a fan tachometer driver for the StarFive JHB100 SoC. It
supports up to 16 independent fan tachometer inputs and reports fan speed,
stall, and low-speed alarms through the hwmon sysfs interface.
> diff --git a/drivers/hwmon/starfive-fan-tach.c b/drivers/hwmon/starfive-fan-tach.c
> new file mode 100644
> index 0000000000000..1e6399db424dc
> --- /dev/null
> +++ b/drivers/hwmon/starfive-fan-tach.c
[ ... ]
> +static int starfive_fan_tach_hwmon_read(struct device *dev,
> + enum hwmon_sensor_types type, u32 attr,
> + int channel, long *val)
> +{
> + struct starfive_fan_tach_data *priv = dev_get_drvdata(dev);
> + int ret = 0;
> +
> + switch (attr) {
> + case hwmon_fan_fault:
> + scoped_guard(mutex, &priv->lock) {
> + scoped_guard(spinlock_irqsave, &priv->irq_lock) {
> + writel(STARFIVE_FAN_TACH_STALL_INT(channel),
> + priv->regs + STARFIVE_FAN_TACH_STATUS);
> + /* clear fan_stall first */
> + priv->fan_stall[channel] = 0;
> + reinit_completion(&priv->comp_stall[channel]);
> + priv->armed_stall |= BIT(channel);
> + }
> +
> + starfive_fan_tach_ch_stall_unmask(priv, channel, true);
> +
> + /* Waiting for hardware to measure */
> + wait_for_completion_timeout(&priv->comp_stall[channel],
> + 2 * STARFIVE_FAN_TACH_TIMEOUT_JIFFIES);
[Severity: Medium]
Does reading the fault attribute violate the hwmon ABI by blocking to poll the
hardware instead of returning instantaneous sticky status?
Also, because wait_for_completion_timeout() is called inside
scoped_guard(mutex, &priv->lock), doesn't this hold the global mutex across a
200ms sleep?
If a user tool (like sensors) sequentially reads the alarms for all 16 channels,
could this stall the reader for over 6 seconds and block all other concurrent
reads/writes to this device?
[ ... ]
> + case hwmon_fan_min_alarm:
> + scoped_guard(mutex, &priv->lock) {
> + scoped_guard(spinlock_irqsave, &priv->irq_lock) {
> + writel(STARFIVE_FAN_TACH_SLOW_INT(channel),
> + priv->regs + STARFIVE_FAN_TACH_STATUS);
> + /* clear fan_slow first */
> + priv->fan_slow[channel] = 0;
> + reinit_completion(&priv->comp_slow[channel]);
> + priv->armed_slow |= BIT(channel);
> + }
> +
> + starfive_fan_tach_ch_slow_unmask(priv, channel, true);
> +
> + /* Waiting for hardware to measure */
> + wait_for_completion_timeout(&priv->comp_slow[channel],
> + 2 * STARFIVE_FAN_TACH_TIMEOUT_JIFFIES);
[Severity: Medium]
Similar to the fault attribute above, does reading the min_alarm attribute
violate the hwmon ABI by blocking instead of returning a sticky status?
Does holding the global mutex during this sleep similarly risk blocking
concurrent device accesses and causing long stalls when reading multiple
channels?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819091601.41077-1-changhuang.liang@starfivetech.com?part=2
prev parent reply other threads:[~2026-08-19 15:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 9:15 [PATCH v2 0/2] Add JHB100 Fan-Tach support Changhuang Liang
2026-08-19 9:16 ` [PATCH v2 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach Changhuang Liang
2026-08-19 15:55 ` sashiko-bot
2026-08-19 9:16 ` [PATCH v2 2/2] hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100 Changhuang Liang
2026-08-19 15:58 ` 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=20260819155846.A3FCC1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=changhuang.liang@starfivetech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.