|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: use xc_topologyinfo to figure out how many CPUs we actually have
# HG changeset patch
# User Darrio Faggioli <raistlin@xxxxxxxx>
# Date 1336736383 -3600
# Node ID 7a4c6481fb38e4e3f859c9dcd9f88d977084e7a9
# Parent 54c8c9eaee9295f2790dc2fbb8f4094c13a4185e
libxl: use xc_topologyinfo to figure out how many CPUs we actually have
Within libxl_get_cpu_topology(), considering all the CPUs the hypervisor
supports to be valid topology entries might lead to misleading and incorrect
behaviours, e.g., the output of `xl info -n' below on a 16 cores machine:
...
cpu_topology :
cpu: core socket node
0: 0 1 0
1: 0 1 0
2: 1 1 0
3: 1 1 0
4: 9 1 0
5: 9 1 0
6: 10 1 0
7: 10 1 0
8: 0 0 1
9: 0 0 1
10: 1 0 1
11: 1 0 1
12: 9 0 1
13: 9 0 1
14: 10 0 1
15: 10 0 1
16: 0 0 0
17: 0 0 0
18: 0 0 0
19: 0 0 0
20: 0 0 0
...
...
62: 0 0 0
63: 0 0 0
However, xc_topologyinfo() tells us (in max_cpu_index) how many entries
arrays it returns corresponds to actually valid CPUs, so let's use that
information.
Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
diff -r 54c8c9eaee92 -r 7a4c6481fb38 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Fri Apr 27 11:09:26 2012 +0200
+++ b/tools/libxl/libxl.c Fri May 11 12:39:43 2012 +0100
@@ -2897,6 +2897,9 @@ libxl_cputopology *libxl_get_cpu_topolog
goto fail;
}
+ if (tinfo.max_cpu_index < max_cpus - 1)
+ max_cpus = tinfo.max_cpu_index + 1;
+
ret = malloc(sizeof(libxl_cputopology) * max_cpus);
if (ret == NULL) {
LIBXL__LOG_ERRNOVAL(ctx, XTL_ERROR, ENOMEM,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |