“4609d029aa8a2c7e0ad71e329c6e3493e1e95040”上不存在“drivers/platform/x86/acer-wmi.c”
提交 628c9357 编写于 作者: D Daniel P. Berrange

Fix handling of sparse NUMA topologies

When finding a sparse NUMA topology, libnuma will return ENOENT
the first time it is invoked. On subsequent invocations it
will return success, but with an all-1's CPU mask. Check for
this, to avoid polluting the capabilities XML with 4096 bogus
CPUs

* src/nodeinfo.c: Check for all-1s CPU mask
上级 ac7baddf
...@@ -361,6 +361,7 @@ nodeCapsInitNUMA(virCapsPtr caps) ...@@ -361,6 +361,7 @@ nodeCapsInitNUMA(virCapsPtr caps)
{ {
int n; int n;
unsigned long *mask = NULL; unsigned long *mask = NULL;
unsigned long *allonesmask = NULL;
int *cpus = NULL; int *cpus = NULL;
int ret = -1; int ret = -1;
int max_n_cpus = NUMA_MAX_N_CPUS; int max_n_cpus = NUMA_MAX_N_CPUS;
...@@ -371,13 +372,23 @@ nodeCapsInitNUMA(virCapsPtr caps) ...@@ -371,13 +372,23 @@ nodeCapsInitNUMA(virCapsPtr caps)
int mask_n_bytes = max_n_cpus / 8; int mask_n_bytes = max_n_cpus / 8;
if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof *mask) < 0) if (VIR_ALLOC_N(mask, mask_n_bytes / sizeof *mask) < 0)
goto cleanup; goto cleanup;
if (VIR_ALLOC_N(allonesmask, mask_n_bytes / sizeof *mask) < 0)
goto cleanup;
memset(allonesmask, 0xff, mask_n_bytes);
for (n = 0 ; n <= numa_max_node() ; n++) { for (n = 0 ; n <= numa_max_node() ; n++) {
int i; int i;
int ncpus; int ncpus;
/* The first time this returns -1, ENOENT if node doesn't exist... */
if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0) { if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0) {
VIR_WARN("NUMA topology for cell %d of %d not available, ignoring", VIR_WARN("NUMA topology for cell %d of %d not available, ignoring",
n, numa_max_node()); n, numa_max_node()+1);
continue;
}
/* second, third... times it returns an all-1's mask */
if (memcmp(mask, allonesmask, mask_n_bytes) == 0) {
VIR_DEBUG("NUMA topology for cell %d of %d is all ones, ignoring",
n, numa_max_node()+1);
continue; continue;
} }
...@@ -406,6 +417,7 @@ nodeCapsInitNUMA(virCapsPtr caps) ...@@ -406,6 +417,7 @@ nodeCapsInitNUMA(virCapsPtr caps)
cleanup: cleanup:
VIR_FREE(cpus); VIR_FREE(cpus);
VIR_FREE(mask); VIR_FREE(mask);
VIR_FREE(allonesmask);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册