hw/nvme/ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
clear masked events from the aer queue when get log page is issued with
rae=0 without checking for the presence of outstanding aer requests
Signed-off-by: Arun Kumar <arun.kka@samsung.com>
---
hw/nvme/ctrl.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 127c3d2383..85039779da 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1649,9 +1649,16 @@ static void nvme_smart_event(NvmeCtrl *n, uint8_t event)
static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type)
{
+ NvmeAsyncEvent *event, *next;
n->aer_mask &= ~(1 << event_type);
if (!QTAILQ_EMPTY(&n->aer_queue)) {
- nvme_process_aers(n);
+ QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) {
+ if (event->result.event_type == event_type) {
+ QTAILQ_REMOVE(&n->aer_queue, event, entry);
+ n->aer_queued--;
+ g_free(event);
+ }
+ }
}
}
--
2.43.0
On Sep 6 05:28, Arun Kumar wrote: > clear masked events from the aer queue when get log page is issued with > rae=0 without checking for the presence of outstanding aer requests > > Signed-off-by: Arun Kumar <arun.kka@samsung.com> > --- Hi Arun, Thanks, LGTM. One small nit below. > hw/nvme/ctrl.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index 127c3d2383..85039779da 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -1649,9 +1649,16 @@ static void nvme_smart_event(NvmeCtrl *n, uint8_t event) > > static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type) > { > + NvmeAsyncEvent *event, *next; > n->aer_mask &= ~(1 << event_type); > if (!QTAILQ_EMPTY(&n->aer_queue)) { It's safe to remove the QTAILQ_EMTPY check as well. > - nvme_process_aers(n); > + QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) { > + if (event->result.event_type == event_type) { > + QTAILQ_REMOVE(&n->aer_queue, event, entry); > + n->aer_queued--; > + g_free(event); > + } > + } > } > } We may want to check the mask when inserting as well? Currently nvme_enqueue_event does not check the aer_mask and always inserts an event, even if we have posted an AEN for a particular event type (but event type has not been cleared yet).
On Sep 23 09:56, Klaus Jensen wrote: > On Sep 6 05:28, Arun Kumar wrote: > > clear masked events from the aer queue when get log page is issued with > > rae=0 without checking for the presence of outstanding aer requests > > > > Signed-off-by: Arun Kumar <arun.kka@samsung.com> > > --- > > Hi Arun, > > Thanks, LGTM. One small nit below. > > > hw/nvme/ctrl.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > > index 127c3d2383..85039779da 100644 > > --- a/hw/nvme/ctrl.c > > +++ b/hw/nvme/ctrl.c > > @@ -1649,9 +1649,16 @@ static void nvme_smart_event(NvmeCtrl *n, uint8_t event) > > > > static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type) > > { > > + NvmeAsyncEvent *event, *next; > > n->aer_mask &= ~(1 << event_type); > > if (!QTAILQ_EMPTY(&n->aer_queue)) { > > It's safe to remove the QTAILQ_EMTPY check as well. > I dropped the empty check and picked this up for nvme-next, thanks!
© 2016 - 2024 Red Hat, Inc.