Re: [PATCH] KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 30, 2011 at 01:22:43PM +0200, Gleb Natapov wrote:
> 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.
> 
After reboot perf started to work. I ran modified emulator.flat unit
test. It was modified to run test_cmps() in an endless loop.

Without patch:
1.71%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction
1.51%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction
1.68%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction

With patch:
0.84%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction
0.96%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction
0.89%  qemu-system-x86  [kvm]                 [k] x86_emulate_instruction

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux