mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-28 07:25:17 +00:00
numa_conf: Rename virDomainNumaInterconnect* to virNumaInterconnect*
There's nothing domain specific about NUMA interconnects. Rename the virDomainNumaInterconnect* structures and enums to virNumaInterconnect*. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
5c359377a0
commit
6ad17e290e
@ -74,15 +74,15 @@ VIR_ENUM_IMPL(virNumaCachePolicy,
|
|||||||
"writethrough",
|
"writethrough",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainMemoryLatency,
|
VIR_ENUM_IMPL(virMemoryLatency,
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_LAST,
|
VIR_MEMORY_LATENCY_LAST,
|
||||||
"none",
|
"none",
|
||||||
"access",
|
"access",
|
||||||
"read",
|
"read",
|
||||||
"write"
|
"write"
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect;
|
typedef struct _virNumaInterconnect virNumaInterconnect;
|
||||||
|
|
||||||
typedef struct _virDomainNumaNode virDomainNumaNode;
|
typedef struct _virDomainNumaNode virDomainNumaNode;
|
||||||
|
|
||||||
@ -110,14 +110,14 @@ struct _virDomainNuma {
|
|||||||
} *mem_nodes; /* guest node configuration */
|
} *mem_nodes; /* guest node configuration */
|
||||||
size_t nmem_nodes;
|
size_t nmem_nodes;
|
||||||
|
|
||||||
struct _virDomainNumaInterconnect {
|
struct _virNumaInterconnect {
|
||||||
virDomainNumaInterconnectType type; /* whether structure describes latency
|
virNumaInterconnectType type; /* whether structure describes latency
|
||||||
or bandwidth */
|
or bandwidth */
|
||||||
unsigned int initiator; /* the initiator NUMA node */
|
unsigned int initiator; /* the initiator NUMA node */
|
||||||
unsigned int target; /* the target NUMA node */
|
unsigned int target; /* the target NUMA node */
|
||||||
unsigned int cache; /* the target cache on @target; if 0 then the
|
unsigned int cache; /* the target cache on @target; if 0 then the
|
||||||
memory on @target */
|
memory on @target */
|
||||||
virDomainMemoryLatency accessType; /* what type of access is defined */
|
virMemoryLatency accessType; /* what type of access is defined */
|
||||||
unsigned long value; /* value itself */
|
unsigned long value; /* value itself */
|
||||||
} *interconnects;
|
} *interconnects;
|
||||||
size_t ninterconnects;
|
size_t ninterconnects;
|
||||||
@ -1021,24 +1021,24 @@ virDomainNumaDefParseXML(virDomainNuma *def,
|
|||||||
&interconnect)) < 0)
|
&interconnect)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
def->interconnects = g_new0(virDomainNumaInterconnect, n);
|
def->interconnects = g_new0(virNumaInterconnect, n);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
virDomainNumaInterconnectType type;
|
virNumaInterconnectType type;
|
||||||
unsigned int initiator;
|
unsigned int initiator;
|
||||||
unsigned int target;
|
unsigned int target;
|
||||||
unsigned int cache = 0;
|
unsigned int cache = 0;
|
||||||
virDomainMemoryLatency accessType;
|
virMemoryLatency accessType;
|
||||||
unsigned long long value;
|
unsigned long long value;
|
||||||
|
|
||||||
if (virXMLNodeNameEqual(interconnect[i], "latency")) {
|
if (virXMLNodeNameEqual(interconnect[i], "latency")) {
|
||||||
type = VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY;
|
type = VIR_NUMA_INTERCONNECT_TYPE_LATENCY;
|
||||||
|
|
||||||
if (virXMLPropULongLong(interconnect[i], "value", 10,
|
if (virXMLPropULongLong(interconnect[i], "value", 10,
|
||||||
VIR_XML_PROP_REQUIRED, &value) < 0)
|
VIR_XML_PROP_REQUIRED, &value) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (virXMLNodeNameEqual(interconnect[i], "bandwidth")) {
|
} else if (virXMLNodeNameEqual(interconnect[i], "bandwidth")) {
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
type = VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH;
|
type = VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH;
|
||||||
|
|
||||||
ctxt->node = interconnect[i];
|
ctxt->node = interconnect[i];
|
||||||
|
|
||||||
@ -1062,13 +1062,13 @@ virDomainNumaDefParseXML(virDomainNuma *def,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virXMLPropEnum(interconnect[i], "type",
|
if (virXMLPropEnum(interconnect[i], "type",
|
||||||
virDomainMemoryLatencyTypeFromString,
|
virMemoryLatencyTypeFromString,
|
||||||
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
|
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
|
||||||
&accessType) < 0)
|
&accessType) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
def->interconnects[i] = (virDomainNumaInterconnect) {type, initiator, target,
|
def->interconnects[i] = (virNumaInterconnect) {type, initiator, target,
|
||||||
cache, accessType, value};
|
cache, accessType, value};
|
||||||
def->ninterconnects++;
|
def->ninterconnects++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1135,13 +1135,13 @@ virDomainNumaDefFormatXML(virBuffer *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ninterconnects; i++) {
|
for (i = 0; i < def->ninterconnects; i++) {
|
||||||
virDomainNumaInterconnect *l = &def->interconnects[i];
|
virNumaInterconnect *l = &def->interconnects[i];
|
||||||
|
|
||||||
switch (l->type) {
|
switch (l->type) {
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY:
|
case VIR_NUMA_INTERCONNECT_TYPE_LATENCY:
|
||||||
virBufferAddLit(buf, "<latency");
|
virBufferAddLit(buf, "<latency");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
case VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
||||||
virBufferAddLit(buf, "<bandwidth");
|
virBufferAddLit(buf, "<bandwidth");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,10 +1157,10 @@ virDomainNumaDefFormatXML(virBuffer *buf,
|
|||||||
|
|
||||||
virBufferAsprintf(buf,
|
virBufferAsprintf(buf,
|
||||||
" type='%s' value='%lu'",
|
" type='%s' value='%lu'",
|
||||||
virDomainMemoryLatencyTypeToString(l->accessType),
|
virMemoryLatencyTypeToString(l->accessType),
|
||||||
l->value);
|
l->value);
|
||||||
|
|
||||||
if (l->type == VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH)
|
if (l->type == VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH)
|
||||||
virBufferAddLit(buf, " unit='KiB'");
|
virBufferAddLit(buf, " unit='KiB'");
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
}
|
}
|
||||||
@ -1213,7 +1213,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->ninterconnects; i++) {
|
for (i = 0; i < def->ninterconnects; i++) {
|
||||||
const virDomainNumaInterconnect *l = &def->interconnects[i];
|
const virNumaInterconnect *l = &def->interconnects[i];
|
||||||
|
|
||||||
if (l->initiator >= def->nmem_nodes) {
|
if (l->initiator >= def->nmem_nodes) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
@ -1249,7 +1249,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
const virDomainNumaInterconnect *ll = &def->interconnects[j];
|
const virNumaInterconnect *ll = &def->interconnects[j];
|
||||||
|
|
||||||
if (l->type == ll->type &&
|
if (l->type == ll->type &&
|
||||||
l->initiator == ll->initiator &&
|
l->initiator == ll->initiator &&
|
||||||
@ -1720,20 +1720,20 @@ virDomainNumaGetNodeInitiator(const virDomainNuma *numa,
|
|||||||
/* For the rest, "NUMA node that has best performance (the lowest
|
/* For the rest, "NUMA node that has best performance (the lowest
|
||||||
* latency or largest bandwidth) to this NUMA node." */
|
* latency or largest bandwidth) to this NUMA node." */
|
||||||
for (i = 0; i < numa->ninterconnects; i++) {
|
for (i = 0; i < numa->ninterconnects; i++) {
|
||||||
const virDomainNumaInterconnect *l = &numa->interconnects[i];
|
const virNumaInterconnect *l = &numa->interconnects[i];
|
||||||
|
|
||||||
if (l->target != node)
|
if (l->target != node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (l->type) {
|
switch (l->type) {
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY:
|
case VIR_NUMA_INTERCONNECT_TYPE_LATENCY:
|
||||||
if (l->value < minLatency) {
|
if (l->value < minLatency) {
|
||||||
minLatency = l->value;
|
minLatency = l->value;
|
||||||
candidateLatency = l->initiator;
|
candidateLatency = l->initiator;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
case VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
||||||
if (l->value > maxBandwidth) {
|
if (l->value > maxBandwidth) {
|
||||||
maxBandwidth = l->value;
|
maxBandwidth = l->value;
|
||||||
candidateBandwidth = l->initiator;
|
candidateBandwidth = l->initiator;
|
||||||
@ -1762,14 +1762,14 @@ virDomainNumaGetInterconnectsCount(const virDomainNuma *numa)
|
|||||||
int
|
int
|
||||||
virDomainNumaGetInterconnect(const virDomainNuma *numa,
|
virDomainNumaGetInterconnect(const virDomainNuma *numa,
|
||||||
size_t i,
|
size_t i,
|
||||||
virDomainNumaInterconnectType *type,
|
virNumaInterconnectType *type,
|
||||||
unsigned int *initiator,
|
unsigned int *initiator,
|
||||||
unsigned int *target,
|
unsigned int *target,
|
||||||
unsigned int *cache,
|
unsigned int *cache,
|
||||||
virDomainMemoryLatency *accessType,
|
virMemoryLatency *accessType,
|
||||||
unsigned long *value)
|
unsigned long *value)
|
||||||
{
|
{
|
||||||
const virDomainNumaInterconnect *l;
|
const virNumaInterconnect *l;
|
||||||
|
|
||||||
if (!numa || i >= numa->ninterconnects)
|
if (!numa || i >= numa->ninterconnects)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -69,19 +69,19 @@ typedef enum {
|
|||||||
VIR_ENUM_DECL(virNumaCachePolicy);
|
VIR_ENUM_DECL(virNumaCachePolicy);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY,
|
VIR_NUMA_INTERCONNECT_TYPE_LATENCY,
|
||||||
VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH,
|
VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH,
|
||||||
} virDomainNumaInterconnectType;
|
} virNumaInterconnectType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_NONE = 0, /* No memory latency defined */
|
VIR_MEMORY_LATENCY_NONE = 0, /* No memory latency defined */
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_ACCESS, /* Access latency */
|
VIR_MEMORY_LATENCY_ACCESS, /* Access latency */
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_READ, /* Read latency */
|
VIR_MEMORY_LATENCY_READ, /* Read latency */
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_WRITE, /* Write latency */
|
VIR_MEMORY_LATENCY_WRITE, /* Write latency */
|
||||||
|
|
||||||
VIR_DOMAIN_MEMORY_LATENCY_LAST
|
VIR_MEMORY_LATENCY_LAST
|
||||||
} virDomainMemoryLatency;
|
} virMemoryLatency;
|
||||||
VIR_ENUM_DECL(virDomainMemoryLatency);
|
VIR_ENUM_DECL(virMemoryLatency);
|
||||||
|
|
||||||
|
|
||||||
virDomainNuma *virDomainNumaNew(void);
|
virDomainNuma *virDomainNumaNew(void);
|
||||||
@ -243,11 +243,11 @@ size_t virDomainNumaGetInterconnectsCount(const virDomainNuma *numa);
|
|||||||
|
|
||||||
int virDomainNumaGetInterconnect(const virDomainNuma *numa,
|
int virDomainNumaGetInterconnect(const virDomainNuma *numa,
|
||||||
size_t i,
|
size_t i,
|
||||||
virDomainNumaInterconnectType *type,
|
virNumaInterconnectType *type,
|
||||||
unsigned int *initiator,
|
unsigned int *initiator,
|
||||||
unsigned int *target,
|
unsigned int *target,
|
||||||
unsigned int *cache,
|
unsigned int *cache,
|
||||||
virDomainMemoryLatency *accessType,
|
virMemoryLatency *accessType,
|
||||||
unsigned long *value);
|
unsigned long *value);
|
||||||
|
|
||||||
typedef struct _virNumaDistance virNumaDistance;
|
typedef struct _virNumaDistance virNumaDistance;
|
||||||
|
@ -863,8 +863,6 @@ virNodeDeviceGetParentName;
|
|||||||
# conf/numa_conf.h
|
# conf/numa_conf.h
|
||||||
virDomainMemoryAccessTypeFromString;
|
virDomainMemoryAccessTypeFromString;
|
||||||
virDomainMemoryAccessTypeToString;
|
virDomainMemoryAccessTypeToString;
|
||||||
virDomainMemoryLatencyTypeFromString;
|
|
||||||
virDomainMemoryLatencyTypeToString;
|
|
||||||
virDomainNumaCheckABIStability;
|
virDomainNumaCheckABIStability;
|
||||||
virDomainNumaEquals;
|
virDomainNumaEquals;
|
||||||
virDomainNumaFillCPUsInNode;
|
virDomainNumaFillCPUsInNode;
|
||||||
@ -909,6 +907,8 @@ virDomainNumatunePlacementTypeFromString;
|
|||||||
virDomainNumatunePlacementTypeToString;
|
virDomainNumatunePlacementTypeToString;
|
||||||
virDomainNumatuneSet;
|
virDomainNumatuneSet;
|
||||||
virDomainNumatuneSpecifiedMaxNode;
|
virDomainNumatuneSpecifiedMaxNode;
|
||||||
|
virMemoryLatencyTypeFromString;
|
||||||
|
virMemoryLatencyTypeToString;
|
||||||
virNumaCacheAssociativityTypeFromString;
|
virNumaCacheAssociativityTypeFromString;
|
||||||
virNumaCacheAssociativityTypeToString;
|
virNumaCacheAssociativityTypeToString;
|
||||||
virNumaCacheFormat;
|
virNumaCacheFormat;
|
||||||
|
@ -7325,11 +7325,11 @@ qemuBuildNumaHMATCommandLine(virCommand *cmd,
|
|||||||
nlatencies = virDomainNumaGetInterconnectsCount(def->numa);
|
nlatencies = virDomainNumaGetInterconnectsCount(def->numa);
|
||||||
for (i = 0; i < nlatencies; i++) {
|
for (i = 0; i < nlatencies; i++) {
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
virDomainNumaInterconnectType type;
|
virNumaInterconnectType type;
|
||||||
unsigned int initiator;
|
unsigned int initiator;
|
||||||
unsigned int target;
|
unsigned int target;
|
||||||
unsigned int cache;
|
unsigned int cache;
|
||||||
virDomainMemoryLatency accessType;
|
virMemoryLatency accessType;
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
const char *hierarchyStr;
|
const char *hierarchyStr;
|
||||||
const char *accessStr;
|
const char *accessStr;
|
||||||
@ -7340,16 +7340,16 @@ qemuBuildNumaHMATCommandLine(virCommand *cmd,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
hierarchyStr = qemuDomainMemoryHierarchyTypeToString(cache);
|
hierarchyStr = qemuDomainMemoryHierarchyTypeToString(cache);
|
||||||
accessStr = virDomainMemoryLatencyTypeToString(accessType);
|
accessStr = virMemoryLatencyTypeToString(accessType);
|
||||||
virBufferAsprintf(&buf,
|
virBufferAsprintf(&buf,
|
||||||
"hmat-lb,initiator=%u,target=%u,hierarchy=%s,data-type=%s-",
|
"hmat-lb,initiator=%u,target=%u,hierarchy=%s,data-type=%s-",
|
||||||
initiator, target, hierarchyStr, accessStr);
|
initiator, target, hierarchyStr, accessStr);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY:
|
case VIR_NUMA_INTERCONNECT_TYPE_LATENCY:
|
||||||
virBufferAsprintf(&buf, "latency,latency=%lu", value);
|
virBufferAsprintf(&buf, "latency,latency=%lu", value);
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
case VIR_NUMA_INTERCONNECT_TYPE_BANDWIDTH:
|
||||||
virBufferAsprintf(&buf, "bandwidth,bandwidth=%luK", value);
|
virBufferAsprintf(&buf, "bandwidth,bandwidth=%luK", value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user