On Fri, Oct 24, 2025 at 10:30:19AM +0800, Xiaoyao Li wrote:
> On 10/24/2025 2:59 AM, Peter Xu wrote:
> > Guest-memfd is not 100% attached to private, it's a VM-specific memory
> > provider.  Allow it to be created even without private attributes, for
> > example, when the VM can use the guest-memfd memory completely shared.
> > 
> > Signed-off-by: Peter Xu <[email protected]>
> > ---
> >   accel/kvm/kvm-all.c | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index f9254ae654..1425dfd8b3 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -2779,10 +2779,8 @@ static int kvm_init(AccelState *as, MachineState *ms)
> >       }
> >       kvm_supported_memory_attributes = kvm_vm_check_extension(s, 
> > KVM_CAP_MEMORY_ATTRIBUTES);
> > -    kvm_guest_memfd_supported =
> > -        kvm_vm_check_extension(s, KVM_CAP_GUEST_MEMFD) &&
> > -        kvm_vm_check_extension(s, KVM_CAP_USER_MEMORY2) &&
> > -        (kvm_supported_memory_attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE);
> > +    kvm_guest_memfd_supported = kvm_vm_check_extension(s, 
> > KVM_CAP_GUEST_MEMFD) &&
> > +        kvm_vm_check_extension(s, KVM_CAP_USER_MEMORY2);
> >       kvm_pre_fault_memory_supported = kvm_vm_check_extension(s, 
> > KVM_CAP_PRE_FAULT_MEMORY);
> >       if (s->kernel_irqchip_split == ON_OFF_AUTO_AUTO) {
> 
> 
> The check on KVM_MEMORY_ATTRIBUTE_PRIVATE is dropped silently. But using
> guest memfd to serve as private memory does requires the support of
> KVM_MEMORY_ATTRIBUTE_PRIVATE.
> 
> My version of the patch was

Your version looks good, I'll fetch yours to replace mine.  Thanks.

-- 
Peter Xu


Reply via email to