KVM to support para-virtualization

In December 2006 the young Kernel Virtualization Module (KVM) has been preferred over VMware and Xen approaches to introduce native server virtualization support in Linux, where will appear since kernel 2.6.20.

Now the project already adds an important feature, support for para-virtualization, thanks to Ingo Molner:

I’m pleased to announce the first release of paravirtualized KVM (Linux under Linux), which includes support for the hardware cr3-cache feature of Intel-VMX CPUs. (which speeds up context switches and TLB flushes)

  • it provides an ad-hoc paravirtualization hypercall API between a Linux guest and a Linux host. (this will be replaced with a proper hypercall later on)
  • using the hypercall API it utilizes the “cr3 target cache” feature in Intel VMX CPUs, and extends KVM to make use of that cache. This feature allows the avoidance of expensive VM exits into hypervisor context. (The guest needs to be ‘aware’ and the cache has to be shared between the guest and the hypervisor. So fully emulated OSs wont benefit from this feature)
  • paravirtualization is triggered via the kvm_paravirt=1 boot option (for now, this too is ad-hoc) – if that is passed then the KVM guest will probe for paravirtualization availability on the hypervisor side – and will use it if found. (If the guest does not find KVM-paravirt support on the hypervisor side then it will continue as a fully emulated guest)

This patch significantly improves KVM performances by 4 times in context-switchting operations, nearing physical machines perfomances.