KVM With Linux 5.12 Allows For Userspace To Emulate Xen Hypercalls, AMD Optimization Too
Written by Michael Larabel in Virtualization on 15 February 2021 at 01:04 PM EST. 1 Comment
VIRTUALIZATION --
Even before the Linux 5.11 kernel was released on Sunday, Kernel-based Virtual Machine (KVM) maintainer Paolo Bonzini already had submitted early the initial batch of virtualization changes for Linux 5.12. There are some interesting changes on the KVM front for Linux 5.12.

Perhaps most interesting with the KVM work for Linux 5.12 is support on x86/x86_64 to allow user-space to emulate Xen hypercalls. This ability stems from work published by Oracle engineers all the way back in 2019 as part of a broader series. Those Oracle-led patches are pursuing Xen HVM guest support for KVM. The aim is to allow KVM to boot Xen x86 HVM guests and implemented similar to how Hyper-V is handled for x86 KVM.

Oracle's interest in this functionality is about being able to run unmodified Xen HVM images with KVM, better testing of Xen guests and para-virtualized (PV) drivers, and more. For Linux 5.12 with this initial pull request is just the portion of the patches to allow intercepting hypercalls made by the guest. The patches were picked back up in December of last year by David Woodhouse of Amazon AWS and should be enough to get Xen HVM guests running while further improvements are on the way.

The KVM work also includes scalability improvements to the new MMU code. Paolo is hoping for later in the Linux 5.12 cycle (around -rc3 in a few weeks) to switch over to using the new MMU by default after additional testing has been completed.

There are some AMD-specific improvements this round with now using VMLOAD/VMSAVE for the saving and restoration of the host state, workaround AMD erratum that led to nested virtualization being unreliable, and support for the AMD SEV attestation command. By making use of VMSAVE/VMLOAD for saving/restoring host state in the AMD SVM code led to around a 39% savings in CPU cycles. This stems from an AMD engineer discovering the VMEXIT overhead was quite significant in the current AMD code.

The Linux 5.12 KVM feature pull also has POWER9 and POWER10 improvements, support for the standard TRNG hypervisor call on ARM, and other low-level improvements. More details via this pull request with all of the Kernel-based Virtual Machine feature patches for this next version of the Linux kernel.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week