Re: [PATCH 0/5] Introduce a quirk to control memslot zap behavior
From: Sean Christopherson
Date: Thu Jun 20 2024 - 20:01:04 EST
On Thu, Jun 20, 2024, Rick P Edgecombe wrote:
> On Tue, 2024-06-18 at 07:34 -0700, Sean Christopherson wrote:
> > There's also option:
> >
> > c) Init disabled_quirks based on VM type.
> >
> > I.e. let userspace enable the quirk. If the VMM wants to shoot its TDX VM
> > guests, then so be it. That said, I don't like this option because it
> > would create a very bizarre ABI.
>
> I think we actually need to force it on for TDX because kvm_mmu_zap_all_fast()
> only zaps the direct (shared) root. If userspace decides to not enable the
> quirk, mirror/private memory will not be zapped on memslot deletion. Then later
> if there is a hole punch it will skip zapping that range because there is no
> memslot. Then won't it let the pages get freed while they are still mapped in
> the TD?
>
> If I got that right (not 100% sure on the gmem hole punch page freeing), I think
> KVM needs to force the behavior for TDs.
What I was suggesting is that we condition the skipping of the mirror/private
EPT pages tables on the quirk, i.e. zap *everything* for TDX VMs if the quirk is
enabled. Hence the very bizarre ABI.