* [GIT PULL] KVM: x86 pull requests 6.19
@ 2025-11-26 1:44 Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: Generic changes for 6.19 Sean Christopherson
` (7 more replies)
0 siblings, 8 replies; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
I don't think there are any notable anomolies this time around?
The guest_memfd,misc, and svm pulls have conflicts. Details in the guest_memfd
and svm requests (only the guest_memfd one is non-trivial).
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: Generic changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:59 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: guest_memfd: NUMA support and other " Sean Christopherson
` (6 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
A tweak to account for an upcoming API change, and a doc fix.
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.19
for you to fetch changes up to 04fd067b770d19fee39759d994c4bfa2fb332d9f:
KVM: Fix VM exit code for full dirty ring in API documentation (2025-10-14 15:19:05 -0700)
----------------------------------------------------------------
KVM generic changes for 6.19:
- Use the recently-added WQ_PERCPU when creating the per-CPU workqueue for
irqfd cleanup.
- Fix a goof in the dirty ring documentation.
----------------------------------------------------------------
Leonardo Bras (1):
KVM: Fix VM exit code for full dirty ring in API documentation
Marco Crivellari (1):
KVM: Explicitly allocate/setup irqfd cleanup as per-CPU workqueue
Documentation/virt/kvm/api.rst | 2 +-
virt/kvm/eventfd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: guest_memfd: NUMA support and other changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: Generic changes for 6.19 Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:33 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
` (5 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
Please pull NUMA mempolicy guest_memfd support, along with a handful of
guest_memfd cleanups and some tangentially related additions to KVM selftests
infrastructure.
This will conflict with kvm/master due to commit ae431059e75d ("KVM:
guest_memfd: Remove bindings on memslot deletion when gmem is dying"). The
resolution I've been using for linux-next is below.
--
diff --cc virt/kvm/guest_memfd.c
index ffadc5ee8e04,427c0acee9d7..fdaea3422c30
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@@ -623,53 -708,31 +708,49 @@@ err
return r;
}
- static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct kvm_gmem *gmem)
-void kvm_gmem_unbind(struct kvm_memory_slot *slot)
++static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct gmem_file *f)
{
unsigned long start = slot->gmem.pgoff;
unsigned long end = start + slot->npages;
- struct gmem_file *f;
- xa_store_range(&gmem->bindings, start, end - 1, NULL, GFP_KERNEL);
- /*
- * Nothing to do if the underlying file was already closed (or is being
- * closed right now), kvm_gmem_release() invalidates all bindings.
- */
- CLASS(gmem_get_file, file)(slot);
- if (!file)
- return;
-
- f = file->private_data;
-
- filemap_invalidate_lock(file->f_mapping);
+ xa_store_range(&f->bindings, start, end - 1, NULL, GFP_KERNEL);
/*
* synchronize_srcu(&kvm->srcu) ensured that kvm_gmem_get_pfn()
* cannot see this memslot.
*/
WRITE_ONCE(slot->gmem.file, NULL);
+}
+
+void kvm_gmem_unbind(struct kvm_memory_slot *slot)
+{
- struct file *file;
-
+ /*
+ * Nothing to do if the underlying file was _already_ closed, as
+ * kvm_gmem_release() invalidates and nullifies all bindings.
+ */
+ if (!slot->gmem.file)
+ return;
+
- file = kvm_gmem_get_file(slot);
++ CLASS(gmem_get_file, file)(slot);
+
+ /*
+ * However, if the file is _being_ closed, then the bindings need to be
+ * removed as kvm_gmem_release() might not run until after the memslot
+ * is freed. Note, modifying the bindings is safe even though the file
+ * is dying as kvm_gmem_release() nullifies slot->gmem.file under
+ * slots_lock, and only puts its reference to KVM after destroying all
+ * bindings. I.e. reaching this point means kvm_gmem_release() hasn't
+ * yet destroyed the bindings or freed the gmem_file, and can't do so
+ * until the caller drops slots_lock.
+ */
+ if (!file) {
+ __kvm_gmem_unbind(slot, slot->gmem.file->private_data);
+ return;
+ }
+
+ filemap_invalidate_lock(file->f_mapping);
+ __kvm_gmem_unbind(slot, file->private_data);
filemap_invalidate_unlock(file->f_mapping);
-
- fput(file);
}
/* Returns a locked folio on success. */
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-gmem-6.19
for you to fetch changes up to 83e0e12219a402bf7b8fdef067e51f945a92fd26:
KVM: selftests: Rename "guest_paddr" variables to "gpa" (2025-11-03 12:54:21 -0800)
----------------------------------------------------------------
KVM guest_memfd changes for 6.19:
- Add NUMA mempolicy support for guest_memfd, and clean up a variety of
rough edges in guest_memfd along the way.
- Define a CLASS to automatically handle get+put when grabbing a guest_memfd
from a memslot to make it harder to leak references.
- Enhance KVM selftests to make it easer to develop and debug selftests like
those added for guest_memfd NUMA support, e.g. where test and/or KVM bugs
often result in hard-to-debug SIGBUS errors.
- Misc cleanups.
----------------------------------------------------------------
Ackerley Tng (1):
KVM: guest_memfd: Use guest mem inodes instead of anonymous inodes
Matthew Wilcox (2):
mm/filemap: Add NUMA mempolicy support to filemap_alloc_folio()
mm/filemap: Extend __filemap_get_folio() to support NUMA memory policies
Pedro Demarchi Gomes (1):
KVM: guest_memfd: use folio_nr_pages() instead of shift operation
Sean Christopherson (10):
KVM: guest_memfd: Drop a superfluous local var in kvm_gmem_fault_user_mapping()
KVM: guest_memfd: Rename "struct kvm_gmem" to "struct gmem_file"
KVM: guest_memfd: Add macro to iterate over gmem_files for a mapping/inode
KVM: selftests: Define wrappers for common syscalls to assert success
KVM: selftests: Report stacktraces SIGBUS, SIGSEGV, SIGILL, and SIGFPE by default
KVM: selftests: Add additional equivalents to libnuma APIs in KVM's numaif.h
KVM: selftests: Use proper uAPI headers to pick up mempolicy.h definitions
KVM: guest_memfd: Add gmem_inode.flags field instead of using i_private
KVM: guest_memfd: Define a CLASS to get+put guest_memfd file from a memslot
KVM: selftests: Rename "guest_paddr" variables to "gpa"
Shivank Garg (7):
mm/mempolicy: Export memory policy symbols
KVM: guest_memfd: move kvm_gmem_get_index() and use in kvm_gmem_prepare_folio()
KVM: guest_memfd: remove redundant gmem variable initialization
KVM: guest_memfd: Add slab-allocated inode cache
KVM: guest_memfd: Enforce NUMA mempolicy using shared policy
KVM: selftests: Add helpers to probe for NUMA support, and multi-node systems
KVM: selftests: Add guest_memfd tests for mmap and NUMA policy support
fs/btrfs/compression.c | 4 +-
fs/btrfs/verity.c | 2 +-
fs/erofs/zdata.c | 2 +-
fs/f2fs/compress.c | 2 +-
include/linux/pagemap.h | 18 +++--
include/uapi/linux/magic.h | 1 +
mm/filemap.c | 23 ++++---
mm/mempolicy.c | 6 ++
mm/readahead.c | 2 +-
tools/testing/selftests/kvm/arm64/vgic_irq.c | 2 +-
tools/testing/selftests/kvm/guest_memfd_test.c | 98 +++++++++++++++++++++++++++
tools/testing/selftests/kvm/include/kvm_syscalls.h | 81 ++++++++++++++++++++++
tools/testing/selftests/kvm/include/kvm_util.h | 39 ++---------
tools/testing/selftests/kvm/include/numaif.h | 110 ++++++++++++++++++------------
tools/testing/selftests/kvm/kvm_binary_stats_test.c | 4 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 101 +++++++++++++++-------------
tools/testing/selftests/kvm/x86/private_mem_conversions_test.c | 9 +--
tools/testing/selftests/kvm/x86/xapic_ipi_test.c | 5 +-
virt/kvm/guest_memfd.c | 374 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
virt/kvm/kvm_main.c | 7 +-
virt/kvm/kvm_mm.h | 9 +--
21 files changed, 646 insertions(+), 253 deletions(-)
create mode 100644 tools/testing/selftests/kvm/include/kvm_syscalls.h
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: Misc changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: Generic changes for 6.19 Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: guest_memfd: NUMA support and other " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:49 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
` (4 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
The bulk of the vendor agnostic x86 changes for 6.19. There are multiple
noteworthy changes, though nothing stands out as being _that_ much more
interesting than the rest.
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.19
for you to fetch changes up to c09816f2afce0f89f176c4bc58dc57ec9f204998:
KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat() (2025-11-20 07:26:35 -0800)
----------------------------------------------------------------
KVM x86 misc changes for 6.19:
- Fix an async #PF bug where KVM would clear the completion queue when the
guest transitioned in and out of paging mode, e.g. when handling an SMI and
then returning to paged mode via RSM.
- Fix a bug where TDX would effectively corrupt user-return MSR values if the
TDX Module rejects VP.ENTER and thus doesn't clobber host MSRs as expected.
- Leave the user-return notifier used to restore MSRs registered when
disabling virtualization, and instead pin kvm.ko. Restoring host MSRs via
IPI callback is either pointless (clean reboot) or dangerous (forced reboot)
since KVM has no idea what code it's interrupting.
- Use the checked version of {get,put}_user(), as Linus wants to kill them
off, and they're measurably faster on modern CPUs due to the unchecked
versions containing an LFENCE.
- Fix a long-lurking bug where KVM's lack of catch-up logic for periodic APIC
timers can result in a hard lockup in the host.
- Revert the periodic kvmclock sync logic now that KVM doesn't use a
clocksource that's subject to NPT corrections.
- Clean up KVM's handling of MMIO Stale Data and L1TF, and bury the latter
behind CONFIG_CPU_MITIGATIONS.
- Context switch XCR0, XSS, and PKRU outside of the entry/exit fastpath as
the only reason they were handled in the faspath was to paper of a bug in
the core #MC code that has long since been fixed.
- Add emulator support for AVX MOV instructions to play nice with emulated
devices whose PCI BARs guest drivers like to access with large multi-byte
instructions.
----------------------------------------------------------------
Binbin Wu (1):
KVM: x86: Add a helper to dedup loading guest/host XCR0 and XSS
Brendan Jackman (1):
KVM: x86: Unify L1TF flushing under per-CPU variable
Chang S. Bae (1):
KVM: x86: Refactor REX prefix handling in instruction emulation
Chao Gao (1):
KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time
Hou Wenlong (1):
KVM: x86: Don't disable IRQs when unregistering user-return notifier
Lei Chen (3):
Revert "x86: kvm: introduce periodic global clock updates"
Revert "x86: kvm: rate-limit global clock updates"
KVM: x86: remove comment about ntp correction sync for
Maxim Levitsky (2):
KVM: x86: Fix a semi theoretical bug in kvm_arch_async_page_present_queued()
KVM: x86: Don't clear async #PF queue when CR0.PG is disabled (e.g. on #SMI)
Paolo Bonzini (9):
KVM: x86: Add support for emulating MOVNTDQA
KVM: x86: Move Src2Shift up one bit (use bits 36:32 for Src2 in the emulator)
KVM: x86: Improve formatting of the emulator's flags table
KVM: x86: Move op_prefix to struct x86_emulate_ctxt (from x86_decode_insn())
KVM: x86: Share emulator's common register decoding code
KVM: x86: Add x86_emulate_ops.get_xcr() callback
KVM: x86: Add AVX support to the emulator's register fetch and writeback
KVM: x86: Add emulator support for decoding VEX prefixes
KVM: x86: Enable support for emulating AVX MOV instructions
Pawan Gupta (1):
x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well
Sean Christopherson (18):
KVM: x86: Add a helper to dedup reporting of unhandled VM-Exits
KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module
KVM: x86: WARN if user-return MSR notifier is registered on exit
KVM: x86: Leave user-return notifier registered on reboot/shutdown
KVM: x86: Use "checked" versions of get_user() and put_user()
KVM: x86: WARN if hrtimer callback for periodic APIC timer fires with period=0
KVM: x86: Grab lapic_timer in a local variable to cleanup periodic code
KVM: VMX: Use on-stack copy of @flags in __vmx_vcpu_run()
x86/bugs: Decouple ALTERNATIVE usage from VERW macro definition
x86/bugs: Use an x86 feature to track the MMIO Stale Data mitigation
KVM: VMX: Handle MMIO Stale Data in VM-Enter assembly via ALTERNATIVES_2
x86/bugs: KVM: Move VM_CLEAR_CPU_BUFFERS into SVM as SVM_CLEAR_CPU_BUFFERS
KVM: VMX: Bundle all L1 data cache flush mitigation code together
KVM: VMX: Disable L1TF L1 data cache flush if CONFIG_CPU_MITIGATIONS=n
KVM: SVM: Handle #MCs in guest outside of fastpath
KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath
KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop
KVM: x86: Load guest/host PKRU outside of the fastpath run loop
Yue Haibing (1):
KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat()
fuqiang wang (2):
KVM: x86: Explicitly set new periodic hrtimer expiration in apic_timer_fn()
KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timer
arch/x86/include/asm/cpufeatures.h | 5 ++
arch/x86/include/asm/hardirq.h | 4 +-
arch/x86/include/asm/kvm_host.h | 7 +--
arch/x86/include/asm/nospec-branch.h | 30 ++++++------
arch/x86/kernel/cpu/bugs.c | 22 ++++-----
arch/x86/kvm/emulate.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------
arch/x86/kvm/fpu.h | 66 +++++++++++++++++++++++++++
arch/x86/kvm/hyperv.c | 2 +-
arch/x86/kvm/kvm_emulate.h | 20 ++++++--
arch/x86/kvm/lapic.c | 44 ++++++++++++------
arch/x86/kvm/mmu.h | 2 -
arch/x86/kvm/mmu/mmu.c | 2 +-
arch/x86/kvm/mmu/paging_tmpl.h | 2 +-
arch/x86/kvm/mmu/spte.c | 2 +-
arch/x86/kvm/svm/svm.c | 27 ++++-------
arch/x86/kvm/svm/vmenter.S | 6 ++-
arch/x86/kvm/vmx/nested.c | 2 +-
arch/x86/kvm/vmx/run_flags.h | 10 ++--
arch/x86/kvm/vmx/tdx.c | 65 ++++++++++----------------
arch/x86/kvm/vmx/tdx.h | 1 -
arch/x86/kvm/vmx/vmenter.S | 29 +++++++-----
arch/x86/kvm/vmx/vmx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------
arch/x86/kvm/x86.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------
arch/x86/kvm/x86.h | 16 ++++++-
24 files changed, 706 insertions(+), 500 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: MMU changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
` (2 preceding siblings ...)
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:50 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
` (3 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
An optimization for enable_mmio_caching=0 and a minor cleanup.
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.19
for you to fetch changes up to 6422060aa9c7bb2039b23948db5d4e8194036657:
KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range() (2025-11-04 09:51:06 -0800)
----------------------------------------------------------------
KVM x86 MMU changes for 6.19:
- Skip the costly "zap all SPTEs" on an MMIO generation wrap if MMIO SPTE
caching is disabled, as there can't be any relevant SPTEs to zap.
- Relocate a misplace export.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: x86/mmu: Skip MMIO SPTE invalidation if enable_mmio_caching=0
Kai Huang (1):
KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range()
arch/x86/kvm/mmu/mmu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: Selftests changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
` (3 preceding siblings ...)
2025-11-26 1:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:51 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
` (2 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
The highlights are Jim's LA57 nested VMX test, and Yosry's many changes to
extend nested VMX tests to also cover nested SVM.
The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.19
for you to fetch changes up to d2e50389ab44acfa05e72604d701a70b234f9938:
KVM: selftests: Make sure vm->vpages_mapped is always up-to-date (2025-11-21 10:17:05 -0800)
----------------------------------------------------------------
KVM selftests changes for 6.19:
- Fix a math goof in mmu_stress_test when running on a single-CPU system/VM.
- Forcefully override ARCH from x86_64 to x86 to play nice with specifying
ARCH=x86_64 on the command line.
- Extend a bunch of nested VMX to validate nested SVM as well.
- Add support for LA57 in the core VM_MODE_xxx macro, and add a test to
verify KVM can save/restore nested VMX state when L1 is using 5-level
paging, but L2 is not.
- Clean up the guest paging code in anticipation of sharing the core logic for
nested EPT and nested NPT.
----------------------------------------------------------------
Brendan Jackman (1):
KVM: selftests: Don't fall over in mmu_stress_test when only one CPU is present
Jim Mattson (4):
KVM: selftests: Use a loop to create guest page tables
KVM: selftests: Use a loop to walk guest page tables
KVM: selftests: Change VM_MODE_PXXV48_4K to VM_MODE_PXXVYY_4K
KVM: selftests: Add a VMX test for LA57 nested state
Sean Christopherson (2):
KVM: selftests: Forcefully override ARCH from x86_64 to x86
KVM: selftests: Use "gpa" and "gva" for local variable names in pre-fault test
Yosry Ahmed (9):
KVM: selftests: Extend vmx_close_while_nested_test to cover SVM
KVM: selftests: Extend vmx_nested_tsc_scaling_test to cover SVM
KVM: selftests: Move nested invalid CR3 check to its own test
KVM: selftests: Extend nested_invalid_cr3_test to cover SVM
KVM: selftests: Extend vmx_tsc_adjust_test to cover SVM
KVM: selftests: Stop hardcoding PAGE_SIZE in x86 selftests
KVM: selftests: Remove the unused argument to prepare_eptp()
KVM: selftests: Stop using __virt_pg_map() directly in tests
KVM: selftests: Make sure vm->vpages_mapped is always up-to-date
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/kvm/Makefile.kvm | 8 +-
tools/testing/selftests/kvm/include/kvm_util.h | 5 +-
.../testing/selftests/kvm/include/x86/processor.h | 2 +-
tools/testing/selftests/kvm/include/x86/vmx.h | 3 +-
tools/testing/selftests/kvm/lib/arm64/processor.c | 2 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 33 +++---
tools/testing/selftests/kvm/lib/x86/memstress.c | 2 +-
tools/testing/selftests/kvm/lib/x86/processor.c | 84 ++++++-------
tools/testing/selftests/kvm/lib/x86/vmx.c | 9 +-
tools/testing/selftests/kvm/mmu_stress_test.c | 10 +-
.../testing/selftests/kvm/pre_fault_memory_test.c | 32 +++--
tools/testing/selftests/kvm/x86/hyperv_features.c | 2 +-
tools/testing/selftests/kvm/x86/hyperv_ipi.c | 18 +--
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c | 2 +-
...while_nested_test.c => nested_close_kvm_test.c} | 42 +++++--
.../selftests/kvm/x86/nested_invalid_cr3_test.c | 116 ++++++++++++++++++
..._tsc_adjust_test.c => nested_tsc_adjust_test.c} | 73 +++++++-----
...sc_scaling_test.c => nested_tsc_scaling_test.c} | 48 +++++++-
tools/testing/selftests/kvm/x86/sev_smoke_test.c | 2 +-
tools/testing/selftests/kvm/x86/state_test.c | 2 +-
.../testing/selftests/kvm/x86/userspace_io_test.c | 2 +-
.../testing/selftests/kvm/x86/vmx_dirty_log_test.c | 12 +-
.../selftests/kvm/x86/vmx_nested_la57_state_test.c | 132 +++++++++++++++++++++
24 files changed, 479 insertions(+), 164 deletions(-)
rename tools/testing/selftests/kvm/x86/{vmx_close_while_nested_test.c => nested_close_kvm_test.c} (64%)
create mode 100644 tools/testing/selftests/kvm/x86/nested_invalid_cr3_test.c
rename tools/testing/selftests/kvm/x86/{vmx_tsc_adjust_test.c => nested_tsc_adjust_test.c} (61%)
rename tools/testing/selftests/kvm/x86/{vmx_nested_tsc_scaling_test.c => nested_tsc_scaling_test.c} (83%)
create mode 100644 tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: SVM changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
` (4 preceding siblings ...)
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:48 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: TDX " Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
A handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new
uAPI to advertise SNP policy bits to userspace.
Side topic, this pull request is finally proof that I don't just merge my own
stuff :-D
There's a minor conflict in svm.h due to the removal of the
avic_ga_log_notifier() declaration in kvm/master:
diff --cc arch/x86/kvm/svm/svm.h
index dd78e6402345,a9f6c1ece63d..9e151dbdef25
--- a/arch/x86/kvm/svm/svm.h
+++ b/arch/x86/kvm/svm/svm.h
@@@ -806,7 -802,8 +803,8 @@@ extern struct kvm_x86_nested_ops svm_ne
)
bool __init avic_hardware_setup(void);
-int avic_ga_log_notifier(u32 ga_tag);
+void avic_hardware_unsetup(void);
+ int avic_alloc_physical_id_table(struct kvm *kvm);
void avic_vm_destroy(struct kvm *kvm);
int avic_vm_init(struct kvm *kvm);
void avic_init_vmcb(struct vcpu_svm *svm, struct vmcb *vmcb);
And a conflict in cpufeatures.h with the "misc" pull request. This (and the
change from "misc") will also conflict with new features being added via the
tip-tree. Boris is aware and presumably will give Linus a heads up. Merging
on top of "misc":
diff --cc arch/x86/include/asm/cpufeatures.h
index fc5698844a0b,7129eb44adad..646d2a77a2e2
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@@ -499,11 -500,7 +500,12 @@@
#define X86_FEATURE_IBPB_EXIT_TO_USER (21*32+14) /* Use IBPB on exit-to-userspace, see VMSCAPE bug */
#define X86_FEATURE_ABMC (21*32+15) /* Assignable Bandwidth Monitoring Counters */
#define X86_FEATURE_MSR_IMM (21*32+16) /* MSR immediate form instructions */
- #define X86_FEATURE_CLEAR_CPU_BUF_VM_MMIO (21*32+17) /*
+ #define X86_FEATURE_X2AVIC_EXT (21*32+17) /* AMD SVM x2AVIC support for 4k vCPUs */
++#define X86_FEATURE_CLEAR_CPU_BUF_VM_MMIO (21*32+18) /*
+ * Clear CPU buffers before VM-Enter if the vCPU
+ * can access host MMIO (ignored for all intents
+ * and purposes if CLEAR_CPU_BUF_VM is set).
+ */
/*
* BUG word(s)
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-svm-6.19
for you to fetch changes up to 275d6d1189e6d5f8e7c1da43ffd4b09d7089f174:
KVM: SEV: Add known supported SEV-SNP policy bits (2025-11-14 10:30:12 -0800)
----------------------------------------------------------------
KVM SVM changes for 6.19:
- Fix a few missing "VMCB dirty" bugs.
- Fix the worst of KVM's lack of EFER.LMSLE emulation.
- Add AVIC support for addressing 4k vCPUs in x2AVIC mode.
- Fix incorrect handling of selective CR0 writes when checking intercepts
during emulation of L2 instructions.
- Fix a currently-benign bug where KVM would clobber SPEC_CTRL[63:32] on
VMRUN and #VMEXIT.
- Fix a bug where KVM corrupt the guest code stream when re-injecting a soft
interrupt if the guest patched the underlying code after the VM-Exit, e.g.
when Linux patches code with a temporary INT3.
- Add KVM_X86_SNP_POLICY_BITS to advertise supported SNP policy bits to
userspace, and extend KVM "support" to all policy bits that don't require
any actual support from KVM.
----------------------------------------------------------------
Jim Mattson (4):
KVM: SVM: Mark VMCB_PERM_MAP as dirty on nested VMRUN
KVM: SVM: Mark VMCB_NPT as dirty on nested VMRUN
KVM: x86: Advertise EferLmsleUnsupported to userspace
KVM: SVM: Disallow EFER.LMSLE when not supported by hardware
Naveen N Rao (7):
KVM: SVM: Limit AVIC physical max index based on configured max_vcpu_ids
KVM: SVM: Add a helper to look up the max physical ID for AVIC
KVM: SVM: Replace hard-coded value 0x1FF with the corresponding macro
KVM: SVM: Expand AVIC_PHYSICAL_MAX_INDEX_MASK to be a 12-bit field
KVM: SVM: Move AVIC Physical ID table allocation to vcpu_precreate()
x86/cpufeatures: Add X86_FEATURE_X2AVIC_EXT
KVM: SVM: Add AVIC support for 4k vCPUs in x2AVIC mode
Omar Sandoval (1):
KVM: SVM: Don't skip unrelated instruction if INT3/INTO is replaced
Tom Lendacky (4):
KVM: SEV: Consolidate the SEV policy bits in a single header file
crypto: ccp - Add an API to return the supported SEV-SNP policy bits
KVM: SEV: Publish supported SEV-SNP policy bits
KVM: SEV: Add known supported SEV-SNP policy bits
Uros Bizjak (1):
KVM: SVM: Ensure SPEC_CTRL[63:32] is context switched between guest and host
Yosry Ahmed (4):
KVM: nSVM: Remove redundant cases in nested_svm_intercept()
KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW emulation
KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE
KVM: x86: Document a virtualization gap for GIF on AMD CPUs
Documentation/virt/kvm/x86/errata.rst | 9 +++-
arch/x86/include/asm/cpufeatures.h | 2 +
arch/x86/include/asm/kvm_host.h | 9 ++++
arch/x86/include/asm/svm.h | 5 +-
arch/x86/include/uapi/asm/kvm.h | 1 +
arch/x86/kernel/cpu/scattered.c | 1 +
arch/x86/kvm/cpuid.c | 1 +
arch/x86/kvm/svm/avic.c | 86 ++++++++++++++++++++++++++++-------
arch/x86/kvm/svm/nested.c | 12 +----
arch/x86/kvm/svm/sev.c | 45 +++++++++++-------
arch/x86/kvm/svm/svm.c | 78 ++++++++++++++++++++-----------
arch/x86/kvm/svm/svm.h | 4 +-
arch/x86/kvm/svm/vmenter.S | 47 +++++++++++++++----
arch/x86/kvm/x86.c | 21 +++++++++
drivers/crypto/ccp/sev-dev.c | 37 +++++++++++++++
include/linux/psp-sev.h | 37 +++++++++++++++
16 files changed, 310 insertions(+), 85 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: TDX changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
` (5 preceding siblings ...)
2025-11-26 1:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:51 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
Please pull a large overhaul of lock-related TDX code (particularly in the
S-EPT and mirror SPTE code), along with a few fixes and cleanups.
*Huge* kudos to Rick, Yan, Binbin, Ira, and Kai (hopefully I didn't forget
anyone) for their meticulous reviews, testing and debug, clever testcases,
and help determining exactly what scenarios KVM needs to deal with in terms
of avoiding lock contention in the TDX Module.
P.S. There are few one-off TDX changes in the "vmx" pull request. I don't
expect to have a dedicated TDX pull request for most releases, I created
one this time around because of the scope of the overhaul.
The following changes since commit 6146a0f1dfae5d37442a9ddcba012add260bceb0:
Linux 6.18-rc4 (2025-11-02 11:28:02 -0800)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-tdx-6.19
for you to fetch changes up to 398180f93cf3c7bb0ee3f512b139ad01843f3ddf:
KVM: TDX: Use struct_size to simplify tdx_get_capabilities() (2025-11-13 08:30:07 -0800)
----------------------------------------------------------------
KVM TDX changes for 6.19:
- Overhaul the TDX code to address systemic races where KVM (acting on behalf
of userspace) could inadvertantly trigger lock contention in the TDX-Module,
which KVM was either working around in weird, ugly ways, or was simply
oblivious to (as proven by Yan tripping several KVM_BUG_ON()s with clever
selftests).
- Fix a bug where KVM could corrupt a vCPU's cpu_list when freeing a vCPU if
creating said vCPU failed partway through.
- Fix a few sparse warnings (bad annotation, 0 != NULL).
- Use struct_size() to simplify copying capabilities to userspace.
----------------------------------------------------------------
Dave Hansen (2):
KVM: TDX: Remove __user annotation from kernel pointer
KVM: TDX: Fix sparse warnings from using 0 for NULL
Rick Edgecombe (1):
KVM: TDX: Take MMU lock around tdh_vp_init()
Sean Christopherson (27):
KVM: Make support for kvm_arch_vcpu_async_ioctl() mandatory
KVM: Rename kvm_arch_vcpu_async_ioctl() to kvm_arch_vcpu_unlocked_ioctl()
KVM: TDX: Drop PROVE_MMU=y sanity check on to-be-populated mappings
KVM: x86/mmu: Add dedicated API to map guest_memfd pfn into TDP MMU
KVM: x86/mmu: WARN if KVM attempts to map into an invalid TDP MMU root
Revert "KVM: x86/tdp_mmu: Add a helper function to walk down the TDP MMU"
KVM: x86/mmu: Rename kvm_tdp_map_page() to kvm_tdp_page_prefault()
KVM: TDX: Return -EIO, not -EINVAL, on a KVM_BUG_ON() condition
KVM: TDX: Fold tdx_sept_drop_private_spte() into tdx_sept_remove_private_spte()
KVM: x86/mmu: Drop the return code from kvm_x86_ops.remove_external_spte()
KVM: TDX: WARN if mirror SPTE doesn't have full RWX when creating S-EPT mapping
KVM: TDX: Avoid a double-KVM_BUG_ON() in tdx_sept_zap_private_spte()
KVM: TDX: Use atomic64_dec_return() instead of a poor equivalent
KVM: TDX: Fold tdx_mem_page_record_premap_cnt() into its sole caller
KVM: TDX: ADD pages to the TD image while populating mirror EPT entries
KVM: TDX: Fold tdx_sept_zap_private_spte() into tdx_sept_remove_private_spte()
KVM: TDX: Combine KVM_BUG_ON + pr_tdx_error() into TDX_BUG_ON()
KVM: TDX: Derive error argument names from the local variable names
KVM: TDX: Assert that mmu_lock is held for write when removing S-EPT entries
KVM: TDX: Add macro to retry SEAMCALLs when forcing vCPUs out of guest
KVM: TDX: Add tdx_get_cmd() helper to get and validate sub-ioctl command
KVM: TDX: Convert INIT_MEM_REGION and INIT_VCPU to "unlocked" vCPU ioctl
KVM: TDX: Use guard() to acquire kvm->lock in tdx_vm_ioctl()
KVM: TDX: Don't copy "cmd" back to userspace for KVM_TDX_CAPABILITIES
KVM: TDX: Guard VM state transitions with "all" the locks
KVM: TDX: Bug the VM if extending the initial measurement fails
KVM: TDX: Use struct_size to simplify tdx_get_capabilities()
Thorsten Blum (1):
KVM: TDX: Check size of user's kvm_tdx_capabilities array before allocating
Yan Zhao (2):
KVM: TDX: Drop superfluous page pinning in S-EPT management
KVM: TDX: Fix list_add corruption during vcpu_load()
arch/arm64/kvm/arm.c | 6 +
arch/loongarch/kvm/Kconfig | 1 -
arch/loongarch/kvm/vcpu.c | 4 +-
arch/mips/kvm/Kconfig | 1 -
arch/mips/kvm/mips.c | 4 +-
arch/powerpc/kvm/Kconfig | 1 -
arch/powerpc/kvm/powerpc.c | 4 +-
arch/riscv/kvm/Kconfig | 1 -
arch/riscv/kvm/vcpu.c | 4 +-
arch/s390/kvm/Kconfig | 1 -
arch/s390/kvm/kvm-s390.c | 4 +-
arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 7 +-
arch/x86/kvm/mmu.h | 3 +-
arch/x86/kvm/mmu/mmu.c | 87 ++++-
arch/x86/kvm/mmu/tdp_mmu.c | 50 +--
arch/x86/kvm/vmx/main.c | 9 +
arch/x86/kvm/vmx/tdx.c | 712 ++++++++++++++++++-------------------
arch/x86/kvm/vmx/tdx.h | 8 +-
arch/x86/kvm/vmx/x86_ops.h | 1 +
arch/x86/kvm/x86.c | 13 +
include/linux/kvm_host.h | 14 +-
virt/kvm/Kconfig | 3 -
virt/kvm/kvm_main.c | 6 +-
24 files changed, 496 insertions(+), 449 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [GIT PULL] KVM: x86: VMX changes for 6.19
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
` (6 preceding siblings ...)
2025-11-26 1:44 ` [GIT PULL] KVM: x86: TDX " Sean Christopherson
@ 2025-11-26 1:44 ` Sean Christopherson
2025-11-26 8:50 ` Paolo Bonzini
7 siblings, 1 reply; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 1:44 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson
The highlight is EPTP construction cleanup that's worthwhile on its own, but
is also a step toward eliding the EPT flushes that KVM does on pCPU migration,
which are especially costly when running nested:
https://lore.kernel.org/all/aJKW9gTeyh0-pvcg@google.com
The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
for you to fetch changes up to dfd1572a64c90770a2bddfab9bbb69932217b1da:
KVM: VMX: Make loaded_vmcs_clear() static in vmx.c (2025-11-11 07:41:16 -0800)
----------------------------------------------------------------
KVM VMX changes for 6.19:
- Use the root role from kvm_mmu_page to construct EPTPs instead of the
current vCPU state, partly as worthwhile cleanup, but mostly to pave the
way for tracking per-root TLB flushes so that KVM can elide EPT flushes on
pCPU migration if KVM has flushed the root at least once.
- Add a few missing nested consistency checks.
- Rip out support for doing "early" consistency checks via hardware as the
functionality hasn't been used in years and is no longer useful in general,
and replace it with an off-by-default module param to detected missed
consistency checks (i.e. WARN if hardware finds a check that KVM does not).
- Fix a currently-benign bug where KVM would drop the guest's SPEC_CTRL[63:32]
on VM-Enter.
- Misc cleanups.
----------------------------------------------------------------
Dmytro Maluka (1):
KVM: VMX: Remove stale vmx_set_dr6() declaration
Sean Christopherson (10):
KVM: VMX: Hoist construct_eptp() "up" in vmx.c
KVM: nVMX: Hardcode dummy EPTP used for early nested consistency checks
KVM: x86/mmu: Move "dummy root" helpers to spte.h
KVM: VMX: Use kvm_mmu_page role to construct EPTP, not current vCPU state
KVM: nVMX: Add consistency check for TPR_THRESHOLD[31:4]!=0 without VID
KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0
KVM: nVMX: Stuff vmcs02.TSC_MULTIPLIER early on for nested early checks
KVM: nVMX: Remove support for "early" consistency checks via hardware
KVM: nVMX: Add an off-by-default module param to WARN on missed consistency checks
KVM: VMX: Make loaded_vmcs_clear() static in vmx.c
Thorsten Blum (1):
KVM: TDX: Replace kmalloc + copy_from_user with memdup_user in tdx_td_init()
Uros Bizjak (1):
KVM: VMX: Ensure guest's SPEC_CTRL[63:32] is loaded on VM-Enter
Xin Li (1):
KVM: nVMX: Use vcpu instead of vmx->vcpu when vcpu is available
arch/x86/kvm/mmu/mmu_internal.h | 10 ---
arch/x86/kvm/mmu/spte.h | 10 +++
arch/x86/kvm/vmx/nested.c | 173 ++++++++++++++--------------------------
arch/x86/kvm/vmx/tdx.c | 30 +++----
arch/x86/kvm/vmx/vmenter.S | 20 +++--
arch/x86/kvm/vmx/vmx.c | 59 +++++++++-----
arch/x86/kvm/vmx/vmx.h | 2 -
arch/x86/kvm/vmx/x86_ops.h | 1 -
8 files changed, 135 insertions(+), 170 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: guest_memfd: NUMA support and other changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: guest_memfd: NUMA support and other " Sean Christopherson
@ 2025-11-26 8:33 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:33 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Please pull NUMA mempolicy guest_memfd support, along with a handful of
> guest_memfd cleanups and some tangentially related additions to KVM selftests
> infrastructure.
>
> This will conflict with kvm/master due to commit ae431059e75d ("KVM:
> guest_memfd: Remove bindings on memslot deletion when gmem is dying"). The
> resolution I've been using for linux-next is below.
Pulled, thanks.
Paolo
> --
> diff --cc virt/kvm/guest_memfd.c
> index ffadc5ee8e04,427c0acee9d7..fdaea3422c30
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@@ -623,53 -708,31 +708,49 @@@ err
> return r;
> }
>
> - static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct kvm_gmem *gmem)
> -void kvm_gmem_unbind(struct kvm_memory_slot *slot)
> ++static void __kvm_gmem_unbind(struct kvm_memory_slot *slot, struct gmem_file *f)
> {
> unsigned long start = slot->gmem.pgoff;
> unsigned long end = start + slot->npages;
> - struct gmem_file *f;
>
> - xa_store_range(&gmem->bindings, start, end - 1, NULL, GFP_KERNEL);
> - /*
> - * Nothing to do if the underlying file was already closed (or is being
> - * closed right now), kvm_gmem_release() invalidates all bindings.
> - */
> - CLASS(gmem_get_file, file)(slot);
> - if (!file)
> - return;
> -
> - f = file->private_data;
> -
> - filemap_invalidate_lock(file->f_mapping);
> + xa_store_range(&f->bindings, start, end - 1, NULL, GFP_KERNEL);
>
> /*
> * synchronize_srcu(&kvm->srcu) ensured that kvm_gmem_get_pfn()
> * cannot see this memslot.
> */
> WRITE_ONCE(slot->gmem.file, NULL);
> +}
> +
> +void kvm_gmem_unbind(struct kvm_memory_slot *slot)
> +{
> - struct file *file;
> -
> + /*
> + * Nothing to do if the underlying file was _already_ closed, as
> + * kvm_gmem_release() invalidates and nullifies all bindings.
> + */
> + if (!slot->gmem.file)
> + return;
> +
> - file = kvm_gmem_get_file(slot);
> ++ CLASS(gmem_get_file, file)(slot);
> +
> + /*
> + * However, if the file is _being_ closed, then the bindings need to be
> + * removed as kvm_gmem_release() might not run until after the memslot
> + * is freed. Note, modifying the bindings is safe even though the file
> + * is dying as kvm_gmem_release() nullifies slot->gmem.file under
> + * slots_lock, and only puts its reference to KVM after destroying all
> + * bindings. I.e. reaching this point means kvm_gmem_release() hasn't
> + * yet destroyed the bindings or freed the gmem_file, and can't do so
> + * until the caller drops slots_lock.
> + */
> + if (!file) {
> + __kvm_gmem_unbind(slot, slot->gmem.file->private_data);
> + return;
> + }
> +
> + filemap_invalidate_lock(file->f_mapping);
> + __kvm_gmem_unbind(slot, file->private_data);
> filemap_invalidate_unlock(file->f_mapping);
> -
> - fput(file);
> }
>
> /* Returns a locked folio on success. */
>
>
> The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
>
> Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-gmem-6.19
>
> for you to fetch changes up to 83e0e12219a402bf7b8fdef067e51f945a92fd26:
>
> KVM: selftests: Rename "guest_paddr" variables to "gpa" (2025-11-03 12:54:21 -0800)
>
> ----------------------------------------------------------------
> KVM guest_memfd changes for 6.19:
>
> - Add NUMA mempolicy support for guest_memfd, and clean up a variety of
> rough edges in guest_memfd along the way.
>
> - Define a CLASS to automatically handle get+put when grabbing a guest_memfd
> from a memslot to make it harder to leak references.
>
> - Enhance KVM selftests to make it easer to develop and debug selftests like
> those added for guest_memfd NUMA support, e.g. where test and/or KVM bugs
> often result in hard-to-debug SIGBUS errors.
>
> - Misc cleanups.
>
> ----------------------------------------------------------------
> Ackerley Tng (1):
> KVM: guest_memfd: Use guest mem inodes instead of anonymous inodes
>
> Matthew Wilcox (2):
> mm/filemap: Add NUMA mempolicy support to filemap_alloc_folio()
> mm/filemap: Extend __filemap_get_folio() to support NUMA memory policies
>
> Pedro Demarchi Gomes (1):
> KVM: guest_memfd: use folio_nr_pages() instead of shift operation
>
> Sean Christopherson (10):
> KVM: guest_memfd: Drop a superfluous local var in kvm_gmem_fault_user_mapping()
> KVM: guest_memfd: Rename "struct kvm_gmem" to "struct gmem_file"
> KVM: guest_memfd: Add macro to iterate over gmem_files for a mapping/inode
> KVM: selftests: Define wrappers for common syscalls to assert success
> KVM: selftests: Report stacktraces SIGBUS, SIGSEGV, SIGILL, and SIGFPE by default
> KVM: selftests: Add additional equivalents to libnuma APIs in KVM's numaif.h
> KVM: selftests: Use proper uAPI headers to pick up mempolicy.h definitions
> KVM: guest_memfd: Add gmem_inode.flags field instead of using i_private
> KVM: guest_memfd: Define a CLASS to get+put guest_memfd file from a memslot
> KVM: selftests: Rename "guest_paddr" variables to "gpa"
>
> Shivank Garg (7):
> mm/mempolicy: Export memory policy symbols
> KVM: guest_memfd: move kvm_gmem_get_index() and use in kvm_gmem_prepare_folio()
> KVM: guest_memfd: remove redundant gmem variable initialization
> KVM: guest_memfd: Add slab-allocated inode cache
> KVM: guest_memfd: Enforce NUMA mempolicy using shared policy
> KVM: selftests: Add helpers to probe for NUMA support, and multi-node systems
> KVM: selftests: Add guest_memfd tests for mmap and NUMA policy support
>
> fs/btrfs/compression.c | 4 +-
> fs/btrfs/verity.c | 2 +-
> fs/erofs/zdata.c | 2 +-
> fs/f2fs/compress.c | 2 +-
> include/linux/pagemap.h | 18 +++--
> include/uapi/linux/magic.h | 1 +
> mm/filemap.c | 23 ++++---
> mm/mempolicy.c | 6 ++
> mm/readahead.c | 2 +-
> tools/testing/selftests/kvm/arm64/vgic_irq.c | 2 +-
> tools/testing/selftests/kvm/guest_memfd_test.c | 98 +++++++++++++++++++++++++++
> tools/testing/selftests/kvm/include/kvm_syscalls.h | 81 ++++++++++++++++++++++
> tools/testing/selftests/kvm/include/kvm_util.h | 39 ++---------
> tools/testing/selftests/kvm/include/numaif.h | 110 ++++++++++++++++++------------
> tools/testing/selftests/kvm/kvm_binary_stats_test.c | 4 +-
> tools/testing/selftests/kvm/lib/kvm_util.c | 101 +++++++++++++++-------------
> tools/testing/selftests/kvm/x86/private_mem_conversions_test.c | 9 +--
> tools/testing/selftests/kvm/x86/xapic_ipi_test.c | 5 +-
> virt/kvm/guest_memfd.c | 374 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
> virt/kvm/kvm_main.c | 7 +-
> virt/kvm/kvm_mm.h | 9 +--
> 21 files changed, 646 insertions(+), 253 deletions(-)
> create mode 100644 tools/testing/selftests/kvm/include/kvm_syscalls.h
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: SVM changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
@ 2025-11-26 8:48 ` Paolo Bonzini
2025-11-26 13:41 ` Sean Christopherson
0 siblings, 1 reply; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:48 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> A handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new
> uAPI to advertise SNP policy bits to userspace.
>
> Side topic, this pull request is finally proof that I don't just merge my own
> stuff :-D
What do you mean? Is there anything you want me to review?
Paolo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: Misc changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
@ 2025-11-26 8:49 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:49 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> The bulk of the vendor agnostic x86 changes for 6.19. There are multiple
> noteworthy changes, though nothing stands out as being _that_ much more
> interesting than the rest.
>
> The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
>
> Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.19
>
> for you to fetch changes up to c09816f2afce0f89f176c4bc58dc57ec9f204998:
>
> KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat() (2025-11-20 07:26:35 -0800)
Pulled, thanks.
Paolo
> ----------------------------------------------------------------
> KVM x86 misc changes for 6.19:
>
> - Fix an async #PF bug where KVM would clear the completion queue when the
> guest transitioned in and out of paging mode, e.g. when handling an SMI and
> then returning to paged mode via RSM.
>
> - Fix a bug where TDX would effectively corrupt user-return MSR values if the
> TDX Module rejects VP.ENTER and thus doesn't clobber host MSRs as expected.
>
> - Leave the user-return notifier used to restore MSRs registered when
> disabling virtualization, and instead pin kvm.ko. Restoring host MSRs via
> IPI callback is either pointless (clean reboot) or dangerous (forced reboot)
> since KVM has no idea what code it's interrupting.
>
> - Use the checked version of {get,put}_user(), as Linus wants to kill them
> off, and they're measurably faster on modern CPUs due to the unchecked
> versions containing an LFENCE.
>
> - Fix a long-lurking bug where KVM's lack of catch-up logic for periodic APIC
> timers can result in a hard lockup in the host.
>
> - Revert the periodic kvmclock sync logic now that KVM doesn't use a
> clocksource that's subject to NPT corrections.
>
> - Clean up KVM's handling of MMIO Stale Data and L1TF, and bury the latter
> behind CONFIG_CPU_MITIGATIONS.
>
> - Context switch XCR0, XSS, and PKRU outside of the entry/exit fastpath as
> the only reason they were handled in the faspath was to paper of a bug in
> the core #MC code that has long since been fixed.
>
> - Add emulator support for AVX MOV instructions to play nice with emulated
> devices whose PCI BARs guest drivers like to access with large multi-byte
> instructions.
>
> ----------------------------------------------------------------
> Binbin Wu (1):
> KVM: x86: Add a helper to dedup loading guest/host XCR0 and XSS
>
> Brendan Jackman (1):
> KVM: x86: Unify L1TF flushing under per-CPU variable
>
> Chang S. Bae (1):
> KVM: x86: Refactor REX prefix handling in instruction emulation
>
> Chao Gao (1):
> KVM: x86: Allocate/free user_return_msrs at kvm.ko (un)loading time
>
> Hou Wenlong (1):
> KVM: x86: Don't disable IRQs when unregistering user-return notifier
>
> Lei Chen (3):
> Revert "x86: kvm: introduce periodic global clock updates"
> Revert "x86: kvm: rate-limit global clock updates"
> KVM: x86: remove comment about ntp correction sync for
>
> Maxim Levitsky (2):
> KVM: x86: Fix a semi theoretical bug in kvm_arch_async_page_present_queued()
> KVM: x86: Don't clear async #PF queue when CR0.PG is disabled (e.g. on #SMI)
>
> Paolo Bonzini (9):
> KVM: x86: Add support for emulating MOVNTDQA
> KVM: x86: Move Src2Shift up one bit (use bits 36:32 for Src2 in the emulator)
> KVM: x86: Improve formatting of the emulator's flags table
> KVM: x86: Move op_prefix to struct x86_emulate_ctxt (from x86_decode_insn())
> KVM: x86: Share emulator's common register decoding code
> KVM: x86: Add x86_emulate_ops.get_xcr() callback
> KVM: x86: Add AVX support to the emulator's register fetch and writeback
> KVM: x86: Add emulator support for decoding VEX prefixes
> KVM: x86: Enable support for emulating AVX MOV instructions
>
> Pawan Gupta (1):
> x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well
>
> Sean Christopherson (18):
> KVM: x86: Add a helper to dedup reporting of unhandled VM-Exits
> KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Module
> KVM: x86: WARN if user-return MSR notifier is registered on exit
> KVM: x86: Leave user-return notifier registered on reboot/shutdown
> KVM: x86: Use "checked" versions of get_user() and put_user()
> KVM: x86: WARN if hrtimer callback for periodic APIC timer fires with period=0
> KVM: x86: Grab lapic_timer in a local variable to cleanup periodic code
> KVM: VMX: Use on-stack copy of @flags in __vmx_vcpu_run()
> x86/bugs: Decouple ALTERNATIVE usage from VERW macro definition
> x86/bugs: Use an x86 feature to track the MMIO Stale Data mitigation
> KVM: VMX: Handle MMIO Stale Data in VM-Enter assembly via ALTERNATIVES_2
> x86/bugs: KVM: Move VM_CLEAR_CPU_BUFFERS into SVM as SVM_CLEAR_CPU_BUFFERS
> KVM: VMX: Bundle all L1 data cache flush mitigation code together
> KVM: VMX: Disable L1TF L1 data cache flush if CONFIG_CPU_MITIGATIONS=n
> KVM: SVM: Handle #MCs in guest outside of fastpath
> KVM: VMX: Handle #MCs on VM-Enter/TD-Enter outside of the fastpath
> KVM: x86: Load guest/host XCR0 and XSS outside of the fastpath run loop
> KVM: x86: Load guest/host PKRU outside of the fastpath run loop
>
> Yue Haibing (1):
> KVM: x86: Remove unused declaration kvm_mmu_may_ignore_guest_pat()
>
> fuqiang wang (2):
> KVM: x86: Explicitly set new periodic hrtimer expiration in apic_timer_fn()
> KVM: x86: Fix VM hard lockup after prolonged inactivity with periodic HV timer
>
> arch/x86/include/asm/cpufeatures.h | 5 ++
> arch/x86/include/asm/hardirq.h | 4 +-
> arch/x86/include/asm/kvm_host.h | 7 +--
> arch/x86/include/asm/nospec-branch.h | 30 ++++++------
> arch/x86/kernel/cpu/bugs.c | 22 ++++-----
> arch/x86/kvm/emulate.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------
> arch/x86/kvm/fpu.h | 66 +++++++++++++++++++++++++++
> arch/x86/kvm/hyperv.c | 2 +-
> arch/x86/kvm/kvm_emulate.h | 20 ++++++--
> arch/x86/kvm/lapic.c | 44 ++++++++++++------
> arch/x86/kvm/mmu.h | 2 -
> arch/x86/kvm/mmu/mmu.c | 2 +-
> arch/x86/kvm/mmu/paging_tmpl.h | 2 +-
> arch/x86/kvm/mmu/spte.c | 2 +-
> arch/x86/kvm/svm/svm.c | 27 ++++-------
> arch/x86/kvm/svm/vmenter.S | 6 ++-
> arch/x86/kvm/vmx/nested.c | 2 +-
> arch/x86/kvm/vmx/run_flags.h | 10 ++--
> arch/x86/kvm/vmx/tdx.c | 65 ++++++++++----------------
> arch/x86/kvm/vmx/tdx.h | 1 -
> arch/x86/kvm/vmx/vmenter.S | 29 +++++++-----
> arch/x86/kvm/vmx/vmx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------
> arch/x86/kvm/x86.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------
> arch/x86/kvm/x86.h | 16 ++++++-
> 24 files changed, 706 insertions(+), 500 deletions(-)
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: VMX changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
@ 2025-11-26 8:50 ` Paolo Bonzini
2025-11-26 13:42 ` Sean Christopherson
0 siblings, 1 reply; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:50 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> The highlight is EPTP construction cleanup that's worthwhile on its own, but
> is also a step toward eliding the EPT flushes that KVM does on pCPU migration,
> which are especially costly when running nested:
>
> https://lore.kernel.org/all/aJKW9gTeyh0-pvcg@google.com
>
> The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
>
> Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
>
> for you to fetch changes up to dfd1572a64c90770a2bddfab9bbb69932217b1da:
>
> KVM: VMX: Make loaded_vmcs_clear() static in vmx.c (2025-11-11 07:41:16 -0800)
Pulled; there was another minor conflict due to the introduction of
kvm_request_l1tf_flush_l1d().
Paolo
> ----------------------------------------------------------------
> KVM VMX changes for 6.19:
>
> - Use the root role from kvm_mmu_page to construct EPTPs instead of the
> current vCPU state, partly as worthwhile cleanup, but mostly to pave the
> way for tracking per-root TLB flushes so that KVM can elide EPT flushes on
> pCPU migration if KVM has flushed the root at least once.
>
> - Add a few missing nested consistency checks.
>
> - Rip out support for doing "early" consistency checks via hardware as the
> functionality hasn't been used in years and is no longer useful in general,
> and replace it with an off-by-default module param to detected missed
> consistency checks (i.e. WARN if hardware finds a check that KVM does not).
>
> - Fix a currently-benign bug where KVM would drop the guest's SPEC_CTRL[63:32]
> on VM-Enter.
>
> - Misc cleanups.
>
> ----------------------------------------------------------------
> Dmytro Maluka (1):
> KVM: VMX: Remove stale vmx_set_dr6() declaration
>
> Sean Christopherson (10):
> KVM: VMX: Hoist construct_eptp() "up" in vmx.c
> KVM: nVMX: Hardcode dummy EPTP used for early nested consistency checks
> KVM: x86/mmu: Move "dummy root" helpers to spte.h
> KVM: VMX: Use kvm_mmu_page role to construct EPTP, not current vCPU state
> KVM: nVMX: Add consistency check for TPR_THRESHOLD[31:4]!=0 without VID
> KVM: nVMX: Add consistency check for TSC_MULTIPLIER=0
> KVM: nVMX: Stuff vmcs02.TSC_MULTIPLIER early on for nested early checks
> KVM: nVMX: Remove support for "early" consistency checks via hardware
> KVM: nVMX: Add an off-by-default module param to WARN on missed consistency checks
> KVM: VMX: Make loaded_vmcs_clear() static in vmx.c
>
> Thorsten Blum (1):
> KVM: TDX: Replace kmalloc + copy_from_user with memdup_user in tdx_td_init()
>
> Uros Bizjak (1):
> KVM: VMX: Ensure guest's SPEC_CTRL[63:32] is loaded on VM-Enter
>
> Xin Li (1):
> KVM: nVMX: Use vcpu instead of vmx->vcpu when vcpu is available
>
> arch/x86/kvm/mmu/mmu_internal.h | 10 ---
> arch/x86/kvm/mmu/spte.h | 10 +++
> arch/x86/kvm/vmx/nested.c | 173 ++++++++++++++--------------------------
> arch/x86/kvm/vmx/tdx.c | 30 +++----
> arch/x86/kvm/vmx/vmenter.S | 20 +++--
> arch/x86/kvm/vmx/vmx.c | 59 +++++++++-----
> arch/x86/kvm/vmx/vmx.h | 2 -
> arch/x86/kvm/vmx/x86_ops.h | 1 -
> 8 files changed, 135 insertions(+), 170 deletions(-)
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: MMU changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
@ 2025-11-26 8:50 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:50 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> An optimization for enable_mmio_caching=0 and a minor cleanup.
>
> The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
>
> Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.19
>
> for you to fetch changes up to 6422060aa9c7bb2039b23948db5d4e8194036657:
>
> KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range() (2025-11-04 09:51:06 -0800)
Pulled, thanks.
Paolo
> ----------------------------------------------------------------
> KVM x86 MMU changes for 6.19:
>
> - Skip the costly "zap all SPTEs" on an MMIO generation wrap if MMIO SPTE
> caching is disabled, as there can't be any relevant SPTEs to zap.
>
> - Relocate a misplace export.
>
> ----------------------------------------------------------------
> Dmytro Maluka (1):
> KVM: x86/mmu: Skip MMIO SPTE invalidation if enable_mmio_caching=0
>
> Kai Huang (1):
> KVM: x86/mmu: Move the misplaced export of kvm_zap_gfn_range()
>
> arch/x86/kvm/mmu/mmu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: Selftests changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
@ 2025-11-26 8:51 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:51 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> The highlights are Jim's LA57 nested VMX test, and Yosry's many changes to
> extend nested VMX tests to also cover nested SVM.
>
> The following changes since commit 211ddde0823f1442e4ad052a2f30f050145ccada:
>
> Linux 6.18-rc2 (2025-10-19 15:19:16 -1000)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.19
>
> for you to fetch changes up to d2e50389ab44acfa05e72604d701a70b234f9938:
>
> KVM: selftests: Make sure vm->vpages_mapped is always up-to-date (2025-11-21 10:17:05 -0800)
Pulled, thanks.
Paolo
> ----------------------------------------------------------------
> KVM selftests changes for 6.19:
>
> - Fix a math goof in mmu_stress_test when running on a single-CPU system/VM.
>
> - Forcefully override ARCH from x86_64 to x86 to play nice with specifying
> ARCH=x86_64 on the command line.
>
> - Extend a bunch of nested VMX to validate nested SVM as well.
>
> - Add support for LA57 in the core VM_MODE_xxx macro, and add a test to
> verify KVM can save/restore nested VMX state when L1 is using 5-level
> paging, but L2 is not.
>
> - Clean up the guest paging code in anticipation of sharing the core logic for
> nested EPT and nested NPT.
>
> ----------------------------------------------------------------
> Brendan Jackman (1):
> KVM: selftests: Don't fall over in mmu_stress_test when only one CPU is present
>
> Jim Mattson (4):
> KVM: selftests: Use a loop to create guest page tables
> KVM: selftests: Use a loop to walk guest page tables
> KVM: selftests: Change VM_MODE_PXXV48_4K to VM_MODE_PXXVYY_4K
> KVM: selftests: Add a VMX test for LA57 nested state
>
> Sean Christopherson (2):
> KVM: selftests: Forcefully override ARCH from x86_64 to x86
> KVM: selftests: Use "gpa" and "gva" for local variable names in pre-fault test
>
> Yosry Ahmed (9):
> KVM: selftests: Extend vmx_close_while_nested_test to cover SVM
> KVM: selftests: Extend vmx_nested_tsc_scaling_test to cover SVM
> KVM: selftests: Move nested invalid CR3 check to its own test
> KVM: selftests: Extend nested_invalid_cr3_test to cover SVM
> KVM: selftests: Extend vmx_tsc_adjust_test to cover SVM
> KVM: selftests: Stop hardcoding PAGE_SIZE in x86 selftests
> KVM: selftests: Remove the unused argument to prepare_eptp()
> KVM: selftests: Stop using __virt_pg_map() directly in tests
> KVM: selftests: Make sure vm->vpages_mapped is always up-to-date
>
> tools/testing/selftests/kvm/Makefile | 2 +-
> tools/testing/selftests/kvm/Makefile.kvm | 8 +-
> tools/testing/selftests/kvm/include/kvm_util.h | 5 +-
> .../testing/selftests/kvm/include/x86/processor.h | 2 +-
> tools/testing/selftests/kvm/include/x86/vmx.h | 3 +-
> tools/testing/selftests/kvm/lib/arm64/processor.c | 2 +-
> tools/testing/selftests/kvm/lib/kvm_util.c | 33 +++---
> tools/testing/selftests/kvm/lib/x86/memstress.c | 2 +-
> tools/testing/selftests/kvm/lib/x86/processor.c | 84 ++++++-------
> tools/testing/selftests/kvm/lib/x86/vmx.c | 9 +-
> tools/testing/selftests/kvm/mmu_stress_test.c | 10 +-
> .../testing/selftests/kvm/pre_fault_memory_test.c | 32 +++--
> tools/testing/selftests/kvm/x86/hyperv_features.c | 2 +-
> tools/testing/selftests/kvm/x86/hyperv_ipi.c | 18 +--
> tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c | 2 +-
> ...while_nested_test.c => nested_close_kvm_test.c} | 42 +++++--
> .../selftests/kvm/x86/nested_invalid_cr3_test.c | 116 ++++++++++++++++++
> ..._tsc_adjust_test.c => nested_tsc_adjust_test.c} | 73 +++++++-----
> ...sc_scaling_test.c => nested_tsc_scaling_test.c} | 48 +++++++-
> tools/testing/selftests/kvm/x86/sev_smoke_test.c | 2 +-
> tools/testing/selftests/kvm/x86/state_test.c | 2 +-
> .../testing/selftests/kvm/x86/userspace_io_test.c | 2 +-
> .../testing/selftests/kvm/x86/vmx_dirty_log_test.c | 12 +-
> .../selftests/kvm/x86/vmx_nested_la57_state_test.c | 132 +++++++++++++++++++++
> 24 files changed, 479 insertions(+), 164 deletions(-)
> rename tools/testing/selftests/kvm/x86/{vmx_close_while_nested_test.c => nested_close_kvm_test.c} (64%)
> create mode 100644 tools/testing/selftests/kvm/x86/nested_invalid_cr3_test.c
> rename tools/testing/selftests/kvm/x86/{vmx_tsc_adjust_test.c => nested_tsc_adjust_test.c} (61%)
> rename tools/testing/selftests/kvm/x86/{vmx_nested_tsc_scaling_test.c => nested_tsc_scaling_test.c} (83%)
> create mode 100644 tools/testing/selftests/kvm/x86/vmx_nested_la57_state_test.c
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: TDX changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: x86: TDX " Sean Christopherson
@ 2025-11-26 8:51 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:51 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Please pull a large overhaul of lock-related TDX code (particularly in the
> S-EPT and mirror SPTE code), along with a few fixes and cleanups.
>
> *Huge* kudos to Rick, Yan, Binbin, Ira, and Kai (hopefully I didn't forget
> anyone) for their meticulous reviews, testing and debug, clever testcases,
> and help determining exactly what scenarios KVM needs to deal with in terms
> of avoiding lock contention in the TDX Module.
>
> P.S. There are few one-off TDX changes in the "vmx" pull request. I don't
> expect to have a dedicated TDX pull request for most releases, I created
> one this time around because of the scope of the overhaul.
>
> The following changes since commit 6146a0f1dfae5d37442a9ddcba012add260bceb0:
>
> Linux 6.18-rc4 (2025-11-02 11:28:02 -0800)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-tdx-6.19
>
> for you to fetch changes up to 398180f93cf3c7bb0ee3f512b139ad01843f3ddf:
>
> KVM: TDX: Use struct_size to simplify tdx_get_capabilities() (2025-11-13 08:30:07 -0800)
Pulled, thanks.
Paolo
> ----------------------------------------------------------------
> KVM TDX changes for 6.19:
>
> - Overhaul the TDX code to address systemic races where KVM (acting on behalf
> of userspace) could inadvertantly trigger lock contention in the TDX-Module,
> which KVM was either working around in weird, ugly ways, or was simply
> oblivious to (as proven by Yan tripping several KVM_BUG_ON()s with clever
> selftests).
>
> - Fix a bug where KVM could corrupt a vCPU's cpu_list when freeing a vCPU if
> creating said vCPU failed partway through.
>
> - Fix a few sparse warnings (bad annotation, 0 != NULL).
>
> - Use struct_size() to simplify copying capabilities to userspace.
>
> ----------------------------------------------------------------
> Dave Hansen (2):
> KVM: TDX: Remove __user annotation from kernel pointer
> KVM: TDX: Fix sparse warnings from using 0 for NULL
>
> Rick Edgecombe (1):
> KVM: TDX: Take MMU lock around tdh_vp_init()
>
> Sean Christopherson (27):
> KVM: Make support for kvm_arch_vcpu_async_ioctl() mandatory
> KVM: Rename kvm_arch_vcpu_async_ioctl() to kvm_arch_vcpu_unlocked_ioctl()
> KVM: TDX: Drop PROVE_MMU=y sanity check on to-be-populated mappings
> KVM: x86/mmu: Add dedicated API to map guest_memfd pfn into TDP MMU
> KVM: x86/mmu: WARN if KVM attempts to map into an invalid TDP MMU root
> Revert "KVM: x86/tdp_mmu: Add a helper function to walk down the TDP MMU"
> KVM: x86/mmu: Rename kvm_tdp_map_page() to kvm_tdp_page_prefault()
> KVM: TDX: Return -EIO, not -EINVAL, on a KVM_BUG_ON() condition
> KVM: TDX: Fold tdx_sept_drop_private_spte() into tdx_sept_remove_private_spte()
> KVM: x86/mmu: Drop the return code from kvm_x86_ops.remove_external_spte()
> KVM: TDX: WARN if mirror SPTE doesn't have full RWX when creating S-EPT mapping
> KVM: TDX: Avoid a double-KVM_BUG_ON() in tdx_sept_zap_private_spte()
> KVM: TDX: Use atomic64_dec_return() instead of a poor equivalent
> KVM: TDX: Fold tdx_mem_page_record_premap_cnt() into its sole caller
> KVM: TDX: ADD pages to the TD image while populating mirror EPT entries
> KVM: TDX: Fold tdx_sept_zap_private_spte() into tdx_sept_remove_private_spte()
> KVM: TDX: Combine KVM_BUG_ON + pr_tdx_error() into TDX_BUG_ON()
> KVM: TDX: Derive error argument names from the local variable names
> KVM: TDX: Assert that mmu_lock is held for write when removing S-EPT entries
> KVM: TDX: Add macro to retry SEAMCALLs when forcing vCPUs out of guest
> KVM: TDX: Add tdx_get_cmd() helper to get and validate sub-ioctl command
> KVM: TDX: Convert INIT_MEM_REGION and INIT_VCPU to "unlocked" vCPU ioctl
> KVM: TDX: Use guard() to acquire kvm->lock in tdx_vm_ioctl()
> KVM: TDX: Don't copy "cmd" back to userspace for KVM_TDX_CAPABILITIES
> KVM: TDX: Guard VM state transitions with "all" the locks
> KVM: TDX: Bug the VM if extending the initial measurement fails
> KVM: TDX: Use struct_size to simplify tdx_get_capabilities()
>
> Thorsten Blum (1):
> KVM: TDX: Check size of user's kvm_tdx_capabilities array before allocating
>
> Yan Zhao (2):
> KVM: TDX: Drop superfluous page pinning in S-EPT management
> KVM: TDX: Fix list_add corruption during vcpu_load()
>
> arch/arm64/kvm/arm.c | 6 +
> arch/loongarch/kvm/Kconfig | 1 -
> arch/loongarch/kvm/vcpu.c | 4 +-
> arch/mips/kvm/Kconfig | 1 -
> arch/mips/kvm/mips.c | 4 +-
> arch/powerpc/kvm/Kconfig | 1 -
> arch/powerpc/kvm/powerpc.c | 4 +-
> arch/riscv/kvm/Kconfig | 1 -
> arch/riscv/kvm/vcpu.c | 4 +-
> arch/s390/kvm/Kconfig | 1 -
> arch/s390/kvm/kvm-s390.c | 4 +-
> arch/x86/include/asm/kvm-x86-ops.h | 1 +
> arch/x86/include/asm/kvm_host.h | 7 +-
> arch/x86/kvm/mmu.h | 3 +-
> arch/x86/kvm/mmu/mmu.c | 87 ++++-
> arch/x86/kvm/mmu/tdp_mmu.c | 50 +--
> arch/x86/kvm/vmx/main.c | 9 +
> arch/x86/kvm/vmx/tdx.c | 712 ++++++++++++++++++-------------------
> arch/x86/kvm/vmx/tdx.h | 8 +-
> arch/x86/kvm/vmx/x86_ops.h | 1 +
> arch/x86/kvm/x86.c | 13 +
> include/linux/kvm_host.h | 14 +-
> virt/kvm/Kconfig | 3 -
> virt/kvm/kvm_main.c | 6 +-
> 24 files changed, 496 insertions(+), 449 deletions(-)
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: Generic changes for 6.19
2025-11-26 1:44 ` [GIT PULL] KVM: Generic changes for 6.19 Sean Christopherson
@ 2025-11-26 8:59 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2025-11-26 8:59 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
>
> A tweak to account for an upcoming API change, and a doc fix.
>
> The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
>
> Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
>
> are available in the Git repository at:
>
> https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.19
>
> for you to fetch changes up to 04fd067b770d19fee39759d994c4bfa2fb332d9f:
>
> KVM: Fix VM exit code for full dirty ring in API documentation (2025-10-14 15:19:05 -0700)
This could have been even 6.18 material, so I pulled it first just in
case. Though it's pretty late now so probably not.
Thanks,
Paolo
> ----------------------------------------------------------------
> KVM generic changes for 6.19:
>
> - Use the recently-added WQ_PERCPU when creating the per-CPU workqueue for
> irqfd cleanup.
>
> - Fix a goof in the dirty ring documentation.
>
> ----------------------------------------------------------------
> Leonardo Bras (1):
> KVM: Fix VM exit code for full dirty ring in API documentation
>
> Marco Crivellari (1):
> KVM: Explicitly allocate/setup irqfd cleanup as per-CPU workqueue
>
> Documentation/virt/kvm/api.rst | 2 +-
> virt/kvm/eventfd.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: SVM changes for 6.19
2025-11-26 8:48 ` Paolo Bonzini
@ 2025-11-26 13:41 ` Sean Christopherson
0 siblings, 0 replies; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 13:41 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025, Paolo Bonzini wrote:
> On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
> >
> > A handful of lowish priority nSVM fixes, AVIC support for 4k vCPUs, and new
> > uAPI to advertise SNP policy bits to userspace.
> >
> > Side topic, this pull request is finally proof that I don't just merge my own
> > stuff :-D
>
> What do you mean? Is there anything you want me to review?
Oh, it was purely a joke. I don't have any commits in this particular pull request,
and that caught my eye when looking at the shortlog.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [GIT PULL] KVM: x86: VMX changes for 6.19
2025-11-26 8:50 ` Paolo Bonzini
@ 2025-11-26 13:42 ` Sean Christopherson
0 siblings, 0 replies; 19+ messages in thread
From: Sean Christopherson @ 2025-11-26 13:42 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, linux-kernel
On Wed, Nov 26, 2025, Paolo Bonzini wrote:
> On Wed, Nov 26, 2025 at 2:45 AM Sean Christopherson <seanjc@google.com> wrote:
> >
> > The highlight is EPTP construction cleanup that's worthwhile on its own, but
> > is also a step toward eliding the EPT flushes that KVM does on pCPU migration,
> > which are especially costly when running nested:
> >
> > https://lore.kernel.org/all/aJKW9gTeyh0-pvcg@google.com
> >
> > The following changes since commit 3a8660878839faadb4f1a6dd72c3179c1df56787:
> >
> > Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)
> >
> > are available in the Git repository at:
> >
> > https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.19
> >
> > for you to fetch changes up to dfd1572a64c90770a2bddfab9bbb69932217b1da:
> >
> > KVM: VMX: Make loaded_vmcs_clear() static in vmx.c (2025-11-11 07:41:16 -0800)
>
> Pulled; there was another minor conflict due to the introduction of
> kvm_request_l1tf_flush_l1d().
Shoot, sorry, forgot about that one (obviously).
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-11-26 13:42 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 1:44 [GIT PULL] KVM: x86 pull requests 6.19 Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: Generic changes for 6.19 Sean Christopherson
2025-11-26 8:59 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: guest_memfd: NUMA support and other " Sean Christopherson
2025-11-26 8:33 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
2025-11-26 8:49 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2025-11-26 8:50 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
2025-11-26 8:51 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2025-11-26 8:48 ` Paolo Bonzini
2025-11-26 13:41 ` Sean Christopherson
2025-11-26 1:44 ` [GIT PULL] KVM: x86: TDX " Sean Christopherson
2025-11-26 8:51 ` Paolo Bonzini
2025-11-26 1:44 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
2025-11-26 8:50 ` Paolo Bonzini
2025-11-26 13:42 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).