[Top][All Lists]

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

Re: [Qemu-discuss] page table switch performance in qemu

From: Yuxin Ren
Subject: Re: [Qemu-discuss] page table switch performance in qemu
Date: Thu, 6 Oct 2016 11:29:51 -0400

Thank you for your reply.
My cpu supports hardware virtualization, such as intel extended page table.
And I am using qemu 2.0 under Ubuntu 14.04.
I measured the page table switch cost.
On bare metal, it's 140 cycles, but in qemu/kvm, it is 450 cycles.
Do you have some idea where the extra 300 cycles come from?

Thanks a lot!!

On Thu, Oct 6, 2016 at 7:11 AM, Jakob Bohm <address@hidden> wrote:
> On 05/10/2016 21:24, Yuxin Ren wrote:
>> I found page table switch is more expensive in kvm/qemu than on
>> bare-metal.
>> Does anyone have idea how to improve the page table switch performance?
>> Or do I need some special set up for qemu/kvm?
> When the page tables are switched on bare metal, the CPU
> simply changes the register and possibly flushes some of the
> page table cache entries.  This is almost instantaneous, like
> most other CPU instructions, but does of cause incur the
> overhead of (re)loading the new page table entries as needed
> when they are accessed.
> When virtual page tables are switched in a virtual machine,
> the hypervisor (qemu/kvm in this case) needs to recompute the
> values to put in the real page tables to map the virtual
> physical addresses to the real physical addresses, checking
> each one to make sure the virtual machine is allowed access.
>  Even if the hypervisor just marks all the pages as
> inaccessible and then does the computation/lookup when the
> pages are accessed, this still involves some looping over
> table entries in the hypervisor.  Thus page table switching
> is one of the few operations that will almost always be
> slower on a virtual machine.
> There is one exception however: If the bare metal CPU supports
> a second layer of virtual page tables especially for
> virtualization, the hypervisor can use that to avoid most of
> that overhead, which is why some newer CPUs have been equipped
> with this ability.
> With qemu/kvm there is probably some CPU capability flag you
> can look for in /proc/cpuinfo to see if your CPU has that
> acceleration feature (the flag will be different for Intel
> and AMD).  I suppose any recent enough qemu/kvm will use the
> feature if available and reliable.
> Enjoy
> Jakob
> --
> Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
> Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
> This public discussion message is non-binding and may contain errors.
> WiseMo - Remote Service Management for PCs, Phones and Embedded

reply via email to

[Prev in Thread] Current Thread [Next in Thread]