linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] nvme: enable smart AEN
@ 2022-05-07  6:50 zhenwei pi
  2022-05-07  6:50 ` [PATCH 1/3] nvme: introduce bit 5 of smart critical warning zhenwei pi
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-07  6:50 UTC (permalink / raw)
  To: kbusch, hch; +Cc: sagi, axboe, linux-nvme, linux-kernel, zhenwei pi

Hi,

There are several changes in this series:
- Add missing NVME_SMART_CRIT_PMR_UNRELIABLE enum type.
- Add missing NVME_AEN_CFG_SMART_CRIT_* enum types.
- Enable smart AEN.

zhenwei pi (3):
  nvme: introduce bit 5 of smart critical warning
  nvme: introduce smart bits of aen cfg
  nvme: enable smart AEN

 drivers/nvme/host/core.c |  6 +++++-
 include/linux/nvme.h     | 20 ++++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] nvme: introduce bit 5 of smart critical warning
  2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
@ 2022-05-07  6:50 ` zhenwei pi
  2022-05-10  5:49   ` Christoph Hellwig
  2022-05-07  6:50 ` [PATCH 2/3] nvme: introduce smart bits of aen cfg zhenwei pi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: zhenwei pi @ 2022-05-07  6:50 UTC (permalink / raw)
  To: kbusch, hch; +Cc: sagi, axboe, linux-nvme, linux-kernel, zhenwei pi

According to NVM Express v1.4, Section 5.14.1.2 ("SMART / Health
Information"), introduce bit 5 for "Persistent Memory Region has become
read-only or unreliable".

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 include/linux/nvme.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index f626a445d1a8..882ad7523127 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -662,6 +662,7 @@ enum {
 	NVME_SMART_CRIT_RELIABILITY	= 1 << 2,
 	NVME_SMART_CRIT_MEDIA		= 1 << 3,
 	NVME_SMART_CRIT_VOLATILE_MEMORY	= 1 << 4,
+	NVME_SMART_CRIT_PMR_UNRELIABLE	= 1 << 5,
 };
 
 enum {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] nvme: introduce smart bits of aen cfg
  2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
  2022-05-07  6:50 ` [PATCH 1/3] nvme: introduce bit 5 of smart critical warning zhenwei pi
@ 2022-05-07  6:50 ` zhenwei pi
  2022-05-07  6:50 ` [PATCH 3/3] nvme: enable smart AEN zhenwei pi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-07  6:50 UTC (permalink / raw)
  To: kbusch, hch; +Cc: sagi, axboe, linux-nvme, linux-kernel, zhenwei pi

According to NVM Express v1.4, Section 5.21.1.11 (Asynchronous Event
Configuration), introduce bit 0 ~ bit 5.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 include/linux/nvme.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 882ad7523127..e9f1563ab878 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -688,10 +688,21 @@ enum {
 };
 
 enum {
-	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,
-	NVME_AEN_CFG_DISC_CHANGE	= 1 << NVME_AEN_BIT_DISC_CHANGE,
+	/*
+	 * NVMe SPEC 1.4: 5.21.1.11 Asynchronous Event Configuration
+	 * bits 07:00: SMART / Health Critical Warnings
+	 */
+	NVME_AEN_CFG_SMART_CRIT_SPARE		= NVME_SMART_CRIT_SPARE,
+	NVME_AEN_CFG_SMART_CRIT_TEMPERATURE	= NVME_SMART_CRIT_TEMPERATURE,
+	NVME_AEN_CFG_SMART_CRIT_RELIABILITY	= NVME_SMART_CRIT_RELIABILITY,
+	NVME_AEN_CFG_SMART_CRIT_MEDIA		= NVME_SMART_CRIT_MEDIA,
+	NVME_AEN_CFG_SMART_CRIT_VOLATILE_MEMORY	= NVME_SMART_CRIT_VOLATILE_MEMORY,
+	NVME_AEN_CFG_SMART_CRIT_PMR_UNRELIABLE	= NVME_SMART_CRIT_PMR_UNRELIABLE,
+
+	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,
+	NVME_AEN_CFG_DISC_CHANGE		= 1 << NVME_AEN_BIT_DISC_CHANGE,
 };
 
 struct nvme_lba_range_type {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] nvme: enable smart AEN
  2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
  2022-05-07  6:50 ` [PATCH 1/3] nvme: introduce bit 5 of smart critical warning zhenwei pi
  2022-05-07  6:50 ` [PATCH 2/3] nvme: introduce smart bits of aen cfg zhenwei pi
@ 2022-05-07  6:50 ` zhenwei pi
  2022-05-09 12:41 ` [PATCH 0/3] " zhenwei pi
  2022-05-10 19:13 ` Sagi Grimberg
  4 siblings, 0 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-07  6:50 UTC (permalink / raw)
  To: kbusch, hch; +Cc: sagi, axboe, linux-nvme, linux-kernel, zhenwei pi

Try to enable AEN on host side, this is helpful to minitor the
critical warning from the NVMe controller.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 drivers/nvme/host/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e1846d04817f..f386a4f1d434 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1490,8 +1490,12 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
 }
 EXPORT_SYMBOL_GPL(nvme_set_queue_count);
 
