[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: Jakob Bohm
Subject: Re: [Qemu-discuss] page table switch performance in qemu
Date: Thu, 6 Oct 2016 13:11:39 +0200
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

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.


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]