2014-06-06 16:50:39 +02:00
|
|
|
/*
|
2015-02-11 10:08:35 +01:00
|
|
|
* numa_conf.h
|
2014-06-06 16:50:39 +02:00
|
|
|
*
|
2015-02-11 10:08:35 +01:00
|
|
|
* Copyright (C) 2014-2015 Red Hat, Inc.
|
2014-06-06 16:50:39 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 15:20:21 -05:00
|
|
|
#pragma once
|
2014-06-06 16:50:39 +02:00
|
|
|
|
2019-06-07 15:20:21 -05:00
|
|
|
#include <libxml/xpath.h>
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2019-06-07 15:20:21 -05:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virbitmap.h"
|
|
|
|
#include "virbuffer.h"
|
|
|
|
#include "virenum.h"
|
2014-06-09 15:00:22 +02:00
|
|
|
|
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
typedef struct _virDomainNuma virDomainNuma;
|
|
|
|
typedef virDomainNuma *virDomainNumaPtr;
|
2014-06-06 16:50:39 +02:00
|
|
|
|
|
|
|
typedef enum {
|
2014-06-08 19:15:42 +02:00
|
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
|
|
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
|
2014-06-06 16:50:39 +02:00
|
|
|
|
2014-06-08 19:15:42 +02:00
|
|
|
VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
|
|
|
|
} virDomainNumatunePlacement;
|
2014-06-06 16:50:39 +02:00
|
|
|
|
2019-01-20 11:04:56 -05:00
|
|
|
VIR_ENUM_DECL(virDomainNumatunePlacement);
|
|
|
|
VIR_ENUM_DECL(virDomainNumatuneMemMode);
|
2014-06-06 16:50:39 +02:00
|
|
|
|
2015-02-11 15:40:27 +01:00
|
|
|
typedef enum {
|
2017-02-02 13:27:30 +00:00
|
|
|
VIR_DOMAIN_MEMORY_ACCESS_DEFAULT = 0, /* No memory access defined */
|
|
|
|
VIR_DOMAIN_MEMORY_ACCESS_SHARED, /* Memory access is set as shared */
|
|
|
|
VIR_DOMAIN_MEMORY_ACCESS_PRIVATE, /* Memory access is set as private */
|
2015-02-11 15:40:27 +01:00
|
|
|
|
2017-02-02 13:27:30 +00:00
|
|
|
VIR_DOMAIN_MEMORY_ACCESS_LAST,
|
|
|
|
} virDomainMemoryAccess;
|
2019-01-20 11:04:56 -05:00
|
|
|
VIR_ENUM_DECL(virDomainMemoryAccess);
|
2015-02-11 15:40:27 +01:00
|
|
|
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-16 16:42:13 +01:00
|
|
|
virDomainNumaPtr virDomainNumaNew(void);
|
2015-02-11 14:54:59 +01:00
|
|
|
void virDomainNumaFree(virDomainNumaPtr numa);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* XML Parse/Format functions
|
|
|
|
*/
|
2015-02-16 17:19:15 +01:00
|
|
|
int virDomainNumatuneParseXML(virDomainNumaPtr numa,
|
2014-07-21 11:32:33 +02:00
|
|
|
bool placement_static,
|
|
|
|
xmlXPathContextPtr ctxt)
|
2015-02-16 17:28:48 +01:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune)
|
2014-06-09 15:00:22 +02:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Getters
|
|
|
|
*/
|
2015-05-19 11:55:26 +02:00
|
|
|
int virDomainNumatuneGetMode(virDomainNumaPtr numatune,
|
|
|
|
int cellid,
|
|
|
|
virDomainNumatuneMemMode *mode);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumaPtr numatune,
|
2014-06-26 19:46:45 +02:00
|
|
|
virBitmapPtr auto_nodeset,
|
|
|
|
int cellid);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
|
2015-01-15 22:40:15 +01:00
|
|
|
virBitmapPtr auto_nodeset,
|
|
|
|
virBitmapPtr *retNodeset,
|
|
|
|
int cellid);
|
|
|
|
|
2017-03-21 13:24:36 -04:00
|
|
|
size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa);
|
|
|
|
|
2017-11-14 14:28:11 +01:00
|
|
|
bool virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa,
|
|
|
|
size_t node,
|
|
|
|
size_t sibling)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2019-12-09 20:15:11 -03:00
|
|
|
bool virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
xenconfig: add domxml conversions for xen-xl
This patch converts NUMA configurations between the Xen libxl
configuration file format and libvirt's XML format.
XML HVM domain on a 4 node (2 cores/socket) configuration:
<cpu>
<numa>
<cell id='0' cpus='0-1' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='10'/>
<sibling id='1' value='21'/>
<sibling id='2' value='31'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='1' cpus='2-3' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='10'/>
<sibling id='2' value='21'/>
<sibling id='3' value='31'/>
</distances>
</cell>
<cell id='2' cpus='3-4' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='31'/>
<sibling id='1' value='21'/>
<sibling id='2' value='10'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='3' cpus='5-6' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='31'/>
<sibling id='2' value='21'/>
<sibling id='3' value='10'/>
</distances>
</cell>
</numa>
</cpu>
Xen xl.cfg domain configuration:
vnuma = [["pnode=0","size=2048","vcpus=0-1","vdistances=10,21,31,21"],
["pnode=1","size=2048","vcpus=2-3","vdistances=21,10,21,31"],
["pnode=2","size=2048","vcpus=4-5","vdistances=31,21,10,21"],
["pnode=3","size=2048","vcpus=6-7","vdistances=21,31,21,10"]]
If there is no XML <distances> description amongst the <cell> data the
conversion schema from xml to native will generate 10 for local and 20
for all remote instances.
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2017-11-02 16:47:21 +01:00
|
|
|
size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
|
|
|
|
size_t node,
|
|
|
|
size_t sibling)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2015-02-16 17:28:48 +01:00
|
|
|
virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
|
2015-02-16 18:38:43 +01:00
|
|
|
size_t node)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2017-02-02 13:27:30 +00:00
|
|
|
virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
|
2015-02-16 18:51:36 +01:00
|
|
|
size_t node)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2018-05-11 15:08:53 +02:00
|
|
|
virTristateBool virDomainNumaGetNodeDiscard(virDomainNumaPtr numa,
|
|
|
|
size_t node)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2015-02-16 17:28:48 +01:00
|
|
|
unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
|
2015-02-16 19:14:23 +01:00
|
|
|
size_t node)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2015-02-16 20:15:04 +01:00
|
|
|
unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2015-02-16 18:11:46 +01:00
|
|
|
|
2015-08-07 16:31:57 +02:00
|
|
|
unsigned int
|
|
|
|
virDomainNumaGetMaxCPUID(virDomainNumaPtr numa);
|
|
|
|
|
2014-06-09 15:00:22 +02:00
|
|
|
/*
|
|
|
|
* Formatters
|
|
|
|
*/
|
2015-02-11 14:54:59 +01:00
|
|
|
char *virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune,
|
2014-06-26 19:46:45 +02:00
|
|
|
virBitmapPtr auto_nodeset,
|
|
|
|
int cellid);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
int virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
|
2014-06-09 15:00:22 +02:00
|
|
|
virBitmapPtr auto_nodeset,
|
2014-06-26 19:46:45 +02:00
|
|
|
char **mask,
|
|
|
|
int cellid);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Setters
|
|
|
|
*/
|
2015-02-16 17:05:46 +01:00
|
|
|
int virDomainNumatuneSet(virDomainNumaPtr numa,
|
2014-07-21 11:32:33 +02:00
|
|
|
bool placement_static,
|
|
|
|
int placement,
|
|
|
|
int mode,
|
|
|
|
virBitmapPtr nodeset)
|
2014-06-09 15:00:22 +02:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
xenconfig: add domxml conversions for xen-xl
This patch converts NUMA configurations between the Xen libxl
configuration file format and libvirt's XML format.
XML HVM domain on a 4 node (2 cores/socket) configuration:
<cpu>
<numa>
<cell id='0' cpus='0-1' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='10'/>
<sibling id='1' value='21'/>
<sibling id='2' value='31'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='1' cpus='2-3' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='10'/>
<sibling id='2' value='21'/>
<sibling id='3' value='31'/>
</distances>
</cell>
<cell id='2' cpus='3-4' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='31'/>
<sibling id='1' value='21'/>
<sibling id='2' value='10'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='3' cpus='5-6' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='31'/>
<sibling id='2' value='21'/>
<sibling id='3' value='10'/>
</distances>
</cell>
</numa>
</cpu>
Xen xl.cfg domain configuration:
vnuma = [["pnode=0","size=2048","vcpus=0-1","vdistances=10,21,31,21"],
["pnode=1","size=2048","vcpus=2-3","vdistances=21,10,21,31"],
["pnode=2","size=2048","vcpus=4-5","vdistances=31,21,10,21"],
["pnode=3","size=2048","vcpus=6-7","vdistances=21,31,21,10"]]
If there is no XML <distances> description amongst the <cell> data the
conversion schema from xml to native will generate 10 for local and 20
for all remote instances.
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2017-11-02 16:47:21 +01:00
|
|
|
size_t virDomainNumaSetNodeCount(virDomainNumaPtr numa,
|
|
|
|
size_t nmem_nodes)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2015-02-16 17:28:48 +01:00
|
|
|
void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
|
2015-02-16 19:14:23 +01:00
|
|
|
size_t node,
|
|
|
|
unsigned long long size)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
xenconfig: add domxml conversions for xen-xl
This patch converts NUMA configurations between the Xen libxl
configuration file format and libvirt's XML format.
XML HVM domain on a 4 node (2 cores/socket) configuration:
<cpu>
<numa>
<cell id='0' cpus='0-1' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='10'/>
<sibling id='1' value='21'/>
<sibling id='2' value='31'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='1' cpus='2-3' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='10'/>
<sibling id='2' value='21'/>
<sibling id='3' value='31'/>
</distances>
</cell>
<cell id='2' cpus='3-4' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='31'/>
<sibling id='1' value='21'/>
<sibling id='2' value='10'/>
<sibling id='3' value='21'/>
</distances>
</cell>
<cell id='3' cpus='5-6' memory='2097152' unit='KiB'>
<distances>
<sibling id='0' value='21'/>
<sibling id='1' value='31'/>
<sibling id='2' value='21'/>
<sibling id='3' value='10'/>
</distances>
</cell>
</numa>
</cpu>
Xen xl.cfg domain configuration:
vnuma = [["pnode=0","size=2048","vcpus=0-1","vdistances=10,21,31,21"],
["pnode=1","size=2048","vcpus=2-3","vdistances=21,10,21,31"],
["pnode=2","size=2048","vcpus=4-5","vdistances=31,21,10,21"],
["pnode=3","size=2048","vcpus=6-7","vdistances=21,31,21,10"]]
If there is no XML <distances> description amongst the <cell> data the
conversion schema from xml to native will generate 10 for local and 20
for all remote instances.
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2017-11-02 16:47:21 +01:00
|
|
|
int virDomainNumaSetNodeDistance(virDomainNumaPtr numa,
|
|
|
|
size_t node,
|
|
|
|
size_t sibling,
|
|
|
|
unsigned int value)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
|
|
|
size_t virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa,
|
|
|
|
size_t node,
|
|
|
|
size_t ndistances)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
|
|
|
virBitmapPtr virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
|
|
|
|
size_t node,
|
|
|
|
virBitmapPtr cpumask)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2014-06-09 15:00:22 +02:00
|
|
|
/*
|
|
|
|
* Other accessors
|
|
|
|
*/
|
2015-02-11 14:54:59 +01:00
|
|
|
bool virDomainNumaEquals(virDomainNumaPtr n1,
|
|
|
|
virDomainNumaPtr n2);
|
2014-06-09 15:00:22 +02:00
|
|
|
|
2015-02-16 20:34:37 +01:00
|
|
|
bool virDomainNumaCheckABIStability(virDomainNumaPtr src,
|
|
|
|
virDomainNumaPtr tgt);
|
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune);
|
2014-06-06 16:50:39 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune);
|
2014-06-26 19:46:45 +02:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
int virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune);
|
2014-11-06 12:16:54 +01:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
bool virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
|
2014-11-06 12:16:54 +01:00
|
|
|
virBitmapPtr auto_nodeset);
|
2015-02-12 17:37:46 +01:00
|
|
|
|
2015-02-11 14:54:59 +01:00
|
|
|
bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
|
2015-02-12 17:37:46 +01:00
|
|
|
int cellid);
|
2015-02-11 12:27:53 +01:00
|
|
|
|
2015-02-16 17:28:48 +01:00
|
|
|
int virDomainNumaDefCPUParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt);
|
2017-09-08 16:47:14 +02:00
|
|
|
int virDomainNumaDefCPUFormatXML(virBufferPtr buf, virDomainNumaPtr def);
|
2015-02-11 12:27:53 +01:00
|
|
|
|
2015-02-16 17:28:48 +01:00
|
|
|
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
|