[libvirt] [PATCH 1/2] conf: Forbid hugepages and <source type='file'/>
Daniel P. Berrangé
berrange at redhat.com
Mon Oct 15 13:17:59 UTC 2018
On Mon, Oct 15, 2018 at 02:39:26PM +0200, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1633562
>
> Under <memoryBacking/> 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 <mprivozn at redhat.com>
> ---
> 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 @@
> <hugepages>
> <page size='2048' unit='KiB' nodeset='1'/>
> </hugepages>
> - <source type='file'/>
> <access mode='private'/>
> </memoryBacking>
> <vcpu placement='static'>4</vcpu>
> --
> 2.18.1
>
> --
> libvir-list mailing list
> libvir-list at 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 :|
More information about the libvir-list
mailing list