Skip to contentSkip to conversation

hw/nvme fixes

GIT PULL Applied Klaus Jensen 2 participants 5 messages Aug 1, 2022

lore
Share & tools
lore
#0 lore raw

From: Klaus Jensen <[email protected]>

Hi,

The following changes since commit 3916603e0c1d909e14e09d5ebcbdaa9c9e21adf3:

Merge tag 'pull-la-20220729' of https://gitlab.com/rth7680/qemu into staging (2022-07-29 17:39:17 -0700)

are available in the Git repository at:

git://git.infradead.org/qemu-nvme.git tags/nvme-next-pull-request

for you to fetch changes up to e2e137f64282a2ee2f359b6df4cd93c83a308e7b:

hw/nvme: do not enable ioeventfd by default (2022-08-01 12:01:21 +0200)

----------------------------------------------------------------
hw/nvme fixes

Some fixes for hw/nvme ioeventfd support.

----------------------------------------------------------------

Klaus Jensen (3):
hw/nvme: skip queue processing if notifier is cleared hw/nvme: unregister the event notifier handler on the main loop hw/nvme: do not enable ioeventfd by default

 hw/nvme/ctrl.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.36.1
#1 lore raw

[PULL for-7.1 1/3] hw/nvme: skip queue processing if notifier is cleared

From: Klaus Jensen <[email protected]>

While it is safe to process the queues when they are empty, skip it if the event notifier callback was invoked spuriously.

---
 hw/nvme/ctrl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
hw/nvme/ctrl.c +6 -2
index 533ad14e7a61..8aa73b048d51 100644
@@ -4238,7 +4238,9 @@ static void nvme_cq_notifier(EventNotifier *e)
     NvmeCQueue *cq = container_of(e, NvmeCQueue, notifier);
     NvmeCtrl *n = cq->ctrl;
 
-    event_notifier_test_and_clear(&cq->notifier);
+    if (!event_notifier_test_and_clear(e)) {
+        return;
+    }
 
     nvme_update_cq_head(cq);
 
@@ -4275,7 +4277,9 @@ static void nvme_sq_notifier(EventNotifier *e)
 {
     NvmeSQueue *sq = container_of(e, NvmeSQueue, notifier);
 
-    event_notifier_test_and_clear(&sq->notifier);
+    if (!event_notifier_test_and_clear(e)) {
+        return;
+    }
 
     nvme_process_sq(sq);
 }
Signature · 1 line
2.36.1
#2 lore raw

[PULL for-7.1 3/3] hw/nvme: do not enable ioeventfd by default

In reply to Klaus Jensen

From: Klaus Jensen <[email protected]>

Do not enable ioeventfd by default. Let the feature mature a bit before we consider enabling it by default.

Fixes 2e53b0b45024 ("hw/nvme: Use ioeventfd to handle doorbell updates")
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvme/ctrl.c +1 -1
index 70b454eedbd8..87aeba056499 100644
@@ -7670,7 +7670,7 @@ static Property nvme_props[] = {
     DEFINE_PROP_UINT8("vsl", NvmeCtrl, params.vsl, 7),
     DEFINE_PROP_BOOL("use-intel-id", NvmeCtrl, params.use_intel_id, false),
     DEFINE_PROP_BOOL("legacy-cmb", NvmeCtrl, params.legacy_cmb, false),
-    DEFINE_PROP_BOOL("ioeventfd", NvmeCtrl, params.ioeventfd, true),
+    DEFINE_PROP_BOOL("ioeventfd", NvmeCtrl, params.ioeventfd, false),
     DEFINE_PROP_UINT8("zoned.zasl", NvmeCtrl, params.zasl, 0),
     DEFINE_PROP_BOOL("zoned.auto_transition", NvmeCtrl,
                      params.auto_transition_zones, true),
Signature · 1 line
2.36.1
#3 lore raw

[PULL for-7.1 2/3] hw/nvme: unregister the event notifier handler on the main loop

In reply to Klaus Jensen

From: Klaus Jensen <[email protected]>

Make sure the notifier handler is unregistered in the main loop prior to cleaning it up.

Fixes 2e53b0b45024 ("hw/nvme: Use ioeventfd to handle doorbell updates")
---
 hw/nvme/ctrl.c | 2 ++
 1 file changed, 2 insertions(+)
hw/nvme/ctrl.c +2 -0
index 8aa73b048d51..70b454eedbd8 100644
@@ -4311,6 +4311,7 @@ static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n)
     if (sq->ioeventfd_enabled) {
         memory_region_del_eventfd(&n->iomem,
                                   0x1000 + offset, 4, false, 0, &sq->notifier);
+        event_notifier_set_handler(&sq->notifier, NULL);
         event_notifier_cleanup(&sq->notifier);
     }
     g_free(sq->io_req);
@@ -4701,6 +4702,7 @@ static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
     if (cq->ioeventfd_enabled) {
         memory_region_del_eventfd(&n->iomem,
                                   0x1000 + offset, 4, false, 0, &cq->notifier);
+        event_notifier_set_handler(&cq->notifier, NULL);
         event_notifier_cleanup(&cq->notifier);
     }
     if (msix_enabled(&n->parent_obj)) {
Signature · 1 line
2.36.1
#4 lore raw
In reply to Klaus Jensen
Quoted 12 lines · Klaus Jensen

From: Klaus Jensen <[email protected]>

Hi,

The following changes since commit 3916603e0c1d909e14e09d5ebcbdaa9c9e21adf3:

   Merge tag 'pull-la-20220729' of https://gitlab.com/rth7680/qemu into staging (2022-07-29 17:39:17 -0700)

are available in the Git repository at:

git://git.infradead.org/qemu-nvme.git tags/nvme-next-pull-request

Quoted 8 lines

for you to fetch changes up to e2e137f64282a2ee2f359b6df4cd93c83a308e7b:

hw/nvme: do not enable ioeventfd by default (2022-08-01 12:01:21 +0200)

----------------------------------------------------------------
hw/nvme fixes

Some fixes for hw/nvme ioeventfd support.

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.

r~

Quoted 11 lines

----------------------------------------------------------------

Klaus Jensen (3):
hw/nvme: skip queue processing if notifier is cleared hw/nvme: unregister the event notifier handler on the main loop hw/nvme: do not enable ioeventfd by default

  hw/nvme/ctrl.c | 12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)