[PATCH 1/2] nvme: define the SMART / Health Status async event bit

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Nov 9 04:09:16 PST 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvme: NVME_AEN_BIT_SMART and NVME_AEN_CFG_SMART use wrong
  OAES/CFG bit
--

commit be7079eb32755ede896d21f96ed7d1785a179279
Author: Guixin Liu <kanie at linux.alibaba.com>

nvme: define the SMART / Health Status async event bit

This commit adds NVME_AEN_BIT_SMART and NVME_AEN_CFG_SMART definitions to
include/linux/nvme.h.

> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 6248711784b37..2b4f8e269d12d 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -867,6 +867,7 @@ enum {
>  };
>  
>  enum {
> +	NVME_AEN_BIT_SMART		= 1,
>  	NVME_AEN_BIT_NS_ATTR		= 8,
>  	NVME_AEN_BIT_FW_ACT		= 9,
>  	NVME_AEN_BIT_ANA_CHANGE		= 11,
> @@ -874,6 +875,7 @@ enum {
>  };
>  
>  enum {
> +	NVME_AEN_CFG_SMART		= 1 << NVME_AEN_BIT_SMART,
>  	NVME_AEN_CFG_NS_ATTR		= 1 << NVME_AEN_BIT_NS_ATTR,
>  	NVME_AEN_CFG_FW_ACT		= 1 << NVME_AEN_BIT_FW_ACT,
>  	NVME_AEN_CFG_ANA_CHANGE		= 1 << NVME_AEN_BIT_ANA_CHANGE,

[Severity: Medium]
Do NVME_AEN_BIT_SMART and NVME_AEN_CFG_SMART match the NVMe specification
for Identify Controller OAES and NVME_FEAT_ASYNC_EVENT?

The value 1 is the Asynchronous Event Type (NVME_AER_SMART = 1) reported
in CQE DW0 bits 2:0, not an OAES or Asynchronous Event Configuration bit.
In the NVMe Base Specification, SMART / Health Critical Warning events are
mandatory, so bits 7:0 of OAES are reserved and zero on compliant
controllers. Checking ctrl->oaes & NVME_AEN_CFG_SMART will therefore find
the bit cleared and never subscribe to the event.

In the NVME_FEAT_ASYNC_EVENT feature (CDW11), bits 7:0 are individual
Critical Warning bitmasks corresponding to byte 0 of struct nvme_smart_log,
already defined right above in include/linux/nvme.h as
NVME_SMART_CRIT_SPARE through NVME_SMART_CRIT_VOLATILE_MEMORY (and used by
NVMET_AEN_CFG_ALL in drivers/nvme/target/nvmet.h). Passing 1 << 1 to Set
Features only enables NVME_SMART_CRIT_TEMPERATURE and leaves spare,
reliability, media, and volatile memory warnings disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109120207.1352165-1-kanie@linux.alibaba.com?part=1



More information about the Linux-nvme mailing list