[GIT PULL] KVM: x86: MMU changes for 7.4

From: Sean Christopherson

Date: Fri Oct 16 2026 - 00:46:24 EST


The following changes since commit d4b7fb647204f0c81dfeae2d1a708e4d858e0c94:

Merge branch 'kvm-xen-longmode' into HEAD (2026-09-04 17:35:03 +0200)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-7.4

for you to fetch changes up to 31adfe155db60a58b61e5b3d472cf85336ff3daf:

KVM: x86/mmu: Fix NX page unaccounting for TDP MMU pages (2026-09-29 06:29:11 -0700)

----------------------------------------------------------------
KVM x86 MMU changes for 7.4

- Grab KVM's SRCU "lock" in kvm_zap_gfn_range() to fix a recurring bug where
callers fail to do so.

- Fix a variety of issues in the pre-fault code that are mostly benign in the
current code base, but will show up in big ways if/when the pre-faulting
logic is used to implementing prefetch-on-fault for the TDP MMU.

- Guard rmaps with mmu_lock for PREEMPT_RT=y kernels to fix a longstanding
issue introducing by "lockless aging" where KVM would take its effective
raw bit-spinlock with preemption enabled (because mmu_lock gets turned into
a sleepable lock).

- Prepare a memory_fault exit (paired with -EFAULT) when KVM hits an error
PFN, e.g. so that userspace can resolve transient issues instead of killing
the guest. Convert a variety of WARN()+EFAULT paths into KVM_BUG_ON()+EIO
so that KVM can hard commit to filling memory_fault on -EFAULTs that occur
in the page fault path.

- Fix a NX hugepage un-accounting bug where KVM would always uncharge the
shadow MMU, even when handling TDP MMU pages.

----------------------------------------------------------------
Anish Moorthy (1):
KVM: x86/mmu: Report a memory fault exit when the fault handler EFAULTs

Carlos López (1):
KVM: x86/mmu: Fix NX page unaccounting for TDP MMU pages

Chengfeng Ye (1):
KVM: x86: Take SRCU in kvm_zap_gfn_range()

Mikhail Malyshev (1):
KVM: x86/mmu: Convert can't-happen fault path EFAULTs to KVM_BUG_ON() + -EIO

Sean Christopherson (6):
KVM: x86/mmu: Reload MMU on *every* page pre-fault attempt/iteration
KVM: x86/mmu: Harden "map private PFN" against unexpected root invalidation
KVM: x86/mmu: Top-up memory caches when retrying "map private PFN"
KVM: x86/mmu: Add sanity check to detect stale page faults in "map private PFN"
KVM: x86/mmu: Always guard rmaps with mmu_lock on PREEMPT_RT=y kernels
KVM: x86/mmu: Bug the VM if KVM attempts to unsync an upper-level shadow page

arch/x86/kvm/mmu/mmu.c | 124 +++++++++++++++++++++++++++++++----------
arch/x86/kvm/mmu/paging_tmpl.h | 4 +-
arch/x86/kvm/x86.c | 2 -
3 files changed, 97 insertions(+), 33 deletions(-)