A variety of one-off cleanups and fixes, along with two medium sized series to (1) improve the "force immediate exit" code and (2) clean up the "vCPU preempted in-kernel" checks used for directed yield. The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3: Linux 6.8-rc2 (2024-01-28 17:01:12 -0800) are available in the Git repository at: https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.9 for you to fetch changes up to 78ccfce774435a08d9c69ce434099166cc7952c8: KVM: SVM: Rename vmplX_ssp -> plX_ssp (2024-02-27 12:22:43 -0800) ---------------------------------------------------------------- KVM x86 misc changes for 6.9: - Explicitly initialize a variety of on-stack variables in the emulator that triggered KMSAN false positives (though in fairness in KMSAN, it's comically difficult to see that the uninitialized memory is never truly consumed). - Fix the deubgregs ABI for 32-bit KVM, and clean up code related to reading DR6 and DR7. - Rework the "force immediate exit" code so that vendor code ultimately decides how and when to force the exit. This allows VMX to further optimize handling preemption timer exits, and allows SVM to avoid sending a duplicate IPI (SVM also has a need to force an exit). - Fix a long-standing bug where kvm_has_noapic_vcpu could be left elevated if vCPU creation ultimately failed, and add WARN to guard against similar bugs. - Provide a dedicated arch hook for checking if a different vCPU was in-kernel (for directed yield), and simplify the logic for checking if the currently loaded vCPU is in-kernel. - Misc cleanups and fixes. ---------------------------------------------------------------- John Allen (1): KVM: SVM: Rename vmplX_ssp -> plX_ssp Julian Stecklina (2): KVM: x86: Clean up partially uninitialized integer in emulate_pop() KVM: x86: rename push to emulate_push for consistency Mathias Krause (1): KVM: x86: Fix broken debugregs ABI for 32 bit kernels Nikolay Borisov (1): KVM: x86: Use mutex guards to eliminate __kvm_x86_vendor_init() Sean Christopherson (14): KVM: x86: Make kvm_get_dr() return a value, not use an out parameter KVM: x86: Open code all direct reads to guest DR6 and DR7 KVM: x86: Plumb "force_immediate_exit" into kvm_entry() tracepoint KVM: VMX: Re-enter guest in fastpath for "spurious" preemption timer exits KVM: VMX: Handle forced exit due to preemption timer in fastpath KVM: x86: Move handling of is_guest_mode() into fastpath exit handlers KVM: VMX: Handle KVM-induced preemption timer exits in fastpath for L2 KVM: x86: Fully defer to vendor code to decide how to force immediate exit KVM: x86: Move "KVM no-APIC vCPU" key management into local APIC code KVM: x86: Sanity check that kvm_has_noapic_vcpu is zero at module_exit() KVM: Add dedicated arch hook for querying if vCPU was preempted in-kernel KVM: x86: Rely solely on preempted_in_kernel flag for directed yield KVM: x86: Clean up directed yield API for "has pending interrupt" KVM: Add a comment explaining the directed yield pending interrupt logic Thomas Prescher (1): KVM: x86/emulator: emulate movbe with operand-size prefix arch/x86/include/asm/kvm-x86-ops.h | 1 - arch/x86/include/asm/kvm_host.h | 8 +-- arch/x86/include/asm/svm.h | 8 +-- arch/x86/kvm/emulate.c | 45 +++++++-------- arch/x86/kvm/kvm_emulate.h | 2 +- arch/x86/kvm/lapic.c | 27 ++++++++- arch/x86/kvm/smm.c | 15 ++--- arch/x86/kvm/svm/svm.c | 25 ++++----- arch/x86/kvm/trace.h | 9 ++- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/vmx.c | 85 +++++++++++++++++----------- arch/x86/kvm/vmx/vmx.h | 2 - arch/x86/kvm/x86.c | 110 ++++++++++++------------------------- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 21 ++++++- 15 files changed, 184 insertions(+), 177 deletions(-)