Re: [PATCH 0/2] KVM: x86/mmu: Use LOCK CMPXCHG to clear Accessed bits
From: Huang, Kai
Date: Wed Jul 29 2026 - 18:10:28 EST
On Wed, 2026-07-29 at 06:33 -0700, Sean Christopherson wrote:
> On Wed, Jul 29, 2026, Kai Huang wrote:
> > On Mon, 2026-07-27 at 17:22 -0700, Sean Christopherson wrote:
> > > 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.
> >
> > Maybe do both, e.g., still remove the A-bit from FROZEN_SPTE? AFAICT there's no
> > good reason to keep the A-bit in FROZEN_SPTE.
>
> Hmm, I'm leaning "no".
>
> Once aging uses CMPXCHG, the A-bit isn't any more or less likely to be corrupted
> than any other bits. And arguably, using the A-bit is "safer", because (a) it's
> got the same bit position on EPT and everything else, and (b) spuriously setting
> or clearing the bit is more likely to be benign.
OK makes sense :-)
My concern was if some new code comes up in the future to manipulate the A bit
then it may not be obvious the FROZEN_SPTE contains the A bit, but like you said
it's more likely to be benign.