From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu
Date: Wed, 30 Mar 2011 13:22:43 +0200 [thread overview]
Message-ID: <20110330112243.GV7766@redhat.com> (raw)
In-Reply-To: <4D930B0D.4090809@redhat.com>
On Wed, Mar 30, 2011 at 12:50:53PM +0200, Avi Kivity wrote:
> On 03/30/2011 12:47 PM, Gleb Natapov wrote:
> >On Wed, Mar 30, 2011 at 12:38:53PM +0200, Avi Kivity wrote:
> >> On 03/29/2011 02:08 PM, Gleb Natapov wrote:
> >> >Currently we sync registers back and forth before/after exiting
> >> >to userspace for IO, but during IO device model shouldn't need to
> >> >read/write the registers, so we can as well skip those sync points. The
> >> >only exaception is broken vmware backdor interface. The new code sync
> >> >registers content during IO only if registers are read from/written to
> >> >by userspace in the middle of the IO operation and this almost never
> >> >happens in practise.
> >>
> >> While this is a nice idea, how much does it save in practice? It
> >> does introduce more complexity.
> >>
> >
> >I haven't measured, but can try to do so. It eliminates two copies of
> >all registers on each MMIO/PIO read. I expect this to be measurable in
> >workloads that do many such reads.
> >
>
> I don't, especially if these are mmios to userspace. Perhaps it's
> better to remove the copy on kernel mmio, since it's much faster, if
> the result is simpler (there can be no KVM_SET_REGS in that
> context).
>
The patch saves copying of 256 bytes on each MMIO/PIO read. It may not
save a lot comparing to time it takes to do one MMIO to userspace, but
do 1 million of those and you saved a lot of CPU cycles. I do not think
we should abandon the optimization so easily. Unfortunately I can't run
perf on 2.6.38 kernel right now. It gives me strange errors and when it
doesn't it makes kernel OOPS.
--
Gleb.
next prev parent reply other threads:[~2011-03-30 11:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 12:08 [PATCH] KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu Gleb Natapov
2011-03-30 10:38 ` Avi Kivity
2011-03-30 10:47 ` Gleb Natapov
2011-03-30 10:50 ` Avi Kivity
2011-03-30 11:22 ` Gleb Natapov [this message]
2011-03-30 11:43 ` Gleb Natapov
2011-03-30 12:12 ` Avi Kivity
2011-03-30 12:12 ` Avi Kivity
2011-03-30 12:17 ` Avi Kivity
2011-03-30 12:48 ` Gleb Natapov
2011-03-30 13:26 ` Gleb Natapov
2011-03-30 13:29 ` Avi Kivity
2011-03-30 13:36 ` Gleb Natapov
2011-03-30 13:41 ` Avi Kivity
2011-03-30 13:43 ` Gleb Natapov
2011-03-30 13:46 ` Avi Kivity
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=20110330112243.GV7766@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox