[PATCH v2 0/1] nvme: make SMART / Health Status AENs reach hwmon alarms

Guixin Liu kanie at linux.alibaba.com
Tue Nov 10 03:07:36 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), the deferred work re-reads
the SMART log to clear the latched event before the Asynchronous Event
Request is re-armed, and the alarm is announced with
hwmon_notify_event(), which also feeds the registered thermal zone.

Testing: verified end to end against vanilla 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.

Changes since v1:

 - drop the uapi patch defining an OAES bit for the SMART event: OAES
   bits 7:0 are reserved; the warning is configured through the
   SMART / Health Critical Warnings field of the Asynchronous Event
   Configuration feature (sashiko)
 - subscribe to the temperature warning unconditionally when hwmon is
   present, instead of masking against ctrl->oaes (sashiko)
 - re-read the SMART log in the deferred work to clear the latched
   event before the Asynchronous Event Request is re-armed, closing an
   AEN completion tight loop (sashiko)
 - call hwmon_notify_event() instead of sysfs_notify(), so the thermal
   zone registered with HWMON_C_REGISTER_TZ is fed as well (sashiko)
 - correct the cover letter: temp1_alarm reflects the temperature
   warning only, not the spare-block condition

Link: https://lore.kernel.org/all/20261109120207.1352165-1-kanie@linux.alibaba.com/

Guixin Liu (1):
  nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN

 drivers/nvme/host/core.c  | 17 ++++++++++++++++-
 drivers/nvme/host/hwmon.c | 40 +++++++++++++++++++++++++++++++++++++++
 drivers/nvme/host/nvme.h  | 15 +++++++++++++++
 3 files changed, 71 insertions(+), 1 deletion(-)

Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>

-- 
2.43.7




More information about the Linux-nvme mailing list