A recently merged [1] KVM patchset included support for guest SMP, various performance improvements, and suspend/resume fixes. KVM stands for Kernel-based Virtual Machine, "a full virtualization solution for Linux on x86 hardware containing virtualization extensions". In regards to the recently merged guest SMP support which will be part of the upcoming 2.6.23 kernel, Avi Kivity noted:
"Guest smp is fully operational. Kernel build on 2-way smp is 40% faster than on a up guest. Expect significant performance improvements from in-kernel apic and from further tuning."
From: Avi Kivity [2] [email blocked] To: kvm-devel Subject: KVM: Late fixes for the 2.6.23 merge window Date: Tue, 17 Jul 2007 16:22:49 +0300 A trio of issues were discovered and fixed while bringing up smp guests: - An nx huge page table shadow could alias a real mode shadow page table, causing the real mode page to be treated as not executable. For certain newer Linux kernels, this caused kvm to spin on the smp trampoline. This is not an smp issue per se, but only triggered in that scenario. - The memory slot and memory alias manipulation functions were not handled properly in guest smp. This causes hangs starting X. With the patch applied, Linux can boot into graphical mode. - Windows apparently uses rdmsr and wrmsr on its trampoline, so we need to add these instructions to the x86 emulator. With these three patches atop the previously submitted patchset, guest smp is fully operational. Kernel build on 2-way smp is 40% faster than on a up guest. Expect significant performance improvements from in-kernel apic and from further tuning. Please review -- comments welcome.
From: Avi Kivity [3] [email blocked] To: Linus Torvalds [email blocked] Subject: [GIT PULL][RESEND #2] KVM Updates for 2.6.23-rc1 Date: Tue, 17 Jul 2007 19:51:04 +0300 Linus, I fixed the issue with the previous patchset. Please provide further feedback, or pull from: git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git for-linus This contains kvm updates for the 2.6.23 merge window, including - performance improvements - suspend/resume fixes - guest smp - random fixes and cleanups Anthony Liguori (1): KVM: SVM: Allow direct guest access to PC debug port Avi Kivity (57): KVM: Assume that writes smaller than 4 bytes are to non-pagetable pages KVM: Avoid saving and restoring some host CPU state on lightweight vmexit KVM: Unindent some code KVM: Reduce misfirings of the fork detector KVM: Be more careful restoring fs on lightweight vmexit KVM: Unify kvm_mmu_pre_write() and kvm_mmu_post_write() KVM: MMU: Respect nonpae pagetable quadrant when zapping ptes KVM: Update shadow pte on write to guest pte KVM: Increase mmu shadow cache to 1024 pages KVM: Fix potential guest state leak into host KVM: Move some more msr mangling into vmx_save_host_state() KVM: Rationalize exception bitmap usage KVM: Consolidate guest fpu activation and deactivation KVM: Set cr0.mp for guests KVM: MMU: Simplify kvm_mmu_free_page() a tiny bit KVM: MMU: Store shadow page tables as kernel virtual addresses, not physical KVM: VMX: Only reload guest msrs if they are already loaded KVM: Avoid corrupting tr in real mode KVM: Fix vmx I/O bitmap initialization on highmem systems KVM: VMX: Use local labels in inline assembly KVM: x86 emulator: implement wbinvd KVM: MMU: Use slab caches for shadow pages and their headers KVM: MMU: Simplify fetch() a little bit KVM: MMU: Move set_pte_common() to pte width dependent code KVM: MMU: Pass the guest pde to set_pte_common KVM: MMU: Fold fix_read_pf() into set_pte_common() KVM: MMU: Fold fix_write_pf() into set_pte_common() KVM: Move shadow pte modifications from set_pte/set_pde to set_pde_common() KVM: Make shadow pte updates atomic KVM: MMU: Make setting shadow ptes atomic on i386 KVM: MMU: Remove cr0.wp tricks KVM: MMU: Simpify accessed/dirty/present/nx bit handling KVM: MMU: Don't cache guest access bits in the shadow page table KVM: MMU: Remove unused large page marker KVM: Lazy guest cr3 switching KVM: Fix vcpu freeing for guest smp KVM: Fix adding an smp virtual machine to the vm list KVM: Enable guest smp KVM: Move duplicate halt handling code into kvm_main.c KVM: Emulate hlt on real mode for Intel KVM: Keep an upper bound of initialized vcpus KVM: Flush remote tlbs when reducing shadow pte permissions KVM: Initialize the BSP bit in the APIC_BASE msr correctly KVM: VMX: Ensure vcpu time stamp counter is monotonous KVM: VMX: Reinitialize the real-mode tss when entering real mode KVM: VMX: Remove unnecessary code in vmx_tlb_flush() KVM: Remove kvmfs in favor of the anonymous inodes source KVM: Clean up #includes HOTPLUG: Add CPU_DYING notifier HOTPLUG: Adapt cpuset hotplug callback to CPU_DYING HOTPLUG: Adapt thermal throttle to CPU_DYING x86_64: Allow smp_call_function_single() to current cpu i386: Allow smp_call_function_single() to current cpu SMP: Allow smp_call_function_single() to current cpu KVM: Keep track of which cpus have virtualization enabled KVM: Tune hotplug/suspend IPIs KVM: Use CPU_DYING for disabling virtualization Eddie Dong (5): KVM: VMX: Avoid saving and restoring msrs on lightweight vmexit KVM: VMX: Cleanup redundant code in MSR set KVM: VMX: Avoid saving and restoring msr_efer on lightweight vmexit KVM: Use symbolic constants instead of magic numbers KVM: Add support for in-kernel pio handlers Gregory Haskins (2): KVM: Adds support for in-kernel mmio handlers KVM: VMX: Fix interrupt checking on lightweight exit He, Qing (1): KVM: VMX: Enable io bitmaps to avoid IO port 0x80 VMEXITs Jan Engelhardt (1): Use menuconfig objects II - KVM/Virt Joerg Roedel (1): KVM: SVM: Reliably detect if SVM was disabled by BIOS Luca Tettamanti (2): KVM: Fix x86 emulator writeback KVM: Avoid useless memory write when possible Markus Rechberger (1): KVM: Fix includes Matthew Gregan (1): KVM: Implement IA32_EBL_CR_POWERON msr Nguyen Anh Quynh (1): KVM: Remove unnecessary initialization and checks in mark_page_dirty() Nitin A Kamble (3): KVM: VMX: Handle #SS faults from real mode KVM: Implement emulation of "pop reg" instruction (opcode 0x58-0x5f) KVM: Implement emulation of instruction "ret" (opcode 0xc3) Robert P. J. Day (1): KVM: Replace C code with call to ARRAY_SIZE() macro. Shani Moideen (2): KVM: SVM: Replace memset(<addr>, 0, PAGESIZE) with clear_page(<addr>) KVM: VMX: Replace memset(<addr>, 0, PAGESIZE) with clear_page(<addr>) Shaohua Li (1): KVM: MMU: Fix Wrong tlb flush order arch/i386/kernel/cpu/mcheck/therm_throt.c | 6 +- arch/i386/kernel/smpcommon.c | 8 +- arch/x86_64/kernel/smp.c | 12 +- drivers/kvm/Kconfig | 9 +- drivers/kvm/kvm.h | 116 +++++- drivers/kvm/kvm_main.c | 456 ++++++++++++-------- drivers/kvm/mmu.c | 292 ++++++------- drivers/kvm/paging_tmpl.h | 273 +++++++------ drivers/kvm/svm.c | 59 ++- drivers/kvm/svm.h | 3 + drivers/kvm/vmx.c | 652 ++++++++++++++++++----------- drivers/kvm/x86_emulate.c | 44 ++- fs/anon_inodes.c | 1 + include/linux/magic.h | 1 - include/linux/notifier.h | 3 + include/linux/smp.h | 7 +- kernel/cpu.c | 16 +- kernel/cpuset.c | 3 + 18 files changed, 1198 insertions(+), 763 deletions(-)
Related Links:
- Archive of above thread [4]
- KernelTrap interview with Avi Kivity [5]