All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits
@ 2026-07-28  0:22 Sean Christopherson
  2026-07-28  0:22 ` [PATCH 1/2] KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in TDP MMU Sean Christopherson
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Sean Christopherson @ 2026-07-28  0:22 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, James Houghton

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-29 22:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  0:22 [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits Sean Christopherson
2026-07-28  0:22 ` [PATCH 1/2] KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in TDP MMU Sean Christopherson
2026-07-28  0:31   ` James Houghton
2026-07-29 11:07   ` Huang, Kai
2026-07-28  0:22 ` [PATCH 2/2] KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in the shadow MMU Sean Christopherson
2026-07-28  0:34   ` James Houghton
2026-07-29 11:10   ` Huang, Kai
2026-07-29 11:12 ` [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits Huang, Kai
2026-07-29 13:33   ` Sean Christopherson
2026-07-29 22:04     ` Huang, Kai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.