+#define NVME_AEN_SMART \
+	(NVME_AEN_CFG_SMART_CRIT_SPARE | NVME_AEN_CFG_SMART_CRIT_TEMPERATURE | \
+	 NVME_AEN_CFG_SMART_CRIT_RELIABILITY | NVME_AEN_CFG_SMART_CRIT_MEDIA | \
+	 NVME_AEN_CFG_SMART_CRIT_VOLATILE_MEMORY | NVME_AEN_CFG_SMART_CRIT_PMR_UNRELIABLE)
 #define NVME_AEN_SUPPORTED \
-	(NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT | \
+	(NVME_AEN_SMART | NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT | \
 	 NVME_AEN_CFG_ANA_CHANGE | NVME_AEN_CFG_DISC_CHANGE)
 
 static void nvme_enable_aen(struct nvme_ctrl *ctrl)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] nvme: enable smart AEN
  2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
                   ` (2 preceding siblings ...)
  2022-05-07  6:50 ` [PATCH 3/3] nvme: enable smart AEN zhenwei pi
@ 2022-05-09 12:41 ` zhenwei pi
  2022-05-10 19:13 ` Sagi Grimberg
  4 siblings, 0 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-09 12:41 UTC (permalink / raw)
  To: kbusch, hch; +Cc: sagi, axboe, linux-nvme, linux-kernel

Hi,

Sorry, I misunderstand OAES[7:0], only the first patch "nvme: introduce 
bit 5 of smart critical warning" is available.

On 5/7/22 14:50, zhenwei pi wrote:
> Hi,
> 
> There are several changes in this series:
> - Add missing NVME_SMART_CRIT_PMR_UNRELIABLE enum type.
> - Add missing NVME_AEN_CFG_SMART_CRIT_* enum types.
> - Enable smart AEN.
> 
> zhenwei pi (3):
>    nvme: introduce bit 5 of smart critical warning
>    nvme: introduce smart bits of aen cfg
>    nvme: enable smart AEN
> 
>   drivers/nvme/host/core.c |  6 +++++-
>   include/linux/nvme.h     | 20 ++++++++++++++++----
>   2 files changed, 21 insertions(+), 5 deletions(-)
> 

-- 
zhenwei pi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] nvme: introduce bit 5 of smart critical warning
  2022-05-07  6:50 ` [PATCH 1/3] nvme: introduce bit 5 of smart critical warning zhenwei pi
@ 2022-05-10  5:49   ` Christoph Hellwig
  2022-05-10  6:44     ` zhenwei pi
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2022-05-10  5:49 UTC (permalink / raw)
  To: zhenwei pi; +Cc: kbusch, hch, sagi, axboe, linux-nvme, linux-kernel

On Sat, May 07, 2022 at 02:50:24PM +0800, zhenwei pi wrote:
> According to NVM Express v1.4, Section 5.14.1.2 ("SMART / Health
> Information"), introduce bit 5 for "Persistent Memory Region has become
> read-only or unreliable".

Given that Linux does not support the PMR, do we really need this?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH 1/3] nvme: introduce bit 5 of smart critical warning
  2022-05-10  5:49   ` Christoph Hellwig
