Hi On Tue, Sep 11, 2018 at 2:56 AM, John Ferlan <jferlan@xxxxxxxxxx> wrote: > > "non-anonymous" > > On 09/07/2018 07:32 AM, marcandre.lureau@xxxxxxxxxx wrote: >> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> >> >> memfd is able to allocate hugepage anonymous memory. >> >> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> >> --- >> src/conf/domain_conf.c | 7 ------- >> 1 file changed, 7 deletions(-) >> > >> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c >> index 86199623cc..696cf6ef18 100644 >> --- a/src/conf/domain_conf.c >> +++ b/src/conf/domain_conf.c >> @@ -6186,13 +6186,6 @@ virDomainDefMemtuneValidate(const virDomainDef *def) >> return -1; >> } >> >> - if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { >> - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", >> - _("hugepages are not allowed with anonymous " >> - "memory source")); >> - return -1; >> - } >> - > > > I believe we need to move this check into qemu specific code that would > then be able to test for QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB Would that be what you have in mind? diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5329899b13..d152466e28 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3950,10 +3950,19 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, static int -qemuDomainDefValidateMemory(const virDomainDef *def) +qemuDomainDefValidateMemory(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { const long system_page_size = virGetSystemPageSizeKB(); + if (def->mem.nhugepages != 0 && + def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("anonymous memory source with hugepages is not supported")); + return -1; + } + /* We can't guarantee any other mem.access * if no guest NUMA nodes are defined. */ if (def->mem.nhugepages != 0 && @@ -4094,7 +4103,7 @@ qemuDomainDefValidate(const virDomainDef *def, if (qemuDomainDefValidateFeatures(def, qemuCaps) < 0) goto cleanup; - if (qemuDomainDefValidateMemory(def) < 0) + if (qemuDomainDefValidateMemory(def, qemuCaps) < 0) goto cleanup; ret = 0; > See qemuDomainDefValidateMemory and go from there. I think this may > require 2 patches though... One to move the two checks that I don't > think are "mem" specific and the next to add the "filter" that if the > capability exists, then we can support; otherwise, still fail. > > "Theoretically speaking" those are qemu specific checks - the nodemask > checks done after this would appear to be more generic. > > John > > >> for (i = 0; i < mem->nhugepages; i++) { >> size_t j; >> ssize_t nextBit; >> -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list