From: Gleb Natapov <gleb@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>,
Alex Williamson <alex.williamson@redhat.com>,
Will Deacon <will.deacon@arm.com>,
Christoffer Dall <c.dall@virtualopensystems.com>,
Sasha Levin <sasha.levin@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC] kvm: add PV MMIO EVENTFD
Date: Thu, 4 Apr 2013 15:38:06 +0300 [thread overview]
Message-ID: <20130404123806.GG17919@redhat.com> (raw)
In-Reply-To: <959E147D-EB7B-4F4B-9F84-4F1BBA98DEF8@suse.de>
On Thu, Apr 04, 2013 at 02:32:08PM +0200, Alexander Graf wrote:
>
> On 04.04.2013, at 14:08, Gleb Natapov wrote:
>
> > On Thu, Apr 04, 2013 at 01:57:34PM +0200, Alexander Graf wrote:
> >>
> >> On 04.04.2013, at 12:50, Michael S. Tsirkin wrote:
> >>
> >>> With KVM, MMIO is much slower than PIO, due to the need to
> >>> do page walk and emulation. But with EPT, it does not have to be: we
> >>> know the address from the VMCS so if the address is unique, we can look
> >>> up the eventfd directly, bypassing emulation.
> >>>
> >>> Add an interface for userspace to specify this per-address, we can
> >>> use this e.g. for virtio.
> >>>
> >>> The implementation adds a separate bus internally. This serves two
> >>> purposes:
> >>> - minimize overhead for old userspace that does not use PV MMIO
> >>> - minimize disruption in other code (since we don't know the length,
> >>> devices on the MMIO bus only get a valid address in write, this
> >>> way we don't need to touch all devices to teach them handle
> >>> an dinvalid length)
> >>>
> >>> At the moment, this optimization is only supported for EPT on x86 and
> >>> silently ignored for NPT and MMU, so everything works correctly but
> >>> slowly.
> >>>
> >>> TODO: NPT, MMU and non x86 architectures.
> >>>
> >>> The idea was suggested by Peter Anvin. Lots of thanks to Gleb for
> >>> pre-review and suggestions.
> >>>
> >>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >>
> >> This still uses page fault intercepts which are orders of magnitudes slower than hypercalls. Why don't you just create a PV MMIO hypercall that the guest can use to invoke MMIO accesses towards the host based on physical addresses with explicit length encodings?
> >>
> > It is slower, but not an order of magnitude slower. It become faster
> > with newer HW.
> >
> >> That way you simplify and speed up all code paths, exceeding the speed of PIO exits even. It should also be quite easily portable, as all other platforms have hypercalls available as well.
> >>
> > We are trying to avoid PV as much as possible (well this is also PV,
> > but not guest visible
>
> Also, how is this not guest visible? Who sets KVM_IOEVENTFD_FLAG_PV_MMIO? The comment above its definition indicates that the guest does so, so it is guest visible.
>
QEMU sets it.
> +/*
> + * PV_MMIO - Guest can promise us that all accesses touching this address
> + * are writes of specified length, starting at the specified address.
> + * If not - it's a Guest bug.
> + * Can not be used together with either PIO or DATAMATCH.
> + */
>
Virtio spec will state that access to a kick register needs to be of
specific length. This is reasonable thing for HW to ask.
--
Gleb.
next prev parent reply other threads:[~2013-04-04 12:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 10:50 [PATCH RFC] kvm: add PV MMIO EVENTFD Michael S. Tsirkin
2013-04-04 11:57 ` Alexander Graf
2013-04-04 11:04 ` Michael S. Tsirkin
2013-04-04 12:09 ` Alexander Graf
2013-04-04 11:21 ` Michael S. Tsirkin
2013-04-04 12:19 ` Gleb Natapov
2013-04-04 12:22 ` Alexander Graf
2013-04-04 12:08 ` Gleb Natapov
2013-04-04 12:22 ` Alexander Graf
2013-04-04 12:34 ` Gleb Natapov
2013-04-04 12:39 ` Alexander Graf
2013-04-04 12:58 ` Michael S. Tsirkin
2013-04-04 14:02 ` Alexander Graf
2013-04-04 13:40 ` Michael S. Tsirkin
2013-04-04 12:32 ` Alexander Graf
2013-04-04 12:38 ` Gleb Natapov [this message]
2013-04-04 12:39 ` Alexander Graf
2013-04-04 12:45 ` Gleb Natapov
2013-04-04 12:49 ` Alexander Graf
2013-04-04 12:56 ` Gleb Natapov
2013-04-04 13:06 ` Alexander Graf
2013-04-04 13:14 ` Gleb Natapov
2013-04-04 14:26 ` Michael S. Tsirkin
2013-04-07 9:30 ` Gleb Natapov
2013-04-07 8:43 ` Michael S. Tsirkin
2013-04-04 13:33 ` Michael S. Tsirkin
2013-04-04 15:36 ` Alexander Graf
2013-04-04 15:36 ` Michael S. Tsirkin
2013-04-04 16:39 ` Gleb Natapov
2013-04-04 23:32 ` Christoffer Dall
2013-04-07 7:41 ` Michael S. Tsirkin
2013-04-07 21:25 ` Christoffer Dall
2013-04-04 16:33 ` Gleb Natapov
2013-04-04 13:12 ` Michael S. Tsirkin
2013-04-04 13:06 ` Michael S. Tsirkin
2013-04-04 13:03 ` Michael S. Tsirkin
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=20130404123806.GG17919@redhat.com \
--to=gleb@redhat.com \
--cc=agraf@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=c.dall@virtualopensystems.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=sasha.levin@oracle.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.org \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=xiaoguangrong@linux.vnet.ibm.com \
--cc=yoshikawa_takuya_b1@lab.ntt.co.jp \
/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).