>>  static bool
>> @@ -47,11 +56,26 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, 
>> Error **errp)
>>          goto have_fd;
>>      }
>>  
>> -    fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size,
>> -                           m->hugetlb, m->hugetlbsize, m->seal ?
>> -                           F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0,
>> -                           errp);
>> -    if (fd == -1) {
>> +    if (m->guest_memfd) {
>> +        /* User choose to use fully shared guest-memfd to back the VM.. */
>> +        if (!backend->share) {
>> +            error_setg(errp, "Guest-memfd=on must be used with share=on");
>> +            return false;
>> +        }
>> +
>> +        /* TODO: add huge page support */
> 
> Until that's added, the related options should be disabled. m->seal as
> well doesn't seem to be applicable for guest_memfd case.

Which raises the question whether we want a new backend (I think you implement
that in your version).

guest_memfd is rather different in some aspects (e.g., resizing is already
completely forbidden).

What are the pros and cons of either approach?

-- 
Cheers,

David

Reply via email to