[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYVRdMN+qTKCStf/@yzhao56-desk.sh.intel.com>
Date: Fri, 6 Feb 2026 10:27:00 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Thomas Gleixner <tglx@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
<x86@...nel.org>, Kiryl Shutsemau <kas@...nel.org>, Paolo Bonzini
<pbonzini@...hat.com>, <linux-kernel@...r.kernel.org>,
<linux-coco@...ts.linux.dev>, <kvm@...r.kernel.org>, Kai Huang
<kai.huang@...el.com>, Rick Edgecombe <rick.p.edgecombe@...el.com>, "Vishal
Annapurve" <vannapurve@...gle.com>, Ackerley Tng <ackerleytng@...gle.com>,
Sagi Shahar <sagis@...gle.com>, Binbin Wu <binbin.wu@...ux.intel.com>,
Xiaoyao Li <xiaoyao.li@...el.com>, Isaku Yamahata <isaku.yamahata@...el.com>
Subject: Re: [RFC PATCH v5 05/45] KVM: TDX: Drop
kvm_x86_ops.link_external_spt(), use .set_external_spte() for all
On Thu, Feb 05, 2026 at 03:14:29PM -0800, Sean Christopherson wrote:
> On Wed, Feb 04, 2026, Yan Zhao wrote:
> > On Tue, Feb 03, 2026 at 08:05:05PM +0000, Sean Christopherson wrote:
> > > On Tue, Feb 03, 2026, Yan Zhao wrote:
> > > > On Wed, Jan 28, 2026 at 05:14:37PM -0800, Sean Christopherson wrote:
> > > > > static int __must_check set_external_spte_present(struct kvm *kvm, tdp_ptep_t sptep,
> > > > > gfn_t gfn, u64 *old_spte,
> > > > > u64 new_spte, int level)
> > > > > {
> > > > > - bool was_present = is_shadow_present_pte(*old_spte);
> > > > > - bool is_present = is_shadow_present_pte(new_spte);
> > > > > - bool is_leaf = is_present && is_last_spte(new_spte, level);
> > > > > - int ret = 0;
> > > > > -
> > > > > - KVM_BUG_ON(was_present, kvm);
> > > > > + int ret;
> > > > >
> > > > > lockdep_assert_held(&kvm->mmu_lock);
> > > > > +
> > > > > + if (KVM_BUG_ON(is_shadow_present_pte(*old_spte), kvm))
> > > > > + return -EIO;
> > > > Why not move this check of is_shadow_present_pte() to tdx_sept_set_private_spte()
> > > > as well?
> > >
> > > The series gets there eventually, but as of this commit, @old_spte isn't plumbed
> > > into tdx_sept_set_private_spte().
> > >
> > > > Or also check !is_shadow_present_pte(new_spte) in TDP MMU?
> > >
> > > Not sure I understand this suggestion.
> > Sorry. The accurate expression should be
> > "what about moving !is_shadow_present_pte(new_spte) to TDP MMU as well?".
>
> It's already there, in __tdp_mmu_set_spte_atomic():
>
> /*
> * KVM doesn't currently support zapping or splitting mirror
> * SPTEs while holding mmu_lock for read.
> */
> if (KVM_BUG_ON(is_shadow_present_pte(iter->old_spte), kvm) ||
> KVM_BUG_ON(!is_shadow_present_pte(new_spte), kvm))
> return -EBUSY;
Ok. I was wondering why we don't include it directly in this patch, but it
doesn't matter.
> > > > And as Rick also mentioned, better to remove external in external_spt, e.g.
> > > > something like pt_page.
> > >
> > > Yeah, maybe sept_spt?
> > Hmm, here sept_spt is of type struct page, while sp->spt and sp->external_spt
> > represents VA. Not sure if it will cause confusion.
>
> How about sept_pt?
LGTM.
Powered by blists - more mailing lists