Re: [PATCH v15 13/20] KVM: SEV: Implement gmem hook for initializing private pages

From: Sean Christopherson
Date: Mon May 20 2024 - 13:35:39 EST


On Mon, May 20, 2024, Kai Huang wrote:
> On Wed, 2024-05-01 at 03:52 -0500, Michael Roth wrote:
> > This will handle the RMP table updates needed to put a page into a
> > private state before mapping it into an SEV-SNP guest.
> >
> >
>
> [...]
>
> > +int sev_gmem_prepare(struct kvm *kvm, kvm_pfn_t pfn, gfn_t gfn, int max_order)

..

> +Rick, Isaku,
>
> I am wondering whether this can be done in the KVM page fault handler?

No, because the state of a pfn in the RMP is tied to the guest_memfd inode, not
to the file descriptor, i.e. not to an individual VM. And the NPT page tables
are treated as ephemeral for SNP.