On Mon, Aug 10, 2026, David Hildenbrand (Arm) wrote:
> On 8/7/26 23:52, Ackerley Tng via B4 Relay wrote:
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > index 65fbce46b63f4..9477ecebbbced 100644
> > --- a/include/linux/kvm_host.h
> > +++ b/include/linux/kvm_host.h
> > @@ -2580,6 +2580,8 @@ static inline bool kvm_vm_mem_is_private(struct kvm
> > *kvm, gfn_t gfn)
> > #endif /* CONFIG_KVM_VM_MEMORY_ATTRIBUTES */
> >
> > #ifdef kvm_arch_has_private_mem
> > +extern bool gmem_in_place_conversion;
>
> Is there a "supports/has/enable" in there? And should we call it "kvm_gmem"
> for
> completeness?
It's kinda stupid and definitely more than a bit inconsistent, but overall I
think
I actually like "gmem_in_place_conversion" the best.
gmem_has_in_place_conversion and gmem_supports_in_place_conversion are
misleading
because it's not just that guest_memfd has/supports in-place conversion, it's
that
that KVM is tracking PRIVATE in guest_memfd and so in-place conversion is the
only
option.
On the other hand, while gmem_in_place_conversion_enabled is better, it's not
quite accurate either because userspace isn't strictly required to do in-place
conversion.
As for a kvm_ prefix, IMO gmem_ is sufficient for a namespace, and not having
kvm_
is consistent with most module params in KVM.
So I 100% agree this is an odd name and has all kinds of inconsistenties, but
all
in all I actually like the vagueness and the brevity.
> > typedef bool (kvm_mem_is_private_t)(struct kvm *kvm, gfn_t gfn);
> > DECLARE_STATIC_CALL(__kvm_mem_is_private, kvm_mem_is_private_t);
> >
> > @@ -2588,6 +2590,8 @@ static inline bool kvm_mem_is_private(struct kvm
> > *kvm, gfn_t gfn)
> > return static_call(__kvm_mem_is_private)(kvm, gfn);
> > }
> > #else
> > +#define gmem_in_place_conversion false
> > +
> > static inline bool kvm_mem_is_private(struct kvm *kvm, gfn_t gfn)
> > {
> > return false;
> > @@ -2595,6 +2599,8 @@ static inline bool kvm_mem_is_private(struct kvm
> > *kvm, gfn_t gfn)
> > #endif /* kvm_arch_has_private_mem */
> >
> > #ifdef CONFIG_KVM_GUEST_MEMFD
> > +bool kvm_gmem_is_private(struct kvm *kvm, gfn_t gfn);
>
> As mentioned in v9, the name is confusing.
>
> kvm_gmem_mem_is_private
>
> ?
Ya, +1 to kvm_gmem_mem_is_private.