Re: [RFC PATCH v6 037/104] KVM: x86/mmu: Allow non-zero value for non-present SPTE

From: David Matlack
Date: Thu Aug 04 2022 - 19:44:23 EST


On Thu, Aug 4, 2022 at 4:23 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> On Thu, Aug 04, 2022, David Matlack wrote:
> > On Thu, May 05, 2022 at 11:14:31AM -0700, isaku.yamahata@xxxxxxxxx wrote:
> > > +#ifdef CONFIG_X86_64
> > > +#define SHADOW_NONPRESENT_VALUE BIT_ULL(63)
> > > +static_assert(!(SHADOW_NONPRESENT_VALUE & SPTE_MMU_PRESENT_MASK));
> > > +#else
> > > +#define SHADOW_NONPRESENT_VALUE 0ULL
> > > +#endif
> >
> > The terminology "shadow_nonpresent" implies it would be the opposite of
> > e.g. is_shadow_present_pte(), when in fact they are completely
> > different concepts.
>
> You can fight Paolo over that one :-) I agree it looks a bit odd when juxtaposed
> with is_shadow_present_pte(), but at the same time I agree with Paolo that
> SHADOW_INIT_VALUE is also funky.
>
> https://lore.kernel.org/all/9dfc44d6-6b20-e864-8d4f-09ab7d489b97@xxxxxxxxxx

Ah ok, thanks for the context.

>
> > Also, this is a good opportunity to follow the same naming terminology
> > as REMOVED_SPTE in the TDP MMU.
> >
> > How about EMPTY_SPTE?
>
> No, because "empty" implies there's nothing there, and it very much matters that
> the SUPPRESS_VE bit is set for TDX.

Fair point. My other idea was INITIAL_SPTE but that's already covered
by Paolo's objection above :)

I'll change my vote to NONPRESENT_SPTE.