Re: [RFC PATCH 09/21] KVM: TDX: Enable 2MB mapping size after TD is RUNNABLE
From: Sean Christopherson
Date: Thu Jun 12 2025 - 20:44:35 EST
On Fri, Jun 13, 2025, Rick P Edgecombe wrote:
> On Thu, 2025-06-12 at 17:19 -0700, Sean Christopherson wrote:
> > > I think this may need a guest opt-in, so the guest can say it can handle
> > > errors for both smaller and larger page size matches. So it may not
> > > matter if there is a rare usage or not. If KVM finds the guest opts-in
> > > (how to do that TBD), it can start mapping at the host level.
> >
> > Hmm, clever. That should work; requiring an updated guest kernel to get
> > optimal performance doesn't seem too onerous.
> >
> > > If KVM doesn't see the opt-in, the guest gets 4k pages.
> >
> > As in, KVM doesn't even try to use hugepage mappings? If so, this idea
> > probably gets my vote.
>
> Maybe an "I can handle it" accept size bit that comes in the exit qualification?
Eww, no. Having to react on _every_ EPT violation would be annoying, and trying
to debug issues where the guest is mixing options would probably be a nightmare.
I was thinking of something along the lines of an init-time or boot-time opt-in.
> Yan, do you see any problems with that? Like if a guest passed it in some accept
> and not others? Thinking about the new "unaccept" SEAMCALL...