mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "seanjc@google.com" <seanjc@google.com>,
	"Zhao, Yan Y" <yan.y.zhao@intel.com>
Cc: "Huang, Kai" <kai.huang@intel.com>,
	"sagis@google.com" <sagis@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Aktas, Erdem" <erdemaktas@google.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"Yamahata, Isaku" <isaku.yamahata@intel.com>,
	"dmatlack@google.com" <dmatlack@google.com>
Subject: Re: [PATCH 0/5] Introduce a quirk to control memslot zap behavior
Date: Thu, 20 Jun 2024 19:38:07 +0000	[thread overview]
Message-ID: <21b18171d36a8284987f8cf3f2d02f9d783d1c25.camel@intel.com> (raw)
In-Reply-To: <ZnGa550k46ow2N3L@google.com>

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.

  parent reply	other threads:[~2024-06-20 19:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  6:06 Yan Zhao
2024-06-13  6:09 ` [PATCH 1/5] KVM: x86/mmu: " Yan Zhao
2024-06-13  6:10 ` [PATCH 2/5] KVM: selftests: Test slot move/delete with slot zap quirk enabled/disabled Yan Zhao
2024-06-13  6:10 ` [PATCH 3/5] KVM: selftests: Allow slot modification stress test with quirk disabled Yan Zhao
2024-06-13  6:10 ` [PATCH 4/5] KVM: selftests: Test memslot move in memslot_perf_test " Yan Zhao
2024-06-13  6:11 ` [PATCH 5/5] KVM: selftests: Test private access to deleted memslot " Yan Zhao
2024-06-13 20:01 ` [PATCH 0/5] Introduce a quirk to control memslot zap behavior Edgecombe, Rick P
2024-06-17 10:15   ` Yan Zhao
2024-06-18 14:34     ` Sean Christopherson
2024-06-20  3:59       ` Yan Zhao
2024-06-20 19:38       ` Edgecombe, Rick P [this message]
2024-06-21  0:00         ` Sean Christopherson
2024-06-21  1:06           ` Edgecombe, Rick P
2024-06-20 19:37 ` [PATCH] KVM: x86/mmu: Implement memslot deletion for TDX Rick Edgecombe
2024-06-20 19:40   ` Edgecombe, Rick P
2024-06-21  0:08   ` Sean Christopherson
2024-06-21  1:17     ` Edgecombe, Rick P
2024-06-21  2:14     ` Yan Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21b18171d36a8284987f8cf3f2d02f9d783d1c25.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=dmatlack@google.com \
    --cc=erdemaktas@google.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sagis@google.com \
    --cc=seanjc@google.com \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®