On 09/17/2018 03:14 PM, marcandre.lureau@xxxxxxxxxx wrote: > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > Add a new memoryBacking source type "memfd", supported by QEMU (when > the apability is available). > > A memfd is a specialized anonymous memory kind. As such, an anonymous > source type could be automatically using a memfd. However, there are > some complications when migrating from different memory backends in > qemu (mainly due to the internal object naming at this point, but > there could be more). For now, it is simpler and safer to simply > introduce a new source type "memfd". Eventually, the "anonymous" type > could learn to use memfd transparently in a seperate change. > > The main benefits are that it doesn't need to create filesystem files, > and it also enforces sealing, providing a bit more safety. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > --- > docs/formatdomain.html.in | 9 +-- > docs/schemas/domaincommon.rng | 1 + > src/conf/domain_conf.c | 3 +- > src/conf/domain_conf.h | 1 + > src/qemu/qemu_command.c | 69 +++++++++++++------ > src/qemu/qemu_domain.c | 12 +++- > .../memfd-memory-numa.x86_64-latest.args | 34 +++++++++ > tests/qemuxml2argvdata/memfd-memory-numa.xml | 36 ++++++++++ > tests/qemuxml2argvtest.c | 2 + > 9 files changed, 140 insertions(+), 27 deletions(-) > create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args > create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.xml > > diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in > index 1f12ab5b42..eeee1f6d40 100644 > --- a/docs/formatdomain.html.in > +++ b/docs/formatdomain.html.in > @@ -1099,7 +1099,7 @@ > </hugepages> > <nosharepages/> > <locked/> > - <source type="file|anonymous"/> > + <source type="file|anonymous|memfd"/> I'm sorry but I do not think this is the way we should go. This effectively avoids libvirt making the decision and exposes the backend used directly. This puts unnecessary burden on mgmt applications because they have to make yet another decision (track another domain attribute). IIUC, memfd is like memory-backend-file and -ram combined. It can do hugepages or just plain malloc(). Therefore it should be our first choice for freshly started domains. And only if qemu doesn't support it we should fall back to either -file or -ram backends. This means we have to track what backend the domain was started with so that we preserve that on migration (although, the fact that these backends are not interchangeable makes me question 'backend' in their name :-P). For that we can use status/migration XML as I suggested earlier. Once again, status XML is not editable by user [*] and is used solely by libvirtd to store runtime information for a running domain (and backend used falls into that category). Michal * - sure, an evil admin could edit the status XML file (which is usually stored under /var/run/libvirt/qemu/$domain.xml) and restart libvirtd to reload the changes. But hey, the file is readable/writable by root only and there are plenty other ways how an evil root could mess up with running domains. We (have to) trust root. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list