All of lore.kernel.org
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: Klaus Jensen <its@irrelevant.dk>, Keith Busch <kbusch@kernel.org>,
	qemu-block@nongnu.org, Jinhao Fan <fanjinhao21s@ict.ac.cn>,
	Klaus Jensen <k.jensen@samsung.com>
Subject: [PATCH for-7.1 2/3] hw/nvme: unregister the event notifier handler on the main loop
Date: Thu, 28 Jul 2022 10:25:21 +0200	[thread overview]
Message-ID: <20220728082522.3161739-3-its@irrelevant.dk> (raw)
In-Reply-To: <20220728082522.3161739-1-its@irrelevant.dk>

From: Klaus Jensen <k.jensen@samsung.com>

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")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/nvme/ctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 8aa73b048d51..70b454eedbd8 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -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)) {
-- 
2.36.1



  parent reply	other threads:[~2022-07-28  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  8:25 [PATCH for-7.1 0/3] hw/nvme: misc ioeventfd fixes Klaus Jensen
2022-07-28  8:25 ` [PATCH for-7.1 1/3] hw/nvme: skip queue processing if notifier is cleared Klaus Jensen
2022-07-28  8:25 ` Klaus Jensen [this message]
2022-07-28  8:25 ` [PATCH for-7.1 3/3] hw/nvme: do not enable ioeventfd by default Klaus Jensen
2022-07-28 15:15 ` [PATCH for-7.1 0/3] hw/nvme: misc ioeventfd fixes Keith Busch
2022-07-28 15:28 ` Jinhao Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728082522.3161739-3-its@irrelevant.dk \
    --to=its@irrelevant.dk \
    --cc=fanjinhao21s@ict.ac.cn \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.