mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 James Houghton <jthoughton@google.com>
Subject: [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits
Date: Mon, 27 Jul 2026 17:22:34 -0700	[thread overview]
Message-ID: <20260728002236.869865-1-seanjc@google.com> (raw)

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


             reply	other threads:[~2026-07-28  0:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  0:22 Sean Christopherson [this message]
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
2026-07-31 20:10 ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728002236.869865-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=jthoughton@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome