On 09/19/2018 12:02 PM, Pavel Hrdina wrote: > On Wed, Sep 19, 2018 at 11:41:11AM +0200, Michal Privoznik wrote: >> On 09/17/2018 03:14 PM, marcandre.lur...@redhat.com wrote: >>> From: Marc-André Lureau <marcandre.lur...@redhat.com> >>> >>> 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.lur...@redhat.com> >>> --- >>> 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). > > I have to agree with Michal, we should not expose this implementation > detail in domain XML if we can hide it in status/migratable XML. > > One thing about the migration though. I'm not sure what are we > officially supporting in libvirt because it might cause us some issues. > > We need to make sure that if you live-migrate domain from old libvirt > to new libvirt you should be able to migrate that domain back to old > libvirt. The question is, whether this applies if you destroy and > start the domain on the new libvirt before you live-migrate it back > to old libvirt. > > Without the restart there is no issue, because the backend would not > be changed, but once you start the same domain again we would pick > new backend which would prevent migrating it back to the old libvirt. >
This is not supported. Exactly because of this reason. If we were to preserve this forward compatibility (i.e. migration from newer libvirt to older) then we couldn't use any new feature qemu has. For instance, if qemu introduces a new device and a user starts a domain with it, migration to older qemu will not work then, obviously. This also applies for other qemu capabilities. Migrating from newer version to older is not supported. It might work, but that's rather coincidence than intent. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list