[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <21b18171d36a8284987f8cf3f2d02f9d783d1c25.camel@intel.com>
Date: Thu, 20 Jun 2024 19:38:07 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "seanjc@...gle.com" <seanjc@...gle.com>, "Zhao, Yan Y"
<yan.y.zhao@...el.com>
CC: "Huang, Kai" <kai.huang@...el.com>, "sagis@...gle.com" <sagis@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Aktas, Erdem"
<erdemaktas@...gle.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "Yamahata, Isaku"
<isaku.yamahata@...el.com>, "dmatlack@...gle.com" <dmatlack@...gle.com>
Subject: Re: [PATCH 0/5] Introduce a quirk to control memslot zap behavior
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.
>
> > >
> > > I'd prefer to go with option (a) here. Because we don't have any behavior
> > > defined yet for KVM_X86_TDX_VM, we don't really need to "disable a quirk"
> > > of it.
>
> I vote for (a) as well.
>
> > > Instead we could just define KVM_X86_QUIRK_SLOT_ZAP_ALL to be about the
> > > behavior
> > > of the existing vm_types. It would be a few lines of documentation to save
> > > implementing and maintaining a whole interface with special logic for TDX.
> > > So to
> > > me it doesn't seem worth it, unless there is some other user for a new
> > > more
> > > complex quirk interface.
> > What about introducing a forced disabled_quirk field?
>
> Nah, it'd require manual opt-in for every VM type for almost no benefit. In
> fact,
> IMO the code itself would be a net negative versus:
>
> return kvm->arch.vm_type == KVM_X86_DEFAULT_VM &&
> kvm_check_has_quirk(kvm, KVM_X86_QUIRK_SLOT_ZAP_ALL);
>
> because explicitly checking for KVM_X86_DEFAULT_VM would directly match the
> documentation (which would state that the quirk only applies to DEFAULT_VM).
Ok, I updated (and posted on this series) the TDX integration patch.
Powered by blists - more mailing lists