On Mon, Jun 08, 2026 at 04:03:23PM +0800, Binbin Wu wrote:
> On 5/22/2026 7:16 AM, Lisa Wang wrote:
> > +    * exactly like other memory providers.
> >      */
> > -   flags = 0;
> > -   if (is_guest_memfd_required(shape))
> > +   if (is_guest_memfd_required(shape)) {
> >             flags |= KVM_MEM_GUEST_MEMFD;
> > +           gmem_flags |= GUEST_MEMFD_FLAG_INIT_SHARED;
> > +   }
> >  
> > -   vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, 0, 0, nr_pages, 
> > flags);
> > +   vm_mem_add(vm, VM_MEM_SRC_ANONYMOUS, 0, 0, nr_pages, flags, -1, 0, 
> > gmem_flags);
> 
> The build failed due to this:
> 
> lib/kvm_util.c: In function ‘__vm_create’:
> lib/kvm_util.c:507:9: error: too many arguments to function ‘vm_mem_add’
>   507 |         vm_mem_add(vm, VM_MEM_SRC_ANONYMOUS, 0, 0, nr_pages, flags, 
> -1, 0, gmem_flags);
>       |         ^~~~~~~~~~
> In file included from lib/kvm_util.c:9:
> include/kvm_util.h:714:6: note: declared here
>   714 | void vm_mem_add(struct kvm_vm *vm, enum vm_mem_backing_src_type 
> src_type,
>       |      ^~~~~~~~~~
> lib/kvm_util.c: At top level:
> cc1: note: unrecognized command-line option 
> ‘-Wno-gnu-variable-sized-type-not-at-end’ may have been intended to silence 
> earlier diagnostics
> 
> It seems the patch set doesn't wire gmem_flags parameter to vm_mem_add().

This series need to based on "KVM: selftests: Add support for mmap() on
guest_memfd in core library" for the gmem_flags parameter.

Lisa

> >     for (i = 0; i < NR_MEM_REGIONS; i++)
> >             vm->memslots[i] = 0;
> >  
> > 
> 

Reply via email to