From: Sean Christopherson <seanjc@google.com>
To: Thanos Makatos <thanos.makatos@nutanix.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Ilias Stamatis <ilstam@amazon.com>, Paul Durrant <paul@xen.org>,
"graf@amazon.de" <graf@amazon.de>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
John Levon <john.levon@nutanix.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: optionally post write on ioeventfd write
Date: Tue, 21 Apr 2026 07:44:02 -0700 [thread overview]
Message-ID: <aeeNMhOM2fc2BW6u@google.com> (raw)
In-Reply-To: <DS0PR02MB93214EEAB50391C84CB7B9C48B44A@DS0PR02MB9321.namprd02.prod.outlook.com>
On Thu, Mar 12, 2026, Thanos Makatos wrote:
> > From: David Woodhouse <dwmw2@infradead.org>
> > On Fri, 2026-03-06 at 12:56 +0000, Thanos Makatos wrote:
> > > Add a new flag, KVM_IOEVENTFD_FLAG_POST_WRITE, when assigning an
> > > ioeventfd that results in the value written by the guest to be copied
> > > to user-supplied memory instead of being discarded.
> > >
> > > The goal of this new mechanism is to speed up doorbell writes on NVMe
> > > controllers emulated outside of the VMM. Currently, a doorbell write to
> > > an NVMe SQ tail doorbell requires returning from ioctl(KVM_RUN) and the
> > > VMM communicating the event, along with the doorbell value, to the NVMe
> > > controller emulation task. With POST_WRITE, the NVMe emulation task is
> > > directly notified of the doorbell write and can find the doorbell value
> > > in a known location, without involving VMM.
...
> > I'd love to see if this KVM_IOEVENTFD_FLAG_POST_WRITE works for the
> > i82559 emulation use case. I think back-to-back writes are discarded
> > with this model, while Ilias's patches would convey each one?
Do you happen to know the requirements for i82559 emulation? I tried reading the
spec and QEMU's code, and that was just a waste of ~20 minutes :-)
> Yes, they're discarded, only the last write is visible, and this is by design
> to fit the NVMe doorbell use case.
I wouldn't say the design is specifically to fit the NVMe doorbell use case,
rather that KVM doesn't need to convey each write to support NVMe doorbells, and
forwarding only the most recent value is a massive "win" for complexity.
Which, for me, is also the argument for accepting KVM_IOEVENTFD_FLAG_POST_WRITE
even if there are a limited number of use cases: it's simple (and performant)
enough that it's probably worth supporting even if similar functionality can be
implemented via polling on coalesced I/O buffers. I.e. maintaing both doesn't
seem too onerous, if that's where we wend up.
> ioregionfd,
> https://lore.kernel.org/all/88ca79d2e378dcbfb3988b562ad2c16c4f929ac7.camel@gmail.com,
> was a similar proposal for forwarding MMIO writes without discarding
> back-to-back writes.
And if you were curious what the code looked like:
https://lore.kernel.org/kvm/cover.1613828726.git.eafanasova@gmail.com
next prev parent reply other threads:[~2026-04-21 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 12:56 [PATCH] KVM: optionally post write on ioeventfd write Thanos Makatos
2026-03-12 15:02 ` David Woodhouse
2026-03-12 16:12 ` Thanos Makatos
2026-04-21 14:44 ` Sean Christopherson [this message]
2026-03-23 15:01 ` Thanos Makatos
2026-04-10 19:11 ` Thanos Makatos
2026-04-21 14:45 ` Sean Christopherson
-- strict thread matches above, loose matches on Subject: below --
2026-01-13 20:00 [RFC PATCH] KVM: optionally commit " Sean Christopherson
2026-03-02 12:28 ` [PATCH] KVM: optionally post " Thanos Makatos
2026-03-05 1:26 ` Sean Christopherson
2026-03-06 11:14 ` Thanos Makatos
2026-03-05 1:49 ` kernel test robot
2026-03-05 9:39 ` kernel test robot
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=aeeNMhOM2fc2BW6u@google.com \
--to=seanjc@google.com \
--cc=dwmw2@infradead.org \
--cc=graf@amazon.de \
--cc=ilstam@amazon.com \
--cc=john.levon@nutanix.com \
--cc=kvm@vger.kernel.org \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=thanos.makatos@nutanix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox