|
|
edecca |
From fb4e8466ec0adc6e0aee55ab34e60e88d365d5de Mon Sep 17 00:00:00 2001
|
|
|
edecca |
Message-Id: <fb4e8466ec0adc6e0aee55ab34e60e88d365d5de@dist-git>
|
|
|
edecca |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
edecca |
Date: Wed, 15 Aug 2018 14:04:43 +0200
|
|
|
edecca |
Subject: [PATCH] utils: Remove arbitrary limit on socket_id/core_id
|
|
|
edecca |
|
|
|
edecca |
While in most cases the values are going to be much
|
|
|
edecca |
smaller than our arbitrary 4096 limit, there is really
|
|
|
edecca |
no guarantee that would be the case: in fact, a few
|
|
|
edecca |
aarch64 servers have been spotted in the wild with
|
|
|
edecca |
core_id as high as 6216.
|
|
|
edecca |
|
|
|
edecca |
Take advantage of virBitmap's ability to automatically
|
|
|
edecca |
alter its size at runtime to accomodate such values.
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
edecca |
(cherry picked from commit ba35ac2ebbc7f94abc50ffbf1d681458e2406444)
|
|
|
edecca |
|
|
|
edecca |
https://bugzilla.redhat.com/show_bug.cgi?id=1608479
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
edecca |
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
edecca |
---
|
|
|
edecca |
src/util/virhostcpu.c | 23 ++++-------------------
|
|
|
edecca |
1 file changed, 4 insertions(+), 19 deletions(-)
|
|
|
edecca |
|
|
|
edecca |
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
|
|
|
edecca |
index b644398e00..1e31be5900 100644
|
|
|
edecca |
--- a/src/util/virhostcpu.c
|
|
|
edecca |
+++ b/src/util/virhostcpu.c
|
|
|
edecca |
@@ -294,9 +294,6 @@ virHostCPUParseNode(const char *node,
|
|
|
edecca |
int *threads,
|
|
|
edecca |
int *offline)
|
|
|
edecca |
{
|
|
|
edecca |
- /* Biggest value we can expect to be used as either socket id
|
|
|
edecca |
- * or core id. Bitmaps will need to be sized accordingly */
|
|
|
edecca |
- const int ID_MAX = 4095;
|
|
|
edecca |
int ret = -1;
|
|
|
edecca |
int processors = 0;
|
|
|
edecca |
DIR *cpudir = NULL;
|
|
|
edecca |
@@ -325,7 +322,7 @@ virHostCPUParseNode(const char *node,
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
/* enumerate sockets in the node */
|
|
|
edecca |
- if (!(sockets_map = virBitmapNew(ID_MAX + 1)))
|
|
|
edecca |
+ if (!(sockets_map = virBitmapNewEmpty()))
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
while ((direrr = virDirRead(cpudir, &cpudirent, node)) > 0) {
|
|
|
edecca |
@@ -344,14 +341,8 @@ virHostCPUParseNode(const char *node,
|
|
|
edecca |
|
|
|
edecca |
if (virHostCPUGetSocket(cpu, &sock) < 0)
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
- if (sock > ID_MAX) {
|
|
|
edecca |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
edecca |
- _("Socket %d can't be handled (max socket is %d)"),
|
|
|
edecca |
- sock, ID_MAX);
|
|
|
edecca |
- goto cleanup;
|
|
|
edecca |
- }
|
|
|
edecca |
|
|
|
edecca |
- if (virBitmapSetBit(sockets_map, sock) < 0)
|
|
|
edecca |
+ if (virBitmapSetBitExpand(sockets_map, sock) < 0)
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
if (sock > sock_max)
|
|
|
edecca |
@@ -368,7 +359,7 @@ virHostCPUParseNode(const char *node,
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
for (i = 0; i < sock_max; i++)
|
|
|
edecca |
- if (!(cores_maps[i] = virBitmapNew(ID_MAX + 1)))
|
|
|
edecca |
+ if (!(cores_maps[i] = virBitmapNewEmpty()))
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
/* Iterate over all CPUs in the node, in ascending order */
|
|
|
edecca |
@@ -412,14 +403,8 @@ virHostCPUParseNode(const char *node,
|
|
|
edecca |
if (virHostCPUGetCore(cpu, &core) < 0)
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
}
|
|
|
edecca |
- if (core > ID_MAX) {
|
|
|
edecca |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
edecca |
- _("Core %d can't be handled (max core is %d)"),
|
|
|
edecca |
- core, ID_MAX);
|
|
|
edecca |
- goto cleanup;
|
|
|
edecca |
- }
|
|
|
edecca |
|
|
|
edecca |
- if (virBitmapSetBit(cores_maps[sock], core) < 0)
|
|
|
edecca |
+ if (virBitmapSetBitExpand(cores_maps[sock], core) < 0)
|
|
|
edecca |
goto cleanup;
|
|
|
edecca |
|
|
|
edecca |
if (!(siblings = virHostCPUCountThreadSiblings(cpu)))
|
|
|
edecca |
--
|
|
|
edecca |
2.18.0
|
|
|
edecca |
|