Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: Nilay Shroff <nilay@linux.ibm.com>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3 1/1] nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN
Date: Tue, 24 Nov 2026 19:23:20 +0800	[thread overview]
Message-ID: <dca7ae80-e1a7-40e3-9d9e-4e86079b1f89@linux.alibaba.com> (raw)
In-Reply-To: <47f4ec19-9e86-45f4-947a-6e00d0bf9c06@linux.ibm.com>



在 2026/11/24 16:08, Nilay Shroff 写道:
> On 11/23/26 4:53 PM, Guixin Liu wrote:
>> +static void nvme_hwmon_smart_notify(struct work_struct *work)
>> +{
>> +    struct nvme_ctrl *ctrl =
>> +        container_of(work, struct nvme_ctrl, smart_work);
>> +    struct nvme_hwmon_data *data;
>> +    struct device *hwmon;
>> +    bool warn = false;
>> +
>> +    if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE)
>> +        return;
>> +
>> +    hwmon = ctrl->hwmon_device;
>> +    if (!hwmon)
>> +        return;
>> +    data = dev_get_drvdata(hwmon);
>> +
>> +    mutex_lock(&data->read_lock);
>> +    if (!nvme_hwmon_get_smart_log(data))
>> +        warn = data->log->critical_warning & NVME_SMART_CRIT_TEMPERATURE;
>> +    mutex_unlock(&data->read_lock);
>> +
>> +    if (warn)
>> +        hwmon_notify_event(hwmon, hwmon_temp, hwmon_temp_alarm, 0);
>> +}
>> +
> We only generate the notification if the NVME_SMART_CRIT_TEMPERATURE bit is set
> in the SMART/Health log page. However, consider the following scenario:
> the host receives a SMART/Health asynchronous event and schedules smart_work, but
> by the time the work executes and reads the SMART/Health log page, the temperature
> has already returned to the normal range.
>
> In that case, the returned log page may no longer have the
> NVME_SMART_CRIT_TEMPERATURE bit set, causing us to skip the notification
> even though a temperature-threshold event was reported.
>
> Perhaps we should also examine aer_subtype and, when it indicates a temperature-
> threshold event, generate the hwmon notification regardless of whether the
> corresponding temperature bit is currently set in the SMART/Health log page.
That makes sense, Change this in v4, thanks. 

Best Regards,
Guixin Liu
>
> Other than this, the rest of the changes look good to me.
>
> Thanks,
> --Nilay



      reply	other threads:[~2026-11-24 11:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 11:23 [PATCH v3 0/1] nvme: make SMART / Health Status AENs reach hwmon alarms Guixin Liu
2026-11-23 11:23 ` [PATCH v3 1/1] nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN Guixin Liu
2026-11-24  8:08   ` Nilay Shroff
2026-11-24 11:23     ` Guixin Liu [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=dca7ae80-e1a7-40e3-9d9e-4e86079b1f89@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nilay@linux.ibm.com \
    --cc=sagi@grimberg.me \
    /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