From: Klaus Jensen <its@irrelevant.dk>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Jinhao Fan <fanjinhao21s@ict.ac.cn>,
qemu-devel <qemu-devel@nongnu.org>,
Keith Busch <kbusch@kernel.org>
Subject: Re: [RFC] hw/nvme: Use irqfd to send interrupts
Date: Wed, 27 Jul 2022 09:18:26 +0200 [thread overview]
Message-ID: <YuDmwhKBpllXNG1i@apples> (raw)
In-Reply-To: <CAJSP0QUf4K=N7ZDAXrB3WvUxx4DoA4Sg0hSTri1WKGTnsMtN2g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2456 bytes --]
On Jul 21 09:29, Stefan Hajnoczi wrote:
> On Wed, Jul 20, 2022, 22:36 Jinhao Fan <fanjinhao21s@ict.ac.cn> wrote:
>
> > Hi Stefan,
> >
> > Thanks for the detailed explanation!
> >
> > at 6:21 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> >
> > > Hi Jinhao,
> > > Thanks for working on this!
> > >
> > > irqfd is not necessarily faster than KVM ioctl interrupt injection.
> > >
> > > There are at least two non performance reasons for irqfd:
> > > 1. It avoids QEMU emulation code, which historically was not thread safe
> > and needed the Big QEMU Lock. IOThreads don't hold the BQL and therefore
> > cannot safely call the regular interrupt emulation code in QEMU. I think
> > this is still true today although parts of the code may now be less reliant
> > on the BQL.
> >
> > This probably means we need to move to irqfd when iothread support is added
> > in qemu-nvme.
> >
>
> Yes. You can audit the interrupt code but I'm pretty sure there is shared
> state that needs to be protected by the BQL. So the NVMe emulation code
> probably needs to use irqfd to avoid the interrupt emulation code.
>
>
> > > 2. The eventfd interface decouples interrupt injection from the KVM
> > ioctl interface. Vhost kernel and vhost-user device emulation code has no
> > dependency on KVM thanks to irqfd. They work with any eventfd, including
> > irqfd.
> >
> > This is contrary to our original belief. Klaus once pointed out that irqfd
> > is KVM specific. I agreed with him since I found irqfd implementation is in
> > virt/kvm/eventfd.c. But irqfd indeed avoids the KVM ioctl call. Could you
> > elaborate on what “no dependency on KVM” means?
> >
>
> "They work with any eventfd, including irqfd"
>
> If you look at the vhost kernel or vhost-user code, you'll see they just
> signal the eventfd. It doesn't have to be an irqfd.
>
> An irqfd is a specific type of eventfd that the KVM kernel module
> implements to inject interrupts when the eventfd is signaled.
>
> By the way, this not only decouples vhost from the KVM kernel module, but
> also allows QEMU to emulate MSI-X masking via buffering the interrupt in
> userspace.
>
>
The virtio dataplane (iothread support) only works with kvm if I am not
mistaken, so I guess this is similar to what we want to do here. If we
dont have KVM, we wont use iothread and we wont use the kvm
irqchip/irqfd.
Am I understanding this correctly?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-07-27 7:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 4:35 [RFC] hw/nvme: Use irqfd to send interrupts Jinhao Fan
2022-07-12 12:26 ` Klaus Jensen
2022-07-14 4:18 ` Klaus Jensen
2022-07-14 14:31 ` Jinhao Fan
2022-07-20 9:19 ` Jinhao Fan
2022-07-20 10:21 ` Stefan Hajnoczi
2022-07-21 2:36 ` Jinhao Fan
2022-07-21 13:29 ` Stefan Hajnoczi
2022-07-24 15:20 ` Jinhao Fan
2022-07-24 19:36 ` Stefan Hajnoczi
2022-07-25 2:48 ` Jinhao Fan
2022-07-27 7:18 ` Klaus Jensen [this message]
2022-07-27 15:18 ` Stefan Hajnoczi
2022-07-28 15:34 ` Jinhao Fan
2022-07-28 15:38 ` Stefan Hajnoczi
2022-08-02 4:03 ` Jinhao Fan
2022-08-02 5:29 ` Klaus Jensen
2022-08-08 2:23 ` Jinhao Fan
2022-08-09 15:31 ` 樊金昊
2022-08-09 16:21 ` Keith Busch
2022-08-09 16:40 ` 樊金昊
2022-08-09 16:48 ` 樊金昊
2022-08-09 17:01 ` Keith Busch
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=YuDmwhKBpllXNG1i@apples \
--to=its@irrelevant.dk \
--cc=fanjinhao21s@ict.ac.cn \
--cc=kbusch@kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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.