kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Elena Afanasova <eafanasova@gmail.com>,
	kvm@vger.kernel.org, jag.raman@oracle.com,
	elena.ufimtseva@oracle.com, pbonzini@redhat.com, mst@redhat.com,
	cohuck@redhat.com, john.levon@nutanix.com
Subject: Re: [RFC v3 3/5] KVM: implement wire protocol
Date: Mon, 29 Mar 2021 17:17:34 +0100	[thread overview]
Message-ID: <YGH9niCJ9J1DiPtb@stefanha-x1.localdomain> (raw)
In-Reply-To: <24e7211c-e168-3f47-f789-5f1d743d79c5@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2791 bytes --]

On Fri, Mar 26, 2021 at 02:21:29PM +0800, Jason Wang wrote:
> 
> 在 2021/3/17 下午9:08, Elena Afanasova 写道:
> > On Tue, 2021-03-09 at 14:19 +0800, Jason Wang wrote:
> > > On 2021/2/21 8:04 下午, Elena Afanasova wrote:
> > > > Add ioregionfd blocking read/write operations.
> > > > 
> > > > Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
> > > > ---
> > > > v3:
> > > >    - change wire protocol license
> > > >    - remove ioregionfd_cmd info and drop appropriate macros
> > > >    - fix ioregionfd state machine
> > > >    - add sizeless ioregions support
> > > >    - drop redundant check in ioregion_read/write()
> > > > 
> > > >    include/uapi/linux/ioregion.h |  30 +++++++
> > > >    virt/kvm/ioregion.c           | 162
> > > > +++++++++++++++++++++++++++++++++-
> > > >    2 files changed, 190 insertions(+), 2 deletions(-)
> > > >    create mode 100644 include/uapi/linux/ioregion.h
> > > > 
> > > > diff --git a/include/uapi/linux/ioregion.h
> > > > b/include/uapi/linux/ioregion.h
> > > > new file mode 100644
> > > > index 000000000000..58f9b5ba6186
> > > > --- /dev/null
> > > > +++ b/include/uapi/linux/ioregion.h
> > > > @@ -0,0 +1,30 @@
> > > > +/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-
> > > > note) OR BSD-3-Clause) */
> > > > +#ifndef _UAPI_LINUX_IOREGION_H
> > > > +#define _UAPI_LINUX_IOREGION_H
> > > > +
> > > > +/* Wire protocol */
> > > > +
> > > > +struct ioregionfd_cmd {
> > > > +	__u8 cmd;
> > > > +	__u8 size_exponent : 4;
> > > > +	__u8 resp : 1;
> > > > +	__u8 padding[6];
> > > > +	__u64 user_data;
> > > > +	__u64 offset;
> > > > +	__u64 data;
> > > > +};
> > > Sorry if I've asked this before. Do we need a id for each
> > > request/response? E.g an ioregion fd could be used by multiple
> > > vCPUS.
> > > VCPU needs to have a way to find which request belongs to itself or
> > > not?
> > > 
> > I don’t think the id is necessary here since all requests/responses are
> > serialized.
> 
> 
> It's probably fine for the first version but it will degrate the performance
> e.g if the ioregionfd is used for multiple queues (e.g doorbell). The design
> should have the capability to allow the extension like this.

If there is only one doorbell register and one ioregionfd then trying to
process multiple queues in userspace is going to be slow. Adding cmd IDs
doesn't fix this because userspace won't be able to destribute cmds to
multiple queue threads efficiently.

Multiple queues should either use multiple doorbell registers or
ioregionfd needs something like datamatch to dispatch the MMIO/PIO
access to the appropriate queue's ioregionfd. In both cases cmd IDs
aren't necessary.

Can you think of a case where cmd IDs are needed?

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-03-29 16:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-21 12:04 [RFC v3 0/5] Introduce MMIO/PIO dispatch file descriptors (ioregionfd) Elena Afanasova
2021-02-21 12:04 ` [RFC v3 1/5] KVM: add initial support for KVM_SET_IOREGION Elena Afanasova
2021-02-24 10:06   ` Stefan Hajnoczi
2021-03-05 13:09   ` Cornelia Huck
2021-03-09  5:26   ` Jason Wang
2021-03-22  9:57     ` Stefan Hajnoczi
2021-02-21 12:04 ` [RFC v3 2/5] KVM: x86: add support for ioregionfd signal handling Elena Afanasova
2021-02-24 10:42   ` Stefan Hajnoczi
2021-03-09  5:51   ` Jason Wang
2021-03-17 14:19     ` Elena Afanasova
2021-03-26  6:00       ` Jason Wang
2021-02-21 12:04 ` [RFC v3 3/5] KVM: implement wire protocol Elena Afanasova
2021-02-24 11:02   ` Stefan Hajnoczi
2021-03-09  6:19   ` Jason Wang
2021-03-17 13:08     ` Elena Afanasova
2021-03-26  6:21       ` Jason Wang
2021-03-29 16:17         ` Stefan Hajnoczi [this message]
2021-02-21 12:04 ` [RFC v3 4/5] KVM: add ioregionfd context Elena Afanasova
2021-02-24 11:27   ` Stefan Hajnoczi
2021-03-09  7:54   ` Jason Wang
2021-03-09  8:01     ` Paolo Bonzini
2021-03-10 13:20       ` Elena Afanasova
2021-03-10 14:11         ` Paolo Bonzini
2021-03-10 16:41           ` Elena Afanasova
     [not found]             ` <6ff79d0b-3b6a-73d3-ffbd-e4af9758735f@redhat.com>
2021-03-17 10:46               ` Elena Afanasova
2021-03-26  6:47                 ` Jason Wang
2021-02-21 12:04 ` [RFC v3 5/5] KVM: enforce NR_IOBUS_DEVS limit if kmemcg is disabled Elena Afanasova
2021-02-21 17:06 ` [RFC v3 0/5] Introduce MMIO/PIO dispatch file descriptors (ioregionfd) Paolo Bonzini
2021-02-22 16:40   ` Elena Afanasova
2021-02-24 11:34 ` 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=YGH9niCJ9J1DiPtb@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eafanasova@gmail.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=jag.raman@oracle.com \
    --cc=jasowang@redhat.com \
    --cc=john.levon@nutanix.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).