mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-11 12:25:52 +00:00
conf: Allow > UINT_MAX of cache for NUMA nodes
The high-bandwidth memory (HBM) in cache mode might be greater than UINT_MAX of cache per NUMA node, so change to unsigned long long. Signed-off-by: Lin Yang <lin.a.yang@intel.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
91ef81a378
commit
5e46d6ec4e
@ -1549,10 +1549,10 @@ virCapabilitiesGetNUMAPagesInfo(int node,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virCapabilitiesGetNodeCacheReadFile(const char *prefix,
|
virCapabilitiesGetNodeCacheReadFileUint(const char *prefix,
|
||||||
const char *dir,
|
const char *dir,
|
||||||
const char *file,
|
const char *file,
|
||||||
unsigned int *value)
|
unsigned int *value)
|
||||||
{
|
{
|
||||||
g_autofree char *path = g_build_filename(prefix, dir, file, NULL);
|
g_autofree char *path = g_build_filename(prefix, dir, file, NULL);
|
||||||
int rv = virFileReadValueUint(value, "%s", path);
|
int rv = virFileReadValueUint(value, "%s", path);
|
||||||
@ -1570,6 +1570,28 @@ virCapabilitiesGetNodeCacheReadFile(const char *prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virCapabilitiesGetNodeCacheReadFileUllong(const char *prefix,
|
||||||
|
const char *dir,
|
||||||
|
const char *file,
|
||||||
|
unsigned long long *value)
|
||||||
|
{
|
||||||
|
g_autofree char *path = g_build_filename(prefix, dir, file, NULL);
|
||||||
|
int rv = virFileReadValueUllong(value, "%s", path);
|
||||||
|
|
||||||
|
if (rv < 0) {
|
||||||
|
if (rv == -2) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("File '%s' does not exist"),
|
||||||
|
path);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virCapsHostNUMACellCacheComparator(const void *a,
|
virCapsHostNUMACellCacheComparator(const void *a,
|
||||||
const void *b)
|
const void *b)
|
||||||
@ -1612,18 +1634,18 @@ virCapabilitiesGetNodeCache(int node,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name,
|
if (virCapabilitiesGetNodeCacheReadFileUllong(path, entry->d_name,
|
||||||
"size", &cache.size) < 0)
|
"size", &cache.size) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cache.size >>= 10; /* read in bytes but stored in kibibytes */
|
cache.size >>= 10; /* read in bytes but stored in kibibytes */
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name,
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name,
|
||||||
"line_size", &cache.line) < 0)
|
"line_size", &cache.line) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name,
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name,
|
||||||
"indexing", &indexing) < 0)
|
"indexing", &indexing) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* see enum cache_indexing in kernel */
|
/* see enum cache_indexing in kernel */
|
||||||
@ -1638,8 +1660,8 @@ virCapabilitiesGetNodeCache(int node,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name,
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name,
|
||||||
"write_policy", &write_policy) < 0)
|
"write_policy", &write_policy) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* see enum cache_write_policy in kernel */
|
/* see enum cache_write_policy in kernel */
|
||||||
@ -1793,26 +1815,26 @@ virCapabilitiesHostNUMAInitInterconnectsNode(GArray *interconnects,
|
|||||||
if (!virFileExists(path))
|
if (!virFileExists(path))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, "initiators",
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators",
|
||||||
"read_bandwidth",
|
"read_bandwidth",
|
||||||
&read_bandwidth) < 0)
|
&read_bandwidth) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, "initiators",
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators",
|
||||||
"write_bandwidth",
|
"write_bandwidth",
|
||||||
&write_bandwidth) < 0)
|
&write_bandwidth) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Bandwidths are read in MiB but stored in KiB */
|
/* Bandwidths are read in MiB but stored in KiB */
|
||||||
read_bandwidth <<= 10;
|
read_bandwidth <<= 10;
|
||||||
write_bandwidth <<= 10;
|
write_bandwidth <<= 10;
|
||||||
|
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, "initiators",
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators",
|
||||||
"read_latency",
|
"read_latency",
|
||||||
&read_latency) < 0)
|
&read_latency) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (virCapabilitiesGetNodeCacheReadFile(path, "initiators",
|
if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators",
|
||||||
"write_latency",
|
"write_latency",
|
||||||
&write_latency) < 0)
|
&write_latency) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
initPath = g_strdup_printf("%s/initiators", path);
|
initPath = g_strdup_printf("%s/initiators", path);
|
||||||
|
@ -1765,7 +1765,7 @@ virNumaCacheFormat(virBuffer *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(&childBuf,
|
virBufferAsprintf(&childBuf,
|
||||||
"<size value='%u' unit='KiB'/>\n",
|
"<size value='%llu' unit='KiB'/>\n",
|
||||||
cache->size);
|
cache->size);
|
||||||
|
|
||||||
if (cache->line) {
|
if (cache->line) {
|
||||||
|
@ -263,7 +263,7 @@ void virNumaDistanceFormat(virBuffer *buf,
|
|||||||
typedef struct _virNumaCache virNumaCache;
|
typedef struct _virNumaCache virNumaCache;
|
||||||
struct _virNumaCache {
|
struct _virNumaCache {
|
||||||
unsigned int level; /* cache level */
|
unsigned int level; /* cache level */
|
||||||
unsigned int size; /* cache size */
|
unsigned long long size; /* cache size */
|
||||||
unsigned int line; /* line size, !!! in bytes !!! */
|
unsigned int line; /* line size, !!! in bytes !!! */
|
||||||
virNumaCacheAssociativity associativity; /* cache associativity */
|
virNumaCacheAssociativity associativity; /* cache associativity */
|
||||||
virNumaCachePolicy policy; /* cache policy */
|
virNumaCachePolicy policy; /* cache policy */
|
||||||
|
Loading…
Reference in New Issue
Block a user