All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] support NVMe smart critial warning injection
@ 2021-01-15  3:26 zhenwei pi
  2021-01-15  3:27 ` [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning zhenwei pi
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: zhenwei pi @ 2021-01-15  3:26 UTC (permalink / raw)
  To: kbusch, its, kwolf, mreitz; +Cc: zhenwei pi, philmd, qemu-devel, qemu-block

v3 -> v4:
- Drop "Fix overwritten bar.cap". (Already fixed)

- Avoid to enqueue the duplicate event.

- Several minor changes for coding style & function/variable name.

v2 -> v3:
- Introduce "Persistent Memory Region has become read-only or
  unreliable"

- Fix overwritten bar.cap

- Check smart critical warning value from QOM.

- Trigger asynchronous event during smart warning injection.

v1 -> v2:
- Suggested by Philippe & Klaus, set/get smart_critical_warning by QMP.

v1:
- Add smart_critical_warning for nvme device which can be set by QEMU
  command line to emulate hardware error.

Zhenwei Pi (3):
  block/nvme: introduce bit 5 for critical warning
  hw/block/nvme: add smart_critical_warning property
  hw/blocl/nvme: trigger async event during injecting smart warning

 hw/block/nvme.c      | 91 +++++++++++++++++++++++++++++++++++++++-----
 hw/block/nvme.h      |  1 +
 include/block/nvme.h |  3 ++
 3 files changed, 86 insertions(+), 9 deletions(-)

-- 
2.25.1



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

* [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning
  2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
@ 2021-01-15  3:27 ` zhenwei pi
  2021-01-15  9:19   ` Philippe Mathieu-Daudé
  2021-01-15  3:27 ` [PATCH v4 2/3] hw/block/nvme: add smart_critical_warning property zhenwei pi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: zhenwei pi @ 2021-01-15  3:27 UTC (permalink / raw)
  To: kbusch, its, kwolf, mreitz; +Cc: zhenwei pi, philmd, qemu-devel, qemu-block

According to NVMe spec 1.4 section
<SMART / Health Information (Log Identifier 02h)>, introduce bit 5
for "Persistent Memory Region has become read-only or unreliable".

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

