[PATCH 0/2] nvme: make SMART / Health Status AENs reach hwmon alarms
Guixin Liu
kanie at linux.alibaba.com
Mon Nov 9 04:02:02 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 or spare-block condition. The device does send a
SMART / Health Status asynchronous event when its health status
changes, but the host never subscribes to it, and the completion path
silently drops the event.
This series wires the event through:
Patch 1 defines the missing OAES bit in the uapi header.
Patch 2 subscribes to the event and wakes pollers on temp1_alarm.
The alarm read fetches the SMART log on demand, so the completion path
only queues a work item to call sysfs_notify() — nvme-pci completes
asynchronous events from interrupt context, where sysfs_notify() cannot
sleep.
Testing: verified end to end against QEMU's nvme emulation (with a
one-line local patch reporting OAES bit 1, matching an NVMe 2.0
device): 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.
Guixin Liu (2):
nvme: define the SMART / Health Status async event bit
nvme-hwmon: notify hwmon alarms on the SMART / Health Status AEN
drivers/nvme/host/core.c | 8 ++++++--
drivers/nvme/host/hwmon.c | 30 ++++++++++++++++++++++++++++++
drivers/nvme/host/nvme.h | 5 +++++
include/linux/nvme.h | 2 ++
4 files changed, 43 insertions(+), 2 deletions(-)
Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
--
2.43.7
More information about the Linux-nvme
mailing list