Re: [PATCH 6/8] KVM: gmem, x86: Add gmem hook for invalidating private memory

From: Isaku Yamahata
Date: Wed Aug 16 2023 - 16:38:11 EST


On Tue, Aug 15, 2023 at 10:18:53AM -0700,
isaku.yamahata@xxxxxxxxx wrote:

> From: Michael Roth <michael.roth@xxxxxxx>
>
> TODO: add a CONFIG option that can be to completely skip arch
> invalidation loop and avoid __weak references for arch/platforms that
> don't need an additional invalidation hook.
>
> In some cases, like with SEV-SNP, guest memory needs to be updated in a
> platform-specific manner before it can be safely freed back to the host.
> Add hooks to wire up handling of this sort when freeing memory in
> response to FALLOC_FL_PUNCH_HOLE operations.
>
> Also issue invalidations of all allocated pages when releasing the gmem
> file so that the pages are not left in an unusable state when they get
> freed back to the host.
>
> Signed-off-by: Michael Roth <michael.roth@xxxxxxx>
> Link: https://lore.kernel.org/r/20230612042559.375660-3-michael.roth@xxxxxxx

Somehow I used the old one. Here is the updated one. The change is the argument
for kvm_gmem_issue_arch_invalidate() is struct inode instead of struct file.