[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYUijQwl2Q6Q81DL@google.com>
Date: Thu, 5 Feb 2026 15:06:53 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Yan Zhao <yan.y.zhao@...el.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 06/45] KVM: x86/mmu: Fold set_external_spte_present()
into its sole caller
On Wed, Feb 04, 2026, Yan Zhao wrote:
> On Wed, Jan 28, 2026 at 05:14:38PM -0800, Sean Christopherson wrote:
> > @@ -626,6 +599,8 @@ static inline int __must_check __tdp_mmu_set_spte_atomic(struct kvm *kvm,
> > struct tdp_iter *iter,
> > u64 new_spte)
> > {
> > + u64 *raw_sptep = rcu_dereference(iter->sptep);
> > +
> > /*
> > * The caller is responsible for ensuring the old SPTE is not a FROZEN
> > * SPTE. KVM should never attempt to zap or manipulate a FROZEN SPTE,
> > @@ -638,31 +613,46 @@ static inline int __must_check __tdp_mmu_set_spte_atomic(struct kvm *kvm,
> > int ret;
> >
> > /*
> > - * Users of atomic zapping don't operate on mirror roots,
> > - * so don't handle it and bug the VM if it's seen.
> > + * KVM doesn't currently support zapping or splitting mirror
> > + * SPTEs while holding mmu_lock for read.
> > */
> > - if (KVM_BUG_ON(!is_shadow_present_pte(new_spte), kvm))
> > + if (KVM_BUG_ON(is_shadow_present_pte(iter->old_spte), kvm) ||
> > + KVM_BUG_ON(!is_shadow_present_pte(new_spte), kvm))
> > return -EBUSY;
> Should this be -EIO instead?
Yeah, probably.
> Though -EBUSY was introduced by commit 94faba8999b9 ('KVM: x86/tdp_mmu:
> Propagate tearing down mirror page tables')
>
> > - ret = set_external_spte_present(kvm, iter->sptep, iter->gfn,
> > - &iter->old_spte, new_spte, iter->level);
> Add "lockdep_assert_held(&kvm->mmu_lock)" for this case?
No, because I don't want to unnecessarily bleed TDX details into common MMU. Ah,
but there was a pre-existing lockdep in set_external_spte_present(). So I guess
that's arguably a functional change and should be called out in the changelog.
But I still want to drop the assertion (or maybe move it to TDX in a prep patch),
because ultimately the requirements around locking come from TDX, not from the
TDP MMU.
Powered by blists - more mailing lists