[libvirt] [PATCH 3/5] qemu: prefer memfd for anonymous memory

Michal Privoznik mprivozn at redhat.com
Tue Sep 11 08:45:15 UTC 2018


On 09/11/2018 09:53 AM, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Sep 11, 2018 at 2:46 AM, John Ferlan <jferlan at redhat.com> wrote:
>>
>> On 09/07/2018 07:32 AM, marcandre.lureau at redhat.com wrote:
>>> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>>>
>>
>> Would be nice to have a few more words here. If you provide them I can
>> add them... The if statement is difficult to read unless you know what
>> each field really means.
> 
> hostmem-memfd is quite similar to hostmem-file. The main benefits are
> that it doesn't need to create filesystem files, and it also enforces
> sealing, providing a bit more safety.
> 
>> secondary question - should we document what gets used?, e.g.:
>>
>> https://libvirt.org/formatdomain.html#elementsMemoryBacking
>>
>> Seems to me the preference to use memfd is for memory backing using
>> anonymous source for nvdimm's without a defined path, but sometimes my
>> wording doesn't match reality.
> 
> Yes it could be documented. But it's now an allocation decision that
> could evolve, or an implementation detail.
> 
> Would you like to see something like that?
> 
>         <dt><code>source</code></dt>
> -       <dd>In this attribute you can switch to file memorybacking or keep
> -         default anonymous.</dd>
> +       <dd>In this attribute you can switch to file memorybacking or
> +       keep default anonymous. <span class="since">Since 4.8.0</span>,
> +       when the memory is anonymous and the host supports it, libvirt
> +       will use a memfd memory backing, providing additional safety
> +       guarantees.
> +       </dd>
>         <dt><code>access</code></dt>

I don't think we should document this because:

a) once we do, it's harder to change because of backwards compatibility.
Imagine a bz like this: "with these domain settings libvirt was putting
backend X onto cmd line and now that's changed to backend Y".

b) it's no user business how libvirt ensures domain settings. In
general, libvirt is dealing with custom build qemus where features might
be disabled. For instance, memfd.hugetlb. Then we don't use that and
fallback to memory-backend-*.

Also, users that rely on certain backend have probably broken setup anyway.

Michal




More information about the libvir-list mailing list