Re: [PATCH RFC v8 09/56] KVM: SEV: Handle memory backed by restricted memfd
From: Vlastimil Babka
Date: Fri Mar 03 2023 - 09:05:19 EST
On 2/20/23 19:38, Michael Roth wrote:
> From: Nikunj A Dadhania <nikunj@xxxxxxx>
>
> Do not pin the guest memory backed by a restrictedmem backend, as
> pages in the restrictedmem are already pinned. Instead, populate the
> pages array for these guests using the already-pinned pages provided by
IIUC the "already pinned" became "effectively unmovable and unevictable"
since the earlier versions, so that would be more accurate now?
> +static int sev_private_mem_get_pages(struct kvm *kvm, unsigned long addr,
> + unsigned long size, unsigned long npages,
> + struct page **pages)
> +{
> + return kvm_vm_do_hva_range_op(kvm, addr, addr + size,
> + sev_private_mem_get_pages_handler, pages);
> +}
> +
> /*
> * Legacy SEV guest pin the pages and return the array populated with pinned
> * pages.
> + *
> + * SEV guests using restricted memfd backend, pages are already marked as
> + * unmovable and unevictable. Populate the pages array for these guests using
> + * restrictedmem get_pfn.
Right.