First batch of KVM changes for Linux 6.1
Paolo Bonzini
maintainerLinus,
The following changes since commit 372d07084593dc7a399bf9bee815711b1fb1bcf2:
KVM: selftests: Fix ambiguous mov in KVM_ASM_SAFE() (2022-08-19 07:38:05 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus
for you to fetch changes up to c59fb127583869350256656b7ed848c398bef879:
KVM: remove KVM_REQ_UNHALT (2022-09-26 12:37:21 -0400)
----------------------------------------------------------------
The first batch of KVM patches, mostly covering x86, which I am sending out early due to me travelling next week. There is a lone mm patch for which Andrew gave an informal ack at
https://lore.kernel.org/linux-mm/[email protected].
I will send the bulk of ARM work, as well as other architectures, at the end of next week.
ARM:
* Account stage2 page table allocations in memory stats.
x86:
* Account EPT/NPT arm64 page table allocations in memory stats.
* Tracepoint cleanups/fixes for nested VM-Enter and emulated MSR accesses.
* Drop eVMCS controls filtering for KVM on Hyper-V, all known versions of Hyper-V now support eVMCS fields associated with features that are enumerated to the guest.
* Use KVM's sanitized VMCS config as the basis for the values of nested VMX capabilities MSRs.
* A myriad event/exception fixes and cleanups. Most notably, pending exceptions morph into VM-Exits earlier, as soon as the exception is queued, instead of waiting until the next vmentry. This fixed a longstanding issue where the exceptions would incorrecly become double-faults instead of triggering a vmexit; the common case of page-fault vmexits had a special workaround, but now it's fixed for good.
* A handful of fixes for memory leaks in error paths.
* Cleanups for VMREAD trampoline and VMX's VM-Exit assembly flow.
* Never write to memory from non-sleepable kvm_vcpu_check_block()
* Selftests refinements and cleanups.
* Misc typo cleanups.
Generic:
* remove KVM_REQ_UNHALT
----------------------------------------------------------------
Aaron Lewis (1):
KVM: x86: Delete duplicate documentation for KVM_X86_SET_MSR_FILTER
David Matlack (1):
KVM: nVMX: Add tracepoint for nested VM-Enter
Hou Wenlong (2):
KVM: x86: Return emulator error if RDMSR/WRMSR emulation failed
KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path
Jilin Yuan (1):
KVM: x86/mmu: fix repeated words in comments
Jim Mattson (1):
KVM: x86: VMX: Replace some Intel model numbers with mnemonics
Junaid Shahid (1):
kvm: x86: Do proper cleanup if kvm_x86_ops->vm_init() fails
Liam Ni (1):
KVM:x86: Clean up ModR/M "reg" initialization in reg op decoding
Miaohe Lin (2):
KVM: x86/mmu: fix memoryleak in kvm_mmu_vendor_module_init()
KVM: fix memoryleak in kvm_init()
Michal Luczaj (1):
KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility
Mingwei Zhang (2):
KVM: x86: Update trace function for nested VM entry to support VMX
KVM: x86: Print guest pgd in kvm_nested_vmenter()
Oliver Upton (2):
KVM: selftests: Require DISABLE_NX_HUGE_PAGES cap for NX hugepage test
mailmap: Update Oliver's email address
Paolo Bonzini (6):
KVM: SVM: remove unnecessary check on INIT intercept
KVM: x86: make vendor code check for all nested events
KVM: x86: lapic does not have to process INIT if it is blocked
KVM: x86: never write to memory from kvm_vcpu_check_block()
KVM: mips, x86: do not rely on KVM_REQ_UNHALT
KVM: remove KVM_REQ_UNHALT
Sean Christopherson (44):
KVM: x86: Use u64 for address and error code in page fault tracepoint
KVM: x86: Check for existing Hyper-V vCPU in kvm_hv_vcpu_init()
KVM: x86: Report error when setting CPUID if Hyper-V allocation fails
KVM: nVMX: Treat eVMCS as enabled for guest iff Hyper-V is also enabled
KVM: nVMX: Use CC() macro to handle eVMCS unsupported controls checks
KVM: nVMX: WARN once and fail VM-Enter if eVMCS sees VMFUNC[63:32] != 0
KVM: nVMX: Don't propagate vmcs12's PERF_GLOBAL_CTRL settings to vmcs02
KVM: nVMX: Always emulate PERF_GLOBAL_CTRL VM-Entry/VM-Exit controls
KVM: VMX: Don't toggle VM_ENTRY_IA32E_MODE for 32-bit kernels/KVM
KVM: VMX: Adjust CR3/INVPLG interception for EPT=y at runtime, not setup
KVM: nVMX: Unconditionally purge queued/injected events on nested "exit"
KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS
KVM: x86: Don't check for code breakpoints when emulating on exception
KVM: x86: Allow clearing RFLAGS.RF on forced emulation to test code #DBs
KVM: x86: Suppress code #DBs on Intel if MOV/POP SS blocking is active
KVM: nVMX: Treat General Detect #DB (DR7.GD=1) as fault-like
KVM: nVMX: Prioritize TSS T-flag #DBs over Monitor Trap Flag
KVM: x86: Treat #DBs from the emulator as fault-like (code and DR7.GD=1)
KVM: x86: Use DR7_GD macro instead of open coding check in emulator
KVM: nVMX: Ignore SIPI that arrives in L2 when vCPU is not in WFS
KVM: nVMX: Unconditionally clear mtf_pending on nested VM-Exit
KVM: VMX: Inject #PF on ENCLS as "emulated" #PF
KVM: x86: Rename kvm_x86_ops.queue_exception to inject_exception
KVM: x86: Make kvm_queued_exception a properly named, visible struct
KVM: x86: Formalize blocking of nested pending exceptions
KVM: x86: Use kvm_queue_exception_e() to queue #DF
KVM: x86: Hoist nested event checks above event injection logic
KVM: x86: Evaluate ability to inject SMI/NMI/IRQ after potential VM-Exit
KVM: nVMX: Add a helper to identify low-priority #DB traps
KVM: nVMX: Document priority of all known events on Intel CPUs
KVM: x86: Morph pending exceptions to pending VM-Exits at queue time
KVM: x86: Treat pending TRIPLE_FAULT requests as pending exceptions
KVM: VMX: Update MTF and ICEBP comments to document KVM's subtle behavior
KVM: x86: Rename inject_pending_events() to kvm_check_and_inject_events()
KVM: selftests: Use uapi header to get VMX and SVM exit reasons/codes
KVM: selftests: Add an x86-only test to verify nested exception queueing
KVM: x86: Allow force_emulation_prefix to be written without a reload
KVM: nVMX: Make an event request when pending an MTF nested VM-Exit
KVM: x86: Rename and expose helper to detect if INIT/SIPI are allowed
KVM: x86: Rename kvm_apic_has_events() to make it INIT/SIPI specific
KVM: SVM: Make an event request if INIT or SIPI is pending when GIF is set
KVM: nVMX: Make an event request if INIT or SIPI is pending on VM-Enter
KVM: nVMX: Make event request on VMXOFF iff INIT/SIPI is pending
KVM: x86: Don't snapshot pending INIT/SIPI prior to checking nested events
Uros Bizjak (2):
KVM/VMX: Avoid stack engine synchronization uop in __vmx_vcpu_run
KVM: VMX: Do not declare vmread_error() asmlinkage
Vitaly Kuznetsov (23):
x86/hyperv: Fix 'struct hv_enlightened_vmcs' definition
x86/hyperv: Update 'struct hv_enlightened_vmcs' definition
KVM: x86: Zero out entire Hyper-V CPUID cache before processing entries
KVM: nVMX: Refactor unsupported eVMCS controls logic to use 2-d array
KVM: VMX: Define VMCS-to-EVMCS conversion for the new fields
KVM: nVMX: Support several new fields in eVMCSv1
KVM: x86: hyper-v: Cache HYPERV_CPUID_NESTED_FEATURES CPUID leaf
KVM: selftests: Add ENCLS_EXITING_BITMAP{,HIGH} VMCS fields
KVM: selftests: Switch to updated eVMCSv1 definition
KVM: nVMX: Support PERF_GLOBAL_CTRL with enlightened VMCS
KVM: VMX: Get rid of eVMCS specific VMX controls sanitization
KVM: VMX: Check VM_ENTRY_IA32E_MODE in setup_vmcs_config()
KVM: VMX: Check CPU_BASED_{INTR,NMI}_WINDOW_EXITING in setup_vmcs_config()
KVM: VMX: Tweak the special handling of SECONDARY_EXEC_ENCLS_EXITING in setup_vmcs_config()
KVM: VMX: Extend VMX controls macro shenanigans
KVM: VMX: Move CPU_BASED_CR8_{LOAD,STORE}_EXITING filtering out of setup_vmcs_config()
KVM: VMX: Add missing VMEXIT controls to vmcs_config
KVM: VMX: Add missing CPU based VM execution controls to vmcs_config
KVM: VMX: Move LOAD_IA32_PERF_GLOBAL_CTRL errata handling out of setup_vmcs_config()
KVM: nVMX: Always set required-1 bits of pinbased_ctls to PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR
KVM: nVMX: Use sanitized allowed-1 bits for VMX control MSRs
KVM: VMX: Cache MSR_IA32_VMX_MISC in vmcs_config
KVM: nVMX: Use cached host MSR_IA32_VMX_MISC value for setting up nested MSR
Wonhyuk Yang (1):
KVM: Add extra information in kvm_page_fault trace point
Yosry Ahmed (3):
mm: add NR_SECONDARY_PAGETABLE to count secondary page table uses.
KVM: x86/mmu: count KVM mmu usage in secondary pagetable stats.
KVM: arm64/mmu: count KVM s2 mmu usage in secondary pagetable stats
.mailmap | 1 + Documentation/admin-guide/cgroup-v2.rst | 5 + Documentation/filesystems/proc.rst | 4 + Documentation/virt/kvm/api.rst | 113 +--- Documentation/virt/kvm/vcpu-requests.rst | 28 +- arch/arm64/kvm/arm.c | 1 - arch/arm64/kvm/mmu.c | 36 +- arch/mips/kvm/emulate.c | 6 +- arch/powerpc/kvm/book3s_pr.c | 1 - arch/powerpc/kvm/book3s_pr_papr.c | 1 - arch/powerpc/kvm/booke.c | 1 - arch/powerpc/kvm/powerpc.c | 1 - arch/riscv/kvm/vcpu_insn.c | 1 - arch/s390/kvm/kvm-s390.c | 2 - arch/x86/include/asm/hyperv-tlfs.h | 22 +- arch/x86/include/asm/kvm-x86-ops.h | 2 +- arch/x86/include/asm/kvm_host.h | 39 +- arch/x86/kvm/cpuid.c | 18 +- arch/x86/kvm/emulate.c | 31 +- arch/x86/kvm/hyperv.c | 70 ++- arch/x86/kvm/hyperv.h | 6 +- arch/x86/kvm/lapic.c | 38 +- arch/x86/kvm/lapic.h | 9 +- arch/x86/kvm/mmu/mmu.c | 22 +- arch/x86/kvm/mmu/paging_tmpl.h | 2 +- arch/x86/kvm/mmu/tdp_mmu.c | 12 + arch/x86/kvm/svm/nested.c | 124 +++-- arch/x86/kvm/svm/svm.c | 35 +- arch/x86/kvm/trace.h | 53 +- arch/x86/kvm/vmx/capabilities.h | 14 +- arch/x86/kvm/vmx/evmcs.c | 192 ++++--- arch/x86/kvm/vmx/evmcs.h | 10 +- arch/x86/kvm/vmx/nested.c | 468 +++++++++++------ arch/x86/kvm/vmx/nested.h | 2 +- arch/x86/kvm/vmx/sgx.c | 2 +- arch/x86/kvm/vmx/vmenter.S | 24 +- arch/x86/kvm/vmx/vmx.c | 321 ++++++------ arch/x86/kvm/vmx/vmx.h | 172 +++++- arch/x86/kvm/vmx/vmx_ops.h | 2 +- arch/x86/kvm/x86.c | 576 ++++++++++++++------- arch/x86/kvm/x86.h | 16 +- arch/x86/kvm/xen.c | 1 - drivers/base/node.c | 2 + fs/proc/meminfo.c | 2 + include/linux/kvm_host.h | 16 +- include/linux/mmzone.h | 1 + mm/memcontrol.c | 1 + mm/page_alloc.c | 6 +- mm/vmstat.c | 1 + tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + tools/testing/selftests/kvm/include/x86_64/evmcs.h | 45 +- .../selftests/kvm/include/x86_64/svm_util.h | 7 +- tools/testing/selftests/kvm/include/x86_64/vmx.h | 53 +- .../selftests/kvm/x86_64/nested_exceptions_test.c | 295 +++++++++++ .../selftests/kvm/x86_64/nx_huge_pages_test.c | 24 +- virt/kvm/kvm_main.c | 9 +- 57 files changed, 1871 insertions(+), 1077 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/nested_exceptions_test.c
Paolo Bonzini
maintainerQuoted 7 lines · Paolo Bonzini
The first batch of KVM patches, mostly covering x86, which I am sending out early due to me travelling next week. There is a lone mm patch for which Andrew gave an informal ack at
https://lore.kernel.org/linux-mm/[email protected].I will send the bulk of ARM work, as well as other architectures, at the end of next week.
Linus,
this hasn't been pulled yet, and I suspect that's because most patches have not been in linux-next for most of the 6.0-rc period, which earned me a place in the well-known shitlist.
So, what happened is that this is the first release with KVM/x86 submaintainers. I have noticed now that we have never asked for Sean's tree to be added to linux-next. Sorry about that.
It is now "the end of next week", but I will wait a few more days for you to process this pull request, and then send the ARM/RISC-V parts.
Thanks,
Paolo
The pull request you sent on Fri, 30 Sep 2022 21:08:36 +0200:
The pull request you sent on Fri, 30 Sep 2022 21:08:36 +0200:
Quoted 1 line
https://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ef688f8b8cd3eb20547a6543f03e3d8952b87769
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html