mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
numa_conf: Rename virDomainCache* to virNumaCache*
There's nothing domain specific about NUMA memory caches. Rename the virDomainCache* structures and enums to virNumaCache*. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
d6a6ed94f2
commit
b0b7554229
@ -60,15 +60,15 @@ VIR_ENUM_IMPL(virDomainMemoryAccess,
|
|||||||
"private",
|
"private",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainCacheAssociativity,
|
VIR_ENUM_IMPL(virNumaCacheAssociativity,
|
||||||
VIR_DOMAIN_CACHE_ASSOCIATIVITY_LAST,
|
VIR_NUMA_CACHE_ASSOCIATIVITY_LAST,
|
||||||
"none",
|
"none",
|
||||||
"direct",
|
"direct",
|
||||||
"full",
|
"full",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainCachePolicy,
|
VIR_ENUM_IMPL(virNumaCachePolicy,
|
||||||
VIR_DOMAIN_CACHE_POLICY_LAST,
|
VIR_NUMA_CACHE_POLICY_LAST,
|
||||||
"none",
|
"none",
|
||||||
"writeback",
|
"writeback",
|
||||||
"writethrough",
|
"writethrough",
|
||||||
@ -82,7 +82,7 @@ VIR_ENUM_IMPL(virDomainMemoryLatency,
|
|||||||
"write"
|
"write"
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef struct _virDomainNumaCache virDomainNumaCache;
|
typedef struct _virNumaCache virNumaCache;
|
||||||
|
|
||||||
typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect;
|
typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect;
|
||||||
|
|
||||||
@ -107,12 +107,12 @@ struct _virDomainNuma {
|
|||||||
virNumaDistance *distances; /* remote node distances */
|
virNumaDistance *distances; /* remote node distances */
|
||||||
size_t ndistances;
|
size_t ndistances;
|
||||||
|
|
||||||
struct _virDomainNumaCache {
|
struct _virNumaCache {
|
||||||
unsigned int level; /* cache level */
|
unsigned int level; /* cache level */
|
||||||
unsigned int size; /* cache size */
|
unsigned int size; /* cache size */
|
||||||
unsigned int line; /* line size, !!! in bytes !!! */
|
unsigned int line; /* line size, !!! in bytes !!! */
|
||||||
virDomainCacheAssociativity associativity; /* cache associativity */
|
virNumaCacheAssociativity associativity; /* cache associativity */
|
||||||
virDomainCachePolicy policy; /* cache policy */
|
virNumaCachePolicy policy; /* cache policy */
|
||||||
} *caches;
|
} *caches;
|
||||||
size_t ncaches;
|
size_t ncaches;
|
||||||
} *mem_nodes; /* guest node configuration */
|
} *mem_nodes; /* guest node configuration */
|
||||||
@ -845,11 +845,11 @@ virDomainNumaDefNodeCacheParseXML(virDomainNuma *def,
|
|||||||
if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0)
|
if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
def->mem_nodes[cur_cell].caches = g_new0(virDomainNumaCache, n);
|
def->mem_nodes[cur_cell].caches = g_new0(virNumaCache, n);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
virDomainNumaCache *cache = &def->mem_nodes[cur_cell].caches[i];
|
virNumaCache *cache = &def->mem_nodes[cur_cell].caches[i];
|
||||||
g_autofree char *tmp = NULL;
|
g_autofree char *tmp = NULL;
|
||||||
unsigned int level;
|
unsigned int level;
|
||||||
int associativity;
|
int associativity;
|
||||||
@ -883,7 +883,7 @@ virDomainNumaDefNodeCacheParseXML(virDomainNuma *def,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((associativity = virDomainCacheAssociativityTypeFromString(tmp)) < 0) {
|
if ((associativity = virNumaCacheAssociativityTypeFromString(tmp)) < 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid cache associativity '%s'"),
|
_("Invalid cache associativity '%s'"),
|
||||||
tmp);
|
tmp);
|
||||||
@ -898,7 +898,7 @@ virDomainNumaDefNodeCacheParseXML(virDomainNuma *def,
|
|||||||
cur_cell);
|
cur_cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((policy = virDomainCachePolicyTypeFromString(tmp)) < 0) {
|
if ((policy = virNumaCachePolicyTypeFromString(tmp)) < 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Invalid cache policy '%s'"),
|
_("Invalid cache policy '%s'"),
|
||||||
tmp);
|
tmp);
|
||||||
@ -915,7 +915,7 @@ virDomainNumaDefNodeCacheParseXML(virDomainNuma *def,
|
|||||||
ctxt, &line, 1, ULLONG_MAX, true) < 0)
|
ctxt, &line, 1, ULLONG_MAX, true) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*cache = (virDomainNumaCache){level, size, line, associativity, policy};
|
*cache = (virNumaCache){level, size, line, associativity, policy};
|
||||||
def->mem_nodes[cur_cell].ncaches++;
|
def->mem_nodes[cur_cell].ncaches++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1132,17 +1132,17 @@ virDomainNumaDefFormatXML(virBuffer *buf,
|
|||||||
def->mem_nodes[i].ndistances);
|
def->mem_nodes[i].ndistances);
|
||||||
|
|
||||||
for (j = 0; j < def->mem_nodes[i].ncaches; j++) {
|
for (j = 0; j < def->mem_nodes[i].ncaches; j++) {
|
||||||
virDomainNumaCache *cache = &def->mem_nodes[i].caches[j];
|
virNumaCache *cache = &def->mem_nodes[i].caches[j];
|
||||||
|
|
||||||
virBufferAsprintf(&childBuf, "<cache level='%u'", cache->level);
|
virBufferAsprintf(&childBuf, "<cache level='%u'", cache->level);
|
||||||
if (cache->associativity) {
|
if (cache->associativity) {
|
||||||
virBufferAsprintf(&childBuf, " associativity='%s'",
|
virBufferAsprintf(&childBuf, " associativity='%s'",
|
||||||
virDomainCacheAssociativityTypeToString(cache->associativity));
|
virNumaCacheAssociativityTypeToString(cache->associativity));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache->policy) {
|
if (cache->policy) {
|
||||||
virBufferAsprintf(&childBuf, " policy='%s'",
|
virBufferAsprintf(&childBuf, " policy='%s'",
|
||||||
virDomainCachePolicyTypeToString(cache->policy));
|
virNumaCachePolicyTypeToString(cache->policy));
|
||||||
}
|
}
|
||||||
virBufferAddLit(&childBuf, ">\n");
|
virBufferAddLit(&childBuf, ">\n");
|
||||||
|
|
||||||
@ -1226,7 +1226,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
|
|||||||
g_autoptr(virBitmap) levelsSeen = virBitmapNew(0);
|
g_autoptr(virBitmap) levelsSeen = virBitmapNew(0);
|
||||||
|
|
||||||
for (j = 0; j < node->ncaches; j++) {
|
for (j = 0; j < node->ncaches; j++) {
|
||||||
const virDomainNumaCache *cache = &node->caches[j];
|
const virNumaCache *cache = &node->caches[j];
|
||||||
|
|
||||||
/* Relax this if there's ever fourth layer of cache */
|
/* Relax this if there's ever fourth layer of cache */
|
||||||
if (cache->level > 3) {
|
if (cache->level > 3) {
|
||||||
@ -1270,7 +1270,7 @@ virDomainNumaDefValidate(const virDomainNuma *def)
|
|||||||
|
|
||||||
if (l->cache > 0) {
|
if (l->cache > 0) {
|
||||||
for (j = 0; j < def->mem_nodes[l->target].ncaches; j++) {
|
for (j = 0; j < def->mem_nodes[l->target].ncaches; j++) {
|
||||||
const virDomainNumaCache *cache = &def->mem_nodes[l->target].caches[j];
|
const virNumaCache *cache = &def->mem_nodes[l->target].caches[j];
|
||||||
|
|
||||||
if (l->cache == cache->level)
|
if (l->cache == cache->level)
|
||||||
break;
|
break;
|
||||||
@ -1712,8 +1712,8 @@ virDomainNumaGetNodeCache(const virDomainNuma *numa,
|
|||||||
unsigned int *level,
|
unsigned int *level,
|
||||||
unsigned int *size,
|
unsigned int *size,
|
||||||
unsigned int *line,
|
unsigned int *line,
|
||||||
virDomainCacheAssociativity *associativity,
|
virNumaCacheAssociativity *associativity,
|
||||||
virDomainCachePolicy *policy)
|
virNumaCachePolicy *policy)
|
||||||
{
|
{
|
||||||
const virDomainNumaNode *cell;
|
const virDomainNumaNode *cell;
|
||||||
|
|
||||||
|
@ -51,22 +51,22 @@ typedef enum {
|
|||||||
VIR_ENUM_DECL(virDomainMemoryAccess);
|
VIR_ENUM_DECL(virDomainMemoryAccess);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_CACHE_ASSOCIATIVITY_NONE, /* No associativity */
|
VIR_NUMA_CACHE_ASSOCIATIVITY_NONE, /* No associativity */
|
||||||
VIR_DOMAIN_CACHE_ASSOCIATIVITY_DIRECT, /* Direct mapped cache */
|
VIR_NUMA_CACHE_ASSOCIATIVITY_DIRECT, /* Direct mapped cache */
|
||||||
VIR_DOMAIN_CACHE_ASSOCIATIVITY_FULL, /* Fully associative cache */
|
VIR_NUMA_CACHE_ASSOCIATIVITY_FULL, /* Fully associative cache */
|
||||||
|
|
||||||
VIR_DOMAIN_CACHE_ASSOCIATIVITY_LAST
|
VIR_NUMA_CACHE_ASSOCIATIVITY_LAST
|
||||||
} virDomainCacheAssociativity;
|
} virNumaCacheAssociativity;
|
||||||
VIR_ENUM_DECL(virDomainCacheAssociativity);
|
VIR_ENUM_DECL(virNumaCacheAssociativity);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_CACHE_POLICY_NONE, /* No policy */
|
VIR_NUMA_CACHE_POLICY_NONE, /* No policy */
|
||||||
VIR_DOMAIN_CACHE_POLICY_WRITEBACK, /* Write-back policy */
|
VIR_NUMA_CACHE_POLICY_WRITEBACK, /* Write-back policy */
|
||||||
VIR_DOMAIN_CACHE_POLICY_WRITETHROUGH, /* Write-through policy */
|
VIR_NUMA_CACHE_POLICY_WRITETHROUGH, /* Write-through policy */
|
||||||
|
|
||||||
VIR_DOMAIN_CACHE_POLICY_LAST
|
VIR_NUMA_CACHE_POLICY_LAST
|
||||||
} virDomainCachePolicy;
|
} virNumaCachePolicy;
|
||||||
VIR_ENUM_DECL(virDomainCachePolicy);
|
VIR_ENUM_DECL(virNumaCachePolicy);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY,
|
VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY,
|
||||||
@ -233,8 +233,8 @@ int virDomainNumaGetNodeCache(const virDomainNuma *numa,
|
|||||||
unsigned int *level,
|
unsigned int *level,
|
||||||
unsigned int *size,
|
unsigned int *size,
|
||||||
unsigned int *line,
|
unsigned int *line,
|
||||||
virDomainCacheAssociativity *associativity,
|
virNumaCacheAssociativity *associativity,
|
||||||
virDomainCachePolicy *policy);
|
virNumaCachePolicy *policy);
|
||||||
|
|
||||||
ssize_t virDomainNumaGetNodeInitiator(const virDomainNuma *numa,
|
ssize_t virDomainNumaGetNodeInitiator(const virDomainNuma *numa,
|
||||||
size_t node);
|
size_t node);
|
||||||
|
@ -861,10 +861,6 @@ virNodeDeviceDeleteVport;
|
|||||||
virNodeDeviceGetParentName;
|
virNodeDeviceGetParentName;
|
||||||
|
|
||||||
# conf/numa_conf.h
|
# conf/numa_conf.h
|
||||||
virDomainCacheAssociativityTypeFromString;
|
|
||||||
virDomainCacheAssociativityTypeToString;
|
|
||||||
virDomainCachePolicyTypeFromString;
|
|
||||||
virDomainCachePolicyTypeToString;
|
|
||||||
virDomainMemoryAccessTypeFromString;
|
virDomainMemoryAccessTypeFromString;
|
||||||
virDomainMemoryAccessTypeToString;
|
virDomainMemoryAccessTypeToString;
|
||||||
virDomainMemoryLatencyTypeFromString;
|
virDomainMemoryLatencyTypeFromString;
|
||||||
@ -913,6 +909,10 @@ virDomainNumatunePlacementTypeFromString;
|
|||||||
virDomainNumatunePlacementTypeToString;
|
virDomainNumatunePlacementTypeToString;
|
||||||
virDomainNumatuneSet;
|
virDomainNumatuneSet;
|
||||||
virDomainNumatuneSpecifiedMaxNode;
|
virDomainNumatuneSpecifiedMaxNode;
|
||||||
|
virNumaCacheAssociativityTypeFromString;
|
||||||
|
virNumaCacheAssociativityTypeToString;
|
||||||
|
virNumaCachePolicyTypeFromString;
|
||||||
|
virNumaCachePolicyTypeToString;
|
||||||
virNumaDistanceFormat;
|
virNumaDistanceFormat;
|
||||||
|
|
||||||
|
|
||||||
|
@ -7250,8 +7250,8 @@ qemuBuilNumaCellCache(virCommand *cmd,
|
|||||||
unsigned int level;
|
unsigned int level;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
virDomainCacheAssociativity associativity;
|
virNumaCacheAssociativity associativity;
|
||||||
virDomainCachePolicy policy;
|
virNumaCachePolicy policy;
|
||||||
|
|
||||||
if (virDomainNumaGetNodeCache(def->numa, cell, i,
|
if (virDomainNumaGetNodeCache(def->numa, cell, i,
|
||||||
&level, &size, &line,
|
&level, &size, &line,
|
||||||
@ -7266,30 +7266,30 @@ qemuBuilNumaCellCache(virCommand *cmd,
|
|||||||
cell, size, level);
|
cell, size, level);
|
||||||
|
|
||||||
switch (associativity) {
|
switch (associativity) {
|
||||||
case VIR_DOMAIN_CACHE_ASSOCIATIVITY_NONE:
|
case VIR_NUMA_CACHE_ASSOCIATIVITY_NONE:
|
||||||
virBufferAddLit(&buf, ",associativity=none");
|
virBufferAddLit(&buf, ",associativity=none");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_ASSOCIATIVITY_DIRECT:
|
case VIR_NUMA_CACHE_ASSOCIATIVITY_DIRECT:
|
||||||
virBufferAddLit(&buf, ",associativity=direct");
|
virBufferAddLit(&buf, ",associativity=direct");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_ASSOCIATIVITY_FULL:
|
case VIR_NUMA_CACHE_ASSOCIATIVITY_FULL:
|
||||||
virBufferAddLit(&buf, ",associativity=complex");
|
virBufferAddLit(&buf, ",associativity=complex");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_ASSOCIATIVITY_LAST:
|
case VIR_NUMA_CACHE_ASSOCIATIVITY_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
case VIR_DOMAIN_CACHE_POLICY_NONE:
|
case VIR_NUMA_CACHE_POLICY_NONE:
|
||||||
virBufferAddLit(&buf, ",policy=none");
|
virBufferAddLit(&buf, ",policy=none");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_POLICY_WRITEBACK:
|
case VIR_NUMA_CACHE_POLICY_WRITEBACK:
|
||||||
virBufferAddLit(&buf, ",policy=write-back");
|
virBufferAddLit(&buf, ",policy=write-back");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_POLICY_WRITETHROUGH:
|
case VIR_NUMA_CACHE_POLICY_WRITETHROUGH:
|
||||||
virBufferAddLit(&buf, ",policy=write-through");
|
virBufferAddLit(&buf, ",policy=write-through");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CACHE_POLICY_LAST:
|
case VIR_NUMA_CACHE_POLICY_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user