“KVM Chainsaw”: Cleaning Up the Virtualization Code in Linux 7.3

Translated by a model; the original is in Russian.

· Linux and open source
The Linux 7.3 merge window has accepted the KVM changes: mostly bug fixes and code cleanup, including the breakup of one of the more unwieldy data structures.

cover.svg

Changes to the KVM (Kernel-based Virtual Machine) subsystem have landed in the Linux 7.3 merge window, which closes today. This time there are almost no new user-facing features to speak of — the work is primarily about fixing bugs and tidying up the code.

Breaking Up the “God” Structure

The main event was a long-awaited set of patches dubbed “KVM chainsaw.” The name captures the essence: the developers sawed apart one of the bloated data structures, which they jokingly called the “god data structure.” The kvm_mmu code has been brought into line with modern KVM use cases, and along the way a general “spring (or rather, summer) cleaning” swept through the x86 side.

AMD: Fixing Data Corruption

In the AMD KVM code, full memory pages are now allocated for ENCRYPT/DECRYPT operations in SEV/SEV-ES. This fixes data corruption that occurred because the AMD PSP driver was handing the firmware pages meant for writing. The change brings the kernel's behavior in line with the AMD SEV-SNP specifications. In addition, the ioctl calls for populating memory in SEV-SNP have been hardened against invalid input — among other improvements to the Secure Encrypted Virtualization mechanism.

Intel: TLB Fixes

A number of problems have been resolved on the Intel side. In particular, a local TLB flush is now performed correctly on a failed nested VM-Enter — previously KVM could skip the flush on the next successful entry with the same L2 VPID. VPID virtualization bugs that caused KVM to fail to flush the hardware TLBs have also been fixed.

Other Architectures

The RISC-V KVM implementation has added FWFT support for the Svadu/Zicfiss/Zicfilp extensions in guest systems, and the handling of HFENCE requests for multiprocessor guests has been optimized. For LoongArch and ARM, the work came down mainly to bug fixes.

The details are available in the corresponding pull request.


Source: Phoronix

Comments

Sign in, to comment.

  • No comments yet.