Re: [PATCH v5 6/7] KVM: x86: Combine .gmem_prepare()+.gmem_invalidate() into .gmem_convert()
From: Fuad Tabba
Date: Wed Jul 15 2026 - 05:51:43 EST
On Wed, 15 Jul 2026 at 01:11, Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Tue, Jul 14, 2026, Ackerley Tng wrote:
> > Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> > > #ifdef CONFIG_HAVE_KVM_ARCH_GMEM_RECLAIM
> > > void kvm_arch_gmem_reclaim(kvm_pfn_t pfn, kvm_pfn_t nr_pages, int max_order)
> > > {
> > > - kvm_x86_call(gmem_invalidate)(pfn, pfn + nr_pages);
> > > + WARN_ON_ONCE(kvm_x86_call(gmem_convert)(NULL, -1ull, pfn, nr_pages, max_order, false));
> >
> > This setup means later pKVM would have to define a .gmem_convert but
> > actually only use it for reclaim, which seems kind of an odd
> > definition. (We can fix this later.)
>
> No, pKVM (on arm64) would just implement kvm_arch_gmem_reclaim(), and then do
> whatever it wants under the hood.
Right. pKVM would just select HAVE_KVM_ARCH_GMEM_RECLAIM and implement
kvm_arch_gmem_reclaim() to scrub; the reclaim and convert hooks have
independent Kconfigs.
Thank you Ackerley for checking, and thank you all for the respin.
Cheers,
/fuad