Re: [libvirt] [PATCH 1/2] conf: Forbid hugepages and
On 10/15/2018 03:17 PM, Daniel P. Berrangé wrote: > On Mon, Oct 15, 2018 at 02:39:26PM +0200, Michal Privoznik wrote: >> https://bugzilla.redhat.com/show_bug.cgi?id=1633562 >> >> Under we allow users to configure various memory >> backing related knobs. However, there are some combinations that >> make no sense. For instance, requesting hugepages and file >> allocation at the same time. Forbid this configuration then. > > The huge pages we allocate come from a file in /dev/hugepages, > so this description doesn't really make sense. Sure, in the end the mmap() that qemu calls is a file somewhere under /dev/hugepages (btw terrible, really terrible path for hugetlbfs mount point because it suggests hugepages are devices). But is usually used to put domain RAM under /var/lib/libvirt/ram/.. (and to enforce memory-backing-file). > > IIUC, what's actually happening is that you're trying to avoid > a historical bug. More or less. This basically a result of 992bf863fcc. Anyway, might as well do nothing on this front :-) Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] conf: Forbid hugepages and
On Mon, Oct 15, 2018 at 02:39:26PM +0200, Michal Privoznik wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1633562 > > Under we allow users to configure various memory > backing related knobs. However, there are some combinations that > make no sense. For instance, requesting hugepages and file > allocation at the same time. Forbid this configuration then. The huge pages we allocate come from a file in /dev/hugepages, so this description doesn't really make sense. IIUC, what's actually happening is that you're trying to avoid a historical bug. > > Signed-off-by: Michal Privoznik > --- > src/conf/domain_conf.c | 16 ++-- > tests/qemuxml2argvdata/hugepages-memaccess2.xml | 1 - > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 9911d56130..ef1d5caa1c 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -4041,7 +4041,7 @@ virDomainDefPostParseMemory(virDomainDefPtr def, > } > > > -static void > +static int > virDomainDefPostParseMemtune(virDomainDefPtr def) > { > size_t i; > @@ -4063,6 +4063,17 @@ virDomainDefPostParseMemtune(virDomainDefPtr def) > } > } > } > + > +if (def->mem.nhugepages && > +def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_NONE && > +def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { > +virReportError(VIR_ERR_XML_ERROR, > + _("unsupported combination of hugepages and source > type %s"), > + virDomainMemorySourceTypeToString(def->mem.source)); > +return -1; > +} > + > +return 0; > } > > > @@ -5131,7 +5142,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def, > if (virDomainDefPostParseMemory(def, data->parseFlags) < 0) > return -1; > > -virDomainDefPostParseMemtune(def); > +if (virDomainDefPostParseMemtune(def) < 0) > +return -1; > > if (virDomainDefRejectDuplicateControllers(def) < 0) > return -1; > diff --git a/tests/qemuxml2argvdata/hugepages-memaccess2.xml > b/tests/qemuxml2argvdata/hugepages-memaccess2.xml > index 205f9efd92..e7f60291be 100644 > --- a/tests/qemuxml2argvdata/hugepages-memaccess2.xml > +++ b/tests/qemuxml2argvdata/hugepages-memaccess2.xml > @@ -8,7 +8,6 @@ > > > > - > > >4 > -- > 2.18.1 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] conf: Forbid hugepages and
https://bugzilla.redhat.com/show_bug.cgi?id=1633562 Under we allow users to configure various memory backing related knobs. However, there are some combinations that make no sense. For instance, requesting hugepages and file allocation at the same time. Forbid this configuration then. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 16 ++-- tests/qemuxml2argvdata/hugepages-memaccess2.xml | 1 - 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56130..ef1d5caa1c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4041,7 +4041,7 @@ virDomainDefPostParseMemory(virDomainDefPtr def, } -static void +static int virDomainDefPostParseMemtune(virDomainDefPtr def) { size_t i; @@ -4063,6 +4063,17 @@ virDomainDefPostParseMemtune(virDomainDefPtr def) } } } + +if (def->mem.nhugepages && +def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_NONE && +def->mem.source != VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) { +virReportError(VIR_ERR_XML_ERROR, + _("unsupported combination of hugepages and source type %s"), + virDomainMemorySourceTypeToString(def->mem.source)); +return -1; +} + +return 0; } @@ -5131,7 +5142,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefPostParseMemory(def, data->parseFlags) < 0) return -1; -virDomainDefPostParseMemtune(def); +if (virDomainDefPostParseMemtune(def) < 0) +return -1; if (virDomainDefRejectDuplicateControllers(def) < 0) return -1; diff --git a/tests/qemuxml2argvdata/hugepages-memaccess2.xml b/tests/qemuxml2argvdata/hugepages-memaccess2.xml index 205f9efd92..e7f60291be 100644 --- a/tests/qemuxml2argvdata/hugepages-memaccess2.xml +++ b/tests/qemuxml2argvdata/hugepages-memaccess2.xml @@ -8,7 +8,6 @@ - 4 -- 2.18.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list