Skip to content

KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 mmu, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 8 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in TDP MMUarch/x86/kvm/mmu/tdp_iter.h arch/x86/kvm/mmu/tdp_mmu.c+16 -112 replies
2/2KVM: x86/mmu: Use CMPXCHG when clearing Accessed bit in the shadow MMUarch/x86/kvm/mmu/mmu.c+14 -132 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJames HoughtonKai Huang
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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

Signature · 1 line
2.55.0.229.g6434b31f56-goog