Re: [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits

Sean Christopherson <[email protected]> Fri, 31 Jul 2026 13:10:05 -0700
Newsgroups org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Mon, 27 Jul 2026 17:22:34 -0700, Sean Christopherson wrote:
> 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.
> 
> [...]

Applied to kvm-x86 mmu, thanks!

[1/2] KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in TDP MMU
      https://github.com/kvm-x86/linux/commit/3d679b7cb31f
[2/2] KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in the shadow MMU
      https://github.com/kvm-x86/linux/commit/fb25ee778aae

--
https://github.com/kvm-x86/linux/tree/next