Re: [PATCH v2 20/28] KVM: x86/mmu: Use atomic ops to set SPTEs in TDP MMU map

From: Sean Christopherson
Date: Sat Feb 06 2021 - 00:01:38 EST


On Wed, Feb 03, 2021, Paolo Bonzini wrote:
> On 02/02/21 19:57, Ben Gardon wrote:
> > To prepare for handling page faults in parallel, change the TDP MMU
> > page fault handler to use atomic operations to set SPTEs so that changes
> > are not lost if multiple threads attempt to modify the same SPTE.
> >
> > Reviewed-by: Peter Feiner <pfeiner@xxxxxxxxxx>
> > Signed-off-by: Ben Gardon <bgardon@xxxxxxxxxx>
> >
> > ---
> >
> > v1 -> v2
> > - Rename "atomic" arg to "shared" in multiple functions
> > - Merged the commit that protects the lists of TDP MMU pages with a new
> > lock
> > - Merged the commits to add an atomic option for setting SPTEs and to
> > use that option in the TDP MMU page fault handler
>
> I'll look at the kernel test robot report if nobody beats me to it.

It's just a vanilla i386 compilation issue, the xchg() is on an 8-byte value.

We could fudge around it via #ifdef around the xchg(). Making all of tdp_mmu.c
x86-64 only would be nice to avoid future annoyance, though the number of stubs
required would be painful...