[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZPeZEpn391RGLob6@google.com>
Date: Tue, 5 Sep 2023 14:09:38 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Kai Huang <kai.huang@...el.com>
Cc: "zeming@...china.com" <zeming@...china.com>,
"x86@...nel.org" <x86@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"bp@...en8.de" <bp@...en8.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/kvm/mmu: Remove unnecessary ‘NULL’
values from sptep
On Mon, Sep 04, 2023, Kai Huang wrote:
> On Fri, 2023-09-01 at 09:48 -0700, Sean Christopherson wrote:
> > @@ -3447,6 +3447,14 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
> > else
> > sptep = fast_pf_get_last_sptep(vcpu, fault->addr, &spte);
> >
> > + /*
> > + * It's entirely possible for the mapping to have been zapped
> > + * by a different task, but the root page is should always be
> > + * available as the vCPU holds a reference to its root(s).
> > + */
> > + if (WARN_ON_ONCE(!sptep))
> > + spte = REMOVED_SPTE;
>
> If I recall correctly, REMOVED_SPTE is only used by TDP MMU code. Should we use
> 0 (or initial SPTE value for case like TDX) instead of REMOVED_SPTE?
I deliberately suggested REMOVED_SPTE in part because of TDX introducing "initial
SPTE"; finding/remembering '0' initialization of SPTEs is hard. Though FWIW, '0'
would be totally fine for TDX because the value is never exposed to hardware.
I think it's totally fine to use REMOVED_SPTE like this in common code, I would
be quite surprised if it causes confusion. Even though REMOVED_SPTE was introduced
by the TDP MMU, its value/semantics are generic.
Powered by blists - more mailing lists