diff --git a/include/block/nvme.h b/include/block/nvme.h
index 9494246f1f..0baf4b27cd 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -789,6 +789,7 @@ enum NvmeSmartWarn {
     NVME_SMART_RELIABILITY            = 1 << 2,
     NVME_SMART_MEDIA_READ_ONLY        = 1 << 3,
     NVME_SMART_FAILED_VOLATILE_MEDIA  = 1 << 4,
+    NVME_SMART_PMR_UNRELIABLE         = 1 << 5,
 };
 
 typedef struct NvmeEffectsLog {
-- 
2.25.1



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

* [PATCH v4 2/3] hw/block/nvme: add smart_critical_warning property
  2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
  2021-01-15  3:27 ` [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning zhenwei pi
@ 2021-01-15  3:27 ` zhenwei pi
  2021-01-15  3:27 ` [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning zhenwei pi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: zhenwei pi @ 2021-01-15  3:27 UTC (permalink / raw)
  To: kbusch, its, kwolf, mreitz; +Cc: zhenwei pi, philmd, qemu-devel, qemu-block

There is a very low probability that hitting physical NVMe disk
hardware critical warning case, it's hard to write & test a monitor
agent service.

For debugging purposes, add a new 'smart_critical_warning' property
to emulate this situation.

The orignal version of this change is implemented by adding a fixed
property which could be initialized by QEMU command line. Suggested
by Philippe & Klaus, rework like current version.

Test with this patch:
1, change smart_critical_warning property for a running VM:
 #virsh qemu-monitor-command nvme-upstream '{ "execute": "qom-set",
  "arguments": { "path": "/machine/peripheral-anon/device[0]",
  "property": "smart_critical_warning", "value":16 } }'
2, run smartctl in guest
 #smartctl -H -l error /dev/nvme0n1

  === START OF SMART DATA SECTION ===
  SMART overall-health self-assessment test result: FAILED!
  - volatile memory backup device has failed

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 hw/block/nvme.c      | 45 +++++++++++++++++++++++++++++++++++++++++---
 hw/block/nvme.h      |  1 +
 include/block/nvme.h |  1 +
 3 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 0854ee3072..2d71ebeb30 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -2425,6 +2425,7 @@ static uint16_t nvme_smart_info(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
     }
 
     trans_len = MIN(sizeof(smart) - off, buf_len);
+    smart.critical_warning = n->smart_critical_warning;
 
     smart.data_units_read[0] = cpu_to_le64(DIV_ROUND_UP(stats.units_read,
                                                         1000));
@@ -4346,6 +4347,40 @@ static Property nvme_props[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
+static void nvme_get_smart_warning(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    NvmeCtrl *n = NVME(obj);
+    uint8_t value = n->smart_critical_warning;
+
+    visit_type_uint8(v, name, &value, errp);
+}
+
+static void nvme_set_smart_warning(Object *obj, Visitor *v, const char *name,
+                                   void *opaque, Error **errp)
+{
+    NvmeCtrl *n = NVME(obj);
+    uint8_t value, cap = 0;
+
+    if (!visit_type_uint8(v, name, &value, errp)) {
+        return;
+    }
+
+    cap = NVME_SMART_SPARE | NVME_SMART_TEMPERATURE | NVME_SMART_RELIABILITY
+          | NVME_SMART_MEDIA_READ_ONLY | NVME_SMART_FAILED_VOLATILE_MEDIA;
+    if (NVME_CAP_PMR(n->bar.cap)) {
+        cap |= NVME_SMART_PMR_UNRELIABLE;
+    }
+
+    if ((value & cap) != value) {
+        error_setg(errp, "unsupported smart critical warning bits: 0x%x",
+                   value & ~cap);
+        return;
+    }
+
+    n->smart_critical_warning = value;
+}
+
 static const VMStateDescription nvme_vmstate = {
     .name = "nvme",
     .unmigratable = 1,
@@ -4369,13 +4404,17 @@ static void nvme_class_init(ObjectClass *oc, void *data)
 
 static void nvme_instance_init(Object *obj)
 {
-    NvmeCtrl *s = NVME(obj);
+    NvmeCtrl *n = NVME(obj);
 
-    if (s->namespace.blkconf.blk) {
-        device_add_bootindex_property(obj, &s->namespace.blkconf.bootindex,
+    if (n->namespace.blkconf.blk) {
+        device_add_bootindex_property(obj, &n->namespace.blkconf.bootindex,
                                       "bootindex", "/namespace@1,0",
                                       DEVICE(obj));
     }
+
+    object_property_add(obj, "smart_critical_warning", "uint8",
+                        nvme_get_smart_warning,
+                        nvme_set_smart_warning, NULL, NULL);
 }
 
 static const TypeInfo nvme_info = {
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index b7fbcca39d..bd5a2b416f 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -145,6 +145,7 @@ typedef struct NvmeCtrl {
     uint64_t    timestamp_set_qemu_clock_ms;    /* QEMU clock time */
     uint64_t    starttime_ms;
     uint16_t    temperature;
+    uint8_t     smart_critical_warning;
 
     HostMemoryBackend *pmrdev;
 
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 0baf4b27cd..520bc2e4cf 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -60,6 +60,7 @@ enum NvmeCapMask {
 #define NVME_CAP_CSS(cap)   (((cap) >> CAP_CSS_SHIFT)    & CAP_CSS_MASK)
 #define NVME_CAP_MPSMIN(cap)(((cap) >> CAP_MPSMIN_SHIFT) & CAP_MPSMIN_MASK)
 #define NVME_CAP_MPSMAX(cap)(((cap) >> CAP_MPSMAX_SHIFT) & CAP_MPSMAX_MASK)
+#define NVME_CAP_PMR(cap)   (((cap) >> CAP_PMR_SHIFT)    & CAP_PMR_MASK)
 
 #define NVME_CAP_SET_MQES(cap, val)   (cap |= (uint64_t)(val & CAP_MQES_MASK)  \
                                                            << CAP_MQES_SHIFT)
-- 
2.25.1



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

* [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning
  2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
  2021-01-15  3:27 ` [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning zhenwei pi
  2021-01-15  3:27 ` [PATCH v4 2/3] hw/block/nvme: add smart_critical_warning property zhenwei pi
@ 2021-01-15  3:27 ` zhenwei pi
  2021-01-15  9:17   ` Philippe Mathieu-Daudé
  2021-01-18  9:34 ` [PATCH v4 0/3] support NVMe smart critial warning injection Klaus Jensen
  2021-01-20  9:21 ` Klaus Jensen
  4 siblings, 1 reply; 10+ messages in thread
From: zhenwei pi @ 2021-01-15  3:27 UTC (permalink / raw)
  To: kbusch, its, kwolf, mreitz; +Cc: zhenwei pi, philmd, qemu-devel, qemu-block

During smart critical warning injection by setting property from QMP
command, also try to trigger asynchronous event.

Suggested by Keith, if a event has already been raised, there is no
need to enqueue the duplicate event any more.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 hw/block/nvme.c      | 48 +++++++++++++++++++++++++++++++++++++-------
 include/block/nvme.h |  1 +
 2 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 2d71ebeb30..f72a30b499 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -980,6 +980,35 @@ static void nvme_enqueue_event(NvmeCtrl *n, uint8_t event_type,
     nvme_process_aers(n);
 }
 
+static void nvme_smart_event(NvmeCtrl *n, uint8_t event)
+{
+    uint8_t aer_info;
+
+    /* Ref SPEC <Asynchronous Event Information 0x2013 SMART / Health Status> */
+    if (!(NVME_AEC_SMART(n->features.async_config) & event)) {
+        return;
+    }
+
+    switch (event) {
+    case NVME_SMART_SPARE:
+        aer_info = NVME_AER_INFO_SMART_SPARE_THRESH;
+        break;
+    case NVME_SMART_TEMPERATURE:
+        aer_info = NVME_AER_INFO_SMART_TEMP_THRESH;
+        break;
+    case NVME_SMART_RELIABILITY:
+    case NVME_SMART_MEDIA_READ_ONLY:
+    case NVME_SMART_FAILED_VOLATILE_MEDIA:
+    case NVME_SMART_PMR_UNRELIABLE:
+        aer_info = NVME_AER_INFO_SMART_RELIABILITY;
+        break;
+    default:
+        return;
+    }
+
+    nvme_enqueue_event(n, NVME_AER_TYPE_SMART, aer_info, NVME_LOG_SMART_INFO);
+}
+
 static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type)
 {
     n->aer_mask &= ~(1 << event_type);
@@ -3238,12 +3267,9 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
             return NVME_INVALID_FIELD | NVME_DNR;
         }
 
-        if (((n->temperature >= n->features.temp_thresh_hi) ||
-             (n->temperature <= n->features.temp_thresh_low)) &&
-            NVME_AEC_SMART(n->features.async_config) & NVME_SMART_TEMPERATURE) {
-            nvme_enqueue_event(n, NVME_AER_TYPE_SMART,
-                               NVME_AER_INFO_SMART_TEMP_THRESH,
-                               NVME_LOG_SMART_INFO);
+        if ((n->temperature >= n->features.temp_thresh_hi) ||
+            (n->temperature <= n->features.temp_thresh_low)) {
+            nvme_smart_event(n, NVME_AER_INFO_SMART_TEMP_THRESH);
         }
 
         break;
@@ -4360,7 +4386,7 @@ static void nvme_set_smart_warning(Object *obj, Visitor *v, const char *name,
                                    void *opaque, Error **errp)
 {
     NvmeCtrl *n = NVME(obj);
-    uint8_t value, cap = 0;
+    uint8_t value, old_value, cap = 0, index, event;
 
     if (!visit_type_uint8(v, name, &value, errp)) {
         return;
@@ -4378,7 +4404,15 @@ static void nvme_set_smart_warning(Object *obj, Visitor *v, const char *name,
         return;
     }
 
+    old_value = n->smart_critical_warning;
     n->smart_critical_warning = value;
+
+    /* only inject new bits of smart critical warning */
+    for (index = 0; index < NVME_SMART_WARN_MAX; index++) {
+        event = 1 << index;
+        if (value & ~old_value & event)
+            nvme_smart_event(n, event);
+    }
 }
 
 static const VMStateDescription nvme_vmstate = {
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 520bc2e4cf..0adccaf5b4 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -784,6 +784,7 @@ typedef struct QEMU_PACKED NvmeSmartLog {
     uint8_t     reserved2[320];
 } NvmeSmartLog;
 
+#define NVME_SMART_WARN_MAX     6
 enum NvmeSmartWarn {
     NVME_SMART_SPARE                  = 1 << 0,
     NVME_SMART_TEMPERATURE            = 1 << 1,
-- 
2.25.1



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

* Re: [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning
  2021-01-15  3:27 ` [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning zhenwei pi
@ 2021-01-15  9:17   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-15  9:17 UTC (permalink / raw)
  To: zhenwei pi, kbusch, its, kwolf, mreitz; +Cc: qemu-devel, qemu-block

On 1/15/21 4:27 AM, zhenwei pi wrote:
> During smart critical warning injection by setting property from QMP
> command, also try to trigger asynchronous event.
> 
> Suggested by Keith, if a event has already been raised, there is no
> need to enqueue the duplicate event any more.
> 
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  hw/block/nvme.c      | 48 +++++++++++++++++++++++++++++++++++++-------
>  include/block/nvme.h |  1 +
>  2 files changed, 42 insertions(+), 7 deletions(-)

Typo "blocl" in subject ;) No need to repost.



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

* Re: [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning
  2021-01-15  3:27 ` [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning zhenwei pi
@ 2021-01-15  9:19   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-15  9:19 UTC (permalink / raw)
  To: zhenwei pi, kbusch, its, kwolf, mreitz; +Cc: qemu-devel, qemu-block

On 1/15/21 4:27 AM, zhenwei pi wrote:
> According to NVMe spec 1.4 section

"According to NVMe spec 1.4 section 5.14.1.2"

> <SMART / Health Information (Log Identifier 02h)>, introduce bit 5
> for "Persistent Memory Region has become read-only or unreliable".
> 
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  include/block/nvme.h | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH v4 0/3] support NVMe smart critial warning injection
  2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
                   ` (2 preceding siblings ...)
  2021-01-15  3:27 ` [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning zhenwei pi
@ 2021-01-18  9:34 ` Klaus Jensen
  2021-01-19  2:05   ` zhenwei pi
  2021-01-20  9:21 ` Klaus Jensen
  4 siblings, 1 reply; 10+ messages in thread
From: Klaus Jensen @ 2021-01-18  9:34 UTC (permalink / raw)
  To: zhenwei pi; +Cc: kwolf, qemu-block, qemu-devel, mreitz, kbusch, philmd

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

On Jan 15 11:26, zhenwei pi wrote:
> v3 -> v4:
> - Drop "Fix overwritten bar.cap". (Already fixed)
> 
> - Avoid to enqueue the duplicate event.
> 
> - Several minor changes for coding style & function/variable name.
> 
> v2 -> v3:
> - Introduce "Persistent Memory Region has become read-only or
>   unreliable"
> 
> - Fix overwritten bar.cap
> 
> - Check smart critical warning value from QOM.
> 
> - Trigger asynchronous event during smart warning injection.
> 
> v1 -> v2:
> - Suggested by Philippe & Klaus, set/get smart_critical_warning by QMP.
> 
> v1:
> - Add smart_critical_warning for nvme device which can be set by QEMU
>   command line to emulate hardware error.
> 
> Zhenwei Pi (3):
>   block/nvme: introduce bit 5 for critical warning
>   hw/block/nvme: add smart_critical_warning property
>   hw/blocl/nvme: trigger async event during injecting smart warning
> 
>  hw/block/nvme.c      | 91 +++++++++++++++++++++++++++++++++++++++-----
>  hw/block/nvme.h      |  1 +
>  include/block/nvme.h |  3 ++
>  3 files changed, 86 insertions(+), 9 deletions(-)
> 

This looks pretty good to me.

I think maybe we want to handle the duplicate event stuff more generally
from the AER/AEN code, but this does the job.

Tested-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: Re: [PATCH v4 0/3] support NVMe smart critial warning injection
  2021-01-18  9:34 ` [PATCH v4 0/3] support NVMe smart critial warning injection Klaus Jensen
@ 2021-01-19  2:05   ` zhenwei pi
  2021-01-19  5:01     ` Klaus Jensen
  0 siblings, 1 reply; 10+ messages in thread
From: zhenwei pi @ 2021-01-19  2:05 UTC (permalink / raw)
  To: k.jensen; +Cc: kwolf, qemu-block, qemu-devel, mreitz, kbusch, philmd

On 1/18/21 5:34 PM, Klaus Jensen wrote:
> On Jan 15 11:26, zhenwei pi wrote:
>> v3 -> v4:
>> - Drop "Fix overwritten bar.cap". (Already fixed)
>>
>> - Avoid to enqueue the duplicate event.
>>
>> - Several minor changes for coding style & function/variable name.
>>
>> v2 -> v3:
>> - Introduce "Persistent Memory Region has become read-only or
>>    unreliable"
>>
>> - Fix overwritten bar.cap
>>
>> - Check smart critical warning value from QOM.
>>
>> - Trigger asynchronous event during smart warning injection.
>>
>> v1 -> v2:
>> - Suggested by Philippe & Klaus, set/get smart_critical_warning by QMP.
>>
>> v1:
>> - Add smart_critical_warning for nvme device which can be set by QEMU
>>    command line to emulate hardware error.
>>
>> Zhenwei Pi (3):
>>    block/nvme: introduce bit 5 for critical warning
>>    hw/block/nvme: add smart_critical_warning property
>>    hw/blocl/nvme: trigger async event during injecting smart warning
>>
>>   hw/block/nvme.c      | 91 +++++++++++++++++++++++++++++++++++++++-----
>>   hw/block/nvme.h      |  1 +
>>   include/block/nvme.h |  3 ++
>>   3 files changed, 86 insertions(+), 9 deletions(-)
>>
> 
> This looks pretty good to me.
> 
> I think maybe we want to handle the duplicate event stuff more generally
> from the AER/AEN code, but this does the job.
> 
> Tested-by: Klaus Jensen <k.jensen@samsung.com>
> Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
> 

What's the next step I should take? Should I push a new version to 
implement this purpose? From my understanding, before inserting a new 
event to aer_queue, I can parse all the pending aer to find the same event.

nvme_enqueue_event()
{
     ...

     QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) {
         if ((event->result.event_type == event_type)
             && (event->result.event_info == event_info)
             && (event->result.log_page == log_page))
             return;
     }

     QTAILQ_INSERT_TAIL(&n->aer_queue, event, entry); 
 
 

     n->aer_queued++;
     ...
}

-- 
zhenwei pi


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

* Re: Re: [PATCH v4 0/3] support NVMe smart critial warning injection
  2021-01-19  2:05   ` zhenwei pi
@ 2021-01-19  5:01     ` Klaus Jensen
  0 siblings, 0 replies; 10+ messages in thread
From: Klaus Jensen @ 2021-01-19  5:01 UTC (permalink / raw)
  To: zhenwei pi
  Cc: kwolf, qemu-block, k.jensen, qemu-devel, mreitz, kbusch, philmd

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

On Jan 19 10:05, zhenwei pi wrote:
> On 1/18/21 5:34 PM, Klaus Jensen wrote:
> > On Jan 15 11:26, zhenwei pi wrote:
> > > v3 -> v4:
> > > - Drop "Fix overwritten bar.cap". (Already fixed)
> > > 
> > > - Avoid to enqueue the duplicate event.
> > > 
> > > - Several minor changes for coding style & function/variable name.
> > > 
> > > v2 -> v3:
> > > - Introduce "Persistent Memory Region has become read-only or
> > >    unreliable"
> > > 
> > > - Fix overwritten bar.cap
> > > 
> > > - Check smart critical warning value from QOM.
> > > 
> > > - Trigger asynchronous event during smart warning injection.
> > > 
> > > v1 -> v2:
> > > - Suggested by Philippe & Klaus, set/get smart_critical_warning by QMP.
> > > 
> > > v1:
> > > - Add smart_critical_warning for nvme device which can be set by QEMU
> > >    command line to emulate hardware error.
> > > 
> > > Zhenwei Pi (3):
> > >    block/nvme: introduce bit 5 for critical warning
> > >    hw/block/nvme: add smart_critical_warning property
> > >    hw/blocl/nvme: trigger async event during injecting smart warning
> > > 
> > >   hw/block/nvme.c      | 91 +++++++++++++++++++++++++++++++++++++++-----
> > >   hw/block/nvme.h      |  1 +
> > >   include/block/nvme.h |  3 ++
> > >   3 files changed, 86 insertions(+), 9 deletions(-)
> > > 
> > 
> > This looks pretty good to me.
> > 
> > I think maybe we want to handle the duplicate event stuff more generally
> > from the AER/AEN code, but this does the job.
> > 
> > Tested-by: Klaus Jensen <k.jensen@samsung.com>
> > Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
> > 
> 
> What's the next step I should take? Should I push a new version to implement
> this purpose? From my understanding, before inserting a new event to
> aer_queue, I can parse all the pending aer to find the same event.
> 
> nvme_enqueue_event()
> {
>     ...
> 
>     QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) {
>         if ((event->result.event_type == event_type)
>             && (event->result.event_info == event_info)
>             && (event->result.log_page == log_page))
>             return;
>     }
> 
>     QTAILQ_INSERT_TAIL(&n->aer_queue, event, entry);
> 
> 
> 
>     n->aer_queued++;
>     ...
> }
> 

No, I'll pick up your series as is, I'll pick it up for nvme-next later
today if noone complains! :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v4 0/3] support NVMe smart critial warning injection
  2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
                   ` (3 preceding siblings ...)
  2021-01-18  9:34 ` [PATCH v4 0/3] support NVMe smart critial warning injection Klaus Jensen
@ 2021-01-20  9:21 ` Klaus Jensen
  4 siblings, 0 replies; 10+ messages in thread
From: Klaus Jensen @ 2021-01-20  9:21 UTC (permalink / raw)
  To: zhenwei pi; +Cc: kwolf, qemu-block, qemu-devel, mreitz, kbusch, philmd

[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]

On Jan 15 11:26, zhenwei pi wrote:
> v3 -> v4:
> - Drop "Fix overwritten bar.cap". (Already fixed)
> 
> - Avoid to enqueue the duplicate event.
> 
> - Several minor changes for coding style & function/variable name.
> 
> v2 -> v3:
> - Introduce "Persistent Memory Region has become read-only or
>   unreliable"
> 
> - Fix overwritten bar.cap
> 
> - Check smart critical warning value from QOM.
> 
> - Trigger asynchronous event during smart warning injection.
> 
> v1 -> v2:
> - Suggested by Philippe & Klaus, set/get smart_critical_warning by QMP.
> 
> v1:
> - Add smart_critical_warning for nvme device which can be set by QEMU
>   command line to emulate hardware error.
> 
> Zhenwei Pi (3):
>   block/nvme: introduce bit 5 for critical warning
>   hw/block/nvme: add smart_critical_warning property
>   hw/blocl/nvme: trigger async event during injecting smart warning
> 
>  hw/block/nvme.c      | 91 +++++++++++++++++++++++++++++++++++++++-----
>  hw/block/nvme.h      |  1 +
>  include/block/nvme.h |  3 ++
>  3 files changed, 86 insertions(+), 9 deletions(-)
> 

Thanks! Applied to nvme-next.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-01-20  9:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  3:26 [PATCH v4 0/3] support NVMe smart critial warning injection zhenwei pi
2021-01-15  3:27 ` [PATCH v4 1/3] block/nvme: introduce bit 5 for critical warning zhenwei pi
2021-01-15  9:19   ` Philippe Mathieu-Daudé
2021-01-15  3:27 ` [PATCH v4 2/3] hw/block/nvme: add smart_critical_warning property zhenwei pi
2021-01-15  3:27 ` [PATCH v4 3/3] hw/blocl/nvme: trigger async event during injecting smart warning zhenwei pi
2021-01-15  9:17   ` Philippe Mathieu-Daudé
2021-01-18  9:34 ` [PATCH v4 0/3] support NVMe smart critial warning injection Klaus Jensen
2021-01-19  2:05   ` zhenwei pi
2021-01-19  5:01     ` Klaus Jensen
2021-01-20  9:21 ` Klaus Jensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.