Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76425606A33B for ; Tue, 24 Nov 2026 12:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pLgtawZQ; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=Re+NSUR6 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=EGUmYCdNwiCTn3cOivJnjcYM83eGKlipi8jwbNYaMxY=; b=pLgtawZQ78lw+qOK01VSiLC8k9 JO/JcuPglmWGe0fJ0w7c6T20Z7sCAdn7fCbam2651ge518fnGD9dKmUdB/gwkh7lBSGIKHxPA3Lib mgVzRGTmpzXo73YjmyXdTULz1uE7YdPGg18uiWxY4qyycaPiGbMKwb687ed+0fcEIEOsO5gw/A5EH zNCg4CuiA8C5Q5Hs9H8DpNxamvKJCNAIXCcIfDlkNjq7FdZbim/8vF9kZjXar18WpvLvVl4dfEuHp O+2iAieMDjovAbefQjaoevbtXu35g6s0hrT6gn9SvQw5uMsPBpiq8u6S1WnFsVCll6iarl+RDhhJP O30ElO6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVpCu-00000006Rtd-2GSQ; Tue, 24 Nov 2026 12:01:08 +0000 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVpCl-00000006Rqh-36gx for linux-nvme@lists.infradead.org; Tue, 24 Nov 2026 12:01:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1795521657; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=EGUmYCdNwiCTn3cOivJnjcYM83eGKlipi8jwbNYaMxY=; b=Re+NSUR6ys3I5THHVx0WjNamN9sucSvEW57zy2mv6JMl6kuK4qabZD4ovQp6pBk2lJQbIEt4hhjz7EVszsifsf7N9taXNWbdE4rN+XfPAjefcs4vFpEN1Obi2X6aLvP0wXLXAnY4VC2aX8b6CzvsLR2HVcIn/KzGE354aD4oEuc= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XFOVbMH_1795521655; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0XFOVbMH_1795521655 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Nov 2026 20:00:56 +0800 From: Guixin Liu To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Nilay Shroff , Daniel Wagner , Hannes Reinecke Cc: linux-nvme@lists.infradead.org Subject: [PATCH v4 0/3] nvme: make SMART / Health Status AENs reach hwmon alarms Date: Tue, 24 Nov 2026 20:00:29 +0800 Message-ID: <20261124120032.1824788-1-kanie@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261124_040100_196561_2F818A61 X-CRM114-Status: GOOD ( 13.20 ) X-Spam-Score: -17.6 (-----------------) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-21.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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