[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZuDs1FhSfF3+uy3B@yzhao56-desk.sh.intel.com>
Date: Wed, 11 Sep 2024 09:05:24 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai"
<kai.huang@...el.com>, "nik.borisov@...e.com" <nik.borisov@...e.com>,
"dmatlack@...gle.com" <dmatlack@...gle.com>, "isaku.yamahata@...il.com"
<isaku.yamahata@...il.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/21] KVM: TDX: Implement hooks to propagate changes of
TDP MMU mirror page table
On Wed, Sep 11, 2024 at 07:58:01AM +0800, Edgecombe, Rick P wrote:
> On Tue, 2024-09-10 at 11:33 +0200, Paolo Bonzini wrote:
> > > But actually, I wonder if we need to remove the KVM_BUG_ON(). I think if you
> > > did
> > > a KVM_PRE_FAULT_MEMORY and then deleted the memslot you could hit it?
> >
> > I think all paths to handle_removed_pt() are safe:
> >
> > __tdp_mmu_zap_root
> > tdp_mmu_zap_root
> > kvm_tdp_mmu_zap_all
> > kvm_arch_flush_shadow_all
> > kvm_flush_shadow_all
> > kvm_destroy_vm (*)
> > kvm_mmu_notifier_release (*)
> > kvm_tdp_mmu_zap_invalidated_roots
> > kvm_mmu_zap_all_fast (**)
> > kvm_tdp_mmu_zap_sp
> > kvm_recover_nx_huge_pages (***)
>
> But not all paths to remove_external_spte():
> kvm_arch_flush_shadow_memslot()
> kvm_mmu_zap_memslot_leafs()
> kvm_tdp_mmu_unmap_gfn_range()
> tdp_mmu_zap_leafs()
> tdp_mmu_iter_set_spte()
> tdp_mmu_set_spte()
> remove_external_spte()
> tdx_sept_remove_private_spte()
>
> But we can probably keep the warning if we prevent KVM_PRE_FAULT_MEMORY as you
> pointed earlier. I didn't see that that kvm->arch.pre_fault_allowed got added.
Note:
If we diallow vCPU to be created before vm ioctl KVM_TDX_INIT_VM is done,
the vCPU ioctl KVM_PRE_FAULT_MEMORY can't be executed.
Then we can't hit the
"if (KVM_BUG_ON(!is_hkid_assigned(to_kvm_tdx(kvm)), kvm))"
in tdx_sept_remove_private_spte().
Powered by blists - more mailing lists