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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 21/05/2024 5:35 am, Sean Christopherson wrote:
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.

It's strange that as state of a PFN of SNP doesn't bind to individual VM, at least for the private pages. The command rpm_make_private() indeed reflects the mapping between PFN <-> <GFN, SSID>.

	rc = rmp_make_private(pfn_aligned, gfn_to_gpa(gfn_aligned),
			level, sev->asid, false);

And the NPT page tables
are treated as ephemeral for SNP.


Do you mean private mappings for SNP guest can be zapped from the VM (the private pages are still there unchanged) and re-mapped later w/o needing to have guest's explicit acceptance?

If so, I think "we can zap" doesn't mean "we need to zap"? Because the privates are now pinned anyway. If we truly want to zap private mappings for SNP, IIUC it can be done by distinguishing whether a VM needs to use a separate private table, which is TDX-only.

I'll look into the SNP spec to understand more.




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux