From: Klaus Jensen <its@irrelevant.dk>
To: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Cc: qemu-devel@nongnu.org, kbusch@kernel.org,
Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [PATCH v4] hw/nvme: Use ioeventfd to handle doorbell updates
Date: Wed, 27 Jul 2022 09:06:46 +0200 [thread overview]
Message-ID: <YuDkBkrqXaosJbRM@apples> (raw)
In-Reply-To: <Yt/ZKVHjSTTt08MV@apples>
[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]
On Jul 26 14:08, Klaus Jensen wrote:
>
> Alright. Forget about the iommu, that was just a coincidence.
>
> This patch seems to fix it. I guess it is the
> event_notifier_set_handler(..., NULL) that does the trick, but I'd like
> to understand why ;)
>
>
> diff --git i/hw/nvme/ctrl.c w/hw/nvme/ctrl.c
> index 533ad14e7a61..3bc3c6bfbe78 100644
> --- i/hw/nvme/ctrl.c
> +++ w/hw/nvme/ctrl.c
> @@ -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);
> }
> @@ -4307,6 +4311,8 @@ 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);
> + nvme_sq_notifier(&sq->notifier);
> event_notifier_cleanup(&sq->notifier);
> }
> g_free(sq->io_req);
> @@ -4697,6 +4703,8 @@ 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);
> + nvme_cq_notifier(&cq->notifier);
> event_notifier_cleanup(&cq->notifier);
> }
> if (msix_enabled(&n->parent_obj)) {
Jinhao,
Do you have any comments on the above patch - does it make sense to you,
considering the effort you've done into researching how virtio does
this?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-07-27 7:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 14:24 [PATCH v4] hw/nvme: Use ioeventfd to handle doorbell updates Jinhao Fan
2022-07-05 17:11 ` Klaus Jensen
2022-07-05 18:43 ` Keith Busch
2022-07-06 11:34 ` Jinhao Fan
2022-07-07 5:51 ` Klaus Jensen
2022-07-07 8:50 ` Jinhao Fan
2022-07-06 10:57 ` Jinhao Fan
2022-07-09 3:06 ` Jinhao Fan
2022-07-12 12:23 ` Klaus Jensen
2022-07-14 5:35 ` Klaus Jensen
2022-07-25 20:55 ` Klaus Jensen
2022-07-26 7:35 ` Jinhao Fan
2022-07-26 7:41 ` Klaus Jensen
2022-07-26 7:55 ` Jinhao Fan
2022-07-26 9:19 ` Klaus Jensen
2022-07-26 10:09 ` Klaus Jensen
2022-07-26 11:24 ` Klaus Jensen
2022-07-26 11:32 ` Klaus Jensen
2022-07-26 12:08 ` Klaus Jensen
2022-07-27 7:06 ` Klaus Jensen [this message]
2022-07-27 8:16 ` Jinhao Fan
2022-07-27 8:21 ` Klaus Jensen
2022-07-27 15:09 ` Jinhao Fan
2022-07-26 12:35 ` Stefan Hajnoczi
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=YuDkBkrqXaosJbRM@apples \
--to=its@irrelevant.dk \
--cc=fanjinhao21s@ict.ac.cn \
--cc=hreitz@redhat.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.