[PATCH v4 0/3] nvme: make SMART / Health Status AENs reach hwmon alarms
Guixin Liu
kanie at linux.alibaba.com
Tue Nov 24 04:00:29 PST 2026
The NVMe hwmon support exposes the temperature alarm as a plain sysfs
attribute, so monitoring tools have to poll temp1_alarm to learn about
a critical temperature condition. The device does send a SMART / Health
Status asynchronous event when a critical warning is raised, but the
host never enables it in the Asynchronous Event Configuration, and the
completion path silently drops the event.
The temperature warning is subscribed unconditionally when hwmon is
present (it has no OAES capability bit), a work item embedded in
nvme_ctrl re-reads the SMART log to clear the latched event -- the
same shape as the namespace scan reading the changed namespace list --
and the alarm is announced with hwmon_notify_event(), which also feeds
the registered thermal zone.
Testing: verified end to end against QEMU's nvme emulation: injecting
smart_critical_warning over QMP delivers the AEN, poll(2) on
temp1_alarm wakes immediately with EPOLLERR|EPOLLPRI and reads alarm=1;
clearing the warning produces no event and no spurious wake;
re-injecting the bit wakes again; enabling the spare-block warning
through an admin passthrough delivers the AEN without waking the
temperature alarm; a controller modeled to reject the critical warning
subscription with Invalid Field in Command falls back to the
notice-only mask, which a Get Features of the Asynchronous Event
Configuration confirms; a temperature event whose warning recovers
before the deferred log is read still wakes the poll with alarm=0.
Changes since v3:
- split the preparation into its own patches: an event bit enum for
nvme_ctrl::events, whose only bit was indexed with an AER subtype
value so far, and the SMART / Health Status asynchronous event
subtype values
- notify temp1_alarm when the event information indicates the
temperature threshold, not only when the re-read log still has the
temperature critical warning set, so that a transient excursion
that recovered before the log is read is still reported (Nilay
Shroff)
Link: https://lore.kernel.org/all/20261123112342.2761131-1-kanie@linux.alibaba.com/
Guixin Liu (3):
nvme: define an event bit enum for nvme_ctrl::events
nvme: define the SMART / Health Status async event subtypes
nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN
drivers/nvme/host/core.c | 32 +++++++++++++++++++++++++++----
drivers/nvme/host/hwmon.c | 37 +++++++++++++++++++++++++++++++++++++
drivers/nvme/host/nvme.h | 25 +++++++++++++++++++++++++
include/linux/nvme.h | 6 ++++++
4 files changed, 96 insertions(+), 4 deletions(-)
--
2.43.7
More information about the Linux-nvme
mailing list