From: Sean Christopherson <seanjc@google.com>
To: Kai Huang <kai.huang@intel.com>
Cc: "zeming@nfschina.com" <zeming@nfschina.com>,
"x86@kernel.org" <x86@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"bp@alien8.de" <bp@alien8.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/kvm/mmu: Remove unnecessary ‘NULL’ values from sptep
Date: Tue, 5 Sep 2023 14:09:38 -0700 [thread overview]
Message-ID: <ZPeZEpn391RGLob6@google.com> (raw)
In-Reply-To: <99cf9b5929418e8876e95a169d20ee26e126c51c.camel@intel.com>
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.
next prev parent reply other threads:[~2023-09-05 21:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 17:54 [PATCH] x86/kvm/mmu: Remove unnecessary ‘NULL’ values from sptep Li zeming
2023-09-01 16:48 ` Sean Christopherson
2023-09-04 10:39 ` Huang, Kai
2023-09-05 21:09 ` Sean Christopherson [this message]
2023-09-05 23:31 ` Huang, Kai
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=ZPeZEpn391RGLob6@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zeming@nfschina.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.