[libvirt] conf: Allow > UINT_MAX of cache for NUMA nodes
Michal Prívozník
mprivozn at redhat.com
Tue Nov 8 08:52:21 UTC 2022
On 11/5/22 01:20, Lin Yang wrote:
> 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 at intel.com>
> ---
> src/conf/capabilities.c | 70 +++++++++++++++++++++++++++--------------
> src/conf/numa_conf.c | 2 +-
> src/conf/numa_conf.h | 2 +-
> 3 files changed, 48 insertions(+), 26 deletions(-)
>
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index e498c77efc..85c06f0d2b 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -1549,10 +1549,10 @@ virCapabilitiesGetNUMAPagesInfo(int node,
>
>
> static int
> -virCapabilitiesGetNodeCacheReadFile(const char *prefix,
> - const char *dir,
> - const char *file,
> - unsigned int *value)
> +virCapabilitiesGetNodeCacheReadFileUint(const char *prefix,
> + const char *dir,
> + const char *file,
> + unsigned int *value)
> {
> g_autofree char *path = g_build_filename(prefix, dir, file, NULL);
> 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
> virCapsHostNUMACellCacheComparator(const void *a,
> const void *b)
> @@ -1612,18 +1634,18 @@ virCapabilitiesGetNodeCache(int node,
> return -1;
> }
>
> - if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name,
> - "size", &cache.size) < 0)
> + if (virCapabilitiesGetNodeCacheReadFileUllong(path, entry->d_name,
> + "size", &cache.size) < 0)
Ah, correct. Even kernel formats this as %llu (from drivers/base/node.c):
CACHE_ATTR(size, "%llu")
CACHE_ATTR(line_size, "%u")
CACHE_ATTR(indexing, "%u")
CACHE_ATTR(write_policy, "%u")
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
and pushed.
Michal
More information about the libvir-list
mailing list