Re: [PATCH v7 039/102] KVM: x86/mmu: Allow per-VM override of the TDP max page level

Isaku Yamahata
2022-07-19T10:26:22Z

On Fri, Jul 01, 2022 at 12:27:24AM +1200,
Kai Huang <kai.huang@intel.com> wrote:

> On Mon, 2022-06-27 at 14:53 -0700, isaku.yamahata@intel.com wrote:
> > From: Sean Christopherson <sean.j.christopherson@intel.com>
> >
> > TODO: This is a transient workaround patch until the large page support for
> > TDX is implemented. Support large page for TDX and remove this patch.
>
> I don't understand. How does this patch have anything to do with what you are
> talking about here?
>
> If you want to remove this patch later, then why not just explain the reason to
> remove when you actually have that patch?
>
> >
> > At this point, large page for TDX isn't supported, and need to allow guest
> > TD to work only with 4K pages. On the other hand, conventional VMX VMs
> > should continue to work with large page. Allow per-VM override of the TDP
> > max page level.
>
> At which point/previous patch have you made/declared "large page for TDX isn't
> supported"?
>
> If you want to declare you don't want to support large page for TDX, IMHO just
> declare it here, for instance:
>
> "For simplicity, only support 4K page for TD guest."
>
> >
> > In the existing x86 KVM MMU code, there is already max_level member in
> > struct kvm_page_fault with KVM_MAX_HUGEPAGE_LEVEL initial value. The KVM
> > page fault handler denies page size larger than max_level.
> >
> > Add per-VM member to indicate the allowed maximum page size with
> > KVM_MAX_HUGEPAGE_LEVEL as default value and initialize max_level in struct
> > kvm_page_fault with it. For the guest TD, the set per-VM value for allows
> > maximum page size to 4K page size. Then only allowed page size is 4K. It
> > means large page is disabled.
>
> To me it's overcomplicated. You just need simple sentences for such simple
> infrastructural patch. For instance:
>
> "TDX requires special handling to support large private page. For simplicity,
> only support 4K page for TD guest for now. Add per-VM maximum page level
> support to support different maximum page sizes for TD guest and conventional
> VMX guest."
>
> Just for your reference.

Thanks for the sentences. I'll replace the commit message with yours.

--
Isaku Yamahata <isaku.yamahata@gmail.com>