[PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits
From: Sean Christopherson
Date: Mon Jul 27 2026 - 20:28:05 EST
Use LOCK CMPXCHG instead of LOCK AND or LOCK BTR to clear Accessed bits when
aging SPTEs, as LOCK AND could clobber a !PRESENT SPTE. Specificaly, as
flagged by AI of some kind, a LOCK AND in the TDP MMU could clobber a
FROZEN_SPTE and ultimately result in a false negative since the Accessed bit
is included in FROZEN_SPTE.
I initially was planning on tweaking the FROZEN_SPTE value to make it ok to
use LOCK AND on Accessed bits, but AFAICT there's no meaningful downside to
using CMPXCHG.
Sean Christopherson (2):
KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in TDP MMU
KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in the shadow MMU
arch/x86/kvm/mmu/mmu.c | 27 ++++++++++++++-------------
arch/x86/kvm/mmu/tdp_iter.h | 7 +++++++
arch/x86/kvm/mmu/tdp_mmu.c | 20 +++++++++-----------
3 files changed, 30 insertions(+), 24 deletions(-)
base-commit: 271255273d5ff348fe29d89fe4712b2f7f7907c3
--
2.55.0.229.g6434b31f56-goog