From: Avi Kivity <avi@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Nakajima, Jun" <jun.nakajima@intel.com>,
"Dong, Eddie" <eddie.dong@intel.com>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH] KVM: APIC: avoid instruction emulation for EOI writes
Date: Mon, 29 Aug 2011 17:14:24 +0300 [thread overview]
Message-ID: <4E5B9EC0.2010808@redhat.com> (raw)
In-Reply-To: <4E5B9A3B.2020009@siemens.com>
On 08/29/2011 04:55 PM, Jan Kiszka wrote:
> On 2011-08-29 13:11, Avi Kivity wrote:
> > On 08/29/2011 02:03 PM, Jan Kiszka wrote:
> >>>
> >>> Just reading the first byte requires a guest page table walk. This is
> >>> probably the highest cost in emulation (which also requires a walk for
> >>> the data access).
> >>
> >> And what about caching the result of the first walk? Usually, a "sane
> >> guest" won't have many code pages that issue the EIO.
> >>
> >
> > There's no way to know when to invalidate the cache.
>
> Set the affected code page read-only?
The virt-phys mapping could change too. And please, don't think of new
reasons to write protect pages, they break up my lovely 2M maps.
> >
> > We could go a bit further, and cache the the whole thing. On the first
> > exit, do the entire emulation, and remember %rip. On the second exit,
> > if %rip matches, skip directly to kvm_lapic_eoi().
> >
> > But I don't think it's worth it. This also has failure modes, and
> > really, no guest will ever write to EOI with stosl.
>
> ...or add/sub/and/or etc.
Argh, yes, flags can be updated.
Actually, this might work - if we get a read access first as part of the
RMW, we'll emulate the instruction. No idea what the hardware does in
this case.
> Well, we've done other crazy things in the
> past just to keep even the unlikely case correct. I was just wondering
> if that policy changed.
I can't answer yes to that question. But I see no way to make it work
both fast and correct.
>
> However, I just realized that user space is able to avoid this
> inaccuracy for potentially insane guests by not using in-kernel
> irqchips. So we have at least a knob.
Could/should have a flag to disable this in the kernel as well.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-08-29 14:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-29 6:09 [PATCH] KVM: APIC: avoid instruction emulation for EOI writes Tian, Kevin
2011-08-29 7:23 ` Avi Kivity
2011-08-29 7:35 ` Tian, Kevin
2011-08-29 8:15 ` Sasha Levin
2011-08-29 8:51 ` Avi Kivity
2011-08-29 10:24 ` Jan Kiszka
2011-08-29 10:59 ` Avi Kivity
2011-08-29 11:03 ` Jan Kiszka
2011-08-29 11:11 ` Avi Kivity
2011-08-29 13:55 ` Jan Kiszka
2011-08-29 14:14 ` Avi Kivity [this message]
2011-09-10 8:41 ` ya su
2011-09-11 7:11 ` Avi Kivity
2011-09-11 8:05 ` Jan Kiszka
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=4E5B9EC0.2010808@redhat.com \
--to=avi@redhat.com \
--cc=eddie.dong@intel.com \
--cc=jan.kiszka@siemens.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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.