@ 2022-05-10  6:44     ` zhenwei pi
  0 siblings, 0 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-10  6:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kbusch, sagi, axboe, linux-nvme, linux-kernel



On 5/10/22 13:49, Christoph Hellwig wrote:
> On Sat, May 07, 2022 at 02:50:24PM +0800, zhenwei pi wrote:
>> According to NVM Express v1.4, Section 5.14.1.2 ("SMART / Health
>> Information"), introduce bit 5 for "Persistent Memory Region has become
>> read-only or unreliable".
> 
> Given that Linux does not support the PMR, do we really need this?

OK, let's drop this change.

Klaus Jensen corrected me about OAES[7:0]. Sorry, I misunderstand this.

-- 
zhenwei pi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] nvme: enable smart AEN
  2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
                   ` (3 preceding siblings ...)
  2022-05-09 12:41 ` [PATCH 0/3] " zhenwei pi
@ 2022-05-10 19:13 ` Sagi Grimberg
  2022-05-11  0:02   ` zhenwei pi
  4 siblings, 1 reply; 9+ messages in thread
From: Sagi Grimberg @ 2022-05-10 19:13 UTC (permalink / raw)
  To: zhenwei pi, kbusch, hch; +Cc: axboe, linux-nvme, linux-kernel


> Hi,
> 
> There are several changes in this series:
> - Add missing NVME_SMART_CRIT_PMR_UNRELIABLE enum type.
> - Add missing NVME_AEN_CFG_SMART_CRIT_* enum types.
> - Enable smart AEN.

Is there another side to this patchset? meaning some userland agent
that listens to these events and does something with these?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH 0/3] nvme: enable smart AEN
  2022-05-10 19:13 ` Sagi Grimberg
@ 2022-05-11  0:02   ` zhenwei pi
  0 siblings, 0 replies; 9+ messages in thread
From: zhenwei pi @ 2022-05-11  0:02 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: axboe, linux-nvme, kbusch, hch, linux-kernel



On 5/11/22 03:13, Sagi Grimberg wrote:
> 
>> Hi,
>>
>> There are several changes in this series:
>> - Add missing NVME_SMART_CRIT_PMR_UNRELIABLE enum type.
>> - Add missing NVME_AEN_CFG_SMART_CRIT_* enum types.
>> - Enable smart AEN.
> 
> Is there another side to this patchset? meaning some userland agent
> that listens to these events and does something with these?

I tried to test SMART AEN end to end by QEMU NVMe emulation. I did not 
realize that the SMART AEN CFG is not optional.

Also sent this to QEMU(Klaus corrected me):
https://patchwork.kernel.org/project/qemu-devel/cover/20220507072644.263105-1-pizhenwei@bytedance.com/

-- 
zhenwei pi

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-11  0:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07  6:50 [PATCH 0/3] nvme: enable smart AEN zhenwei pi
2022-05-07  6:50 ` [PATCH 1/3] nvme: introduce bit 5 of smart critical warning zhenwei pi
2022-05-10  5:49   ` Christoph Hellwig
2022-05-10  6:44     ` zhenwei pi
2022-05-07  6:50 ` [PATCH 2/3] nvme: introduce smart bits of aen cfg zhenwei pi
2022-05-07  6:50 ` [PATCH 3/3] nvme: enable smart AEN zhenwei pi
2022-05-09 12:41 ` [PATCH 0/3] " zhenwei pi
2022-05-10 19:13 ` Sagi Grimberg
2022-05-11  0:02   ` zhenwei pi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).