aboutsummaryrefslogtreecommitdiff
path: root/numa.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2014-06-26 18:33:20 -0300
committerMichael S. Tsirkin <mst@redhat.com>2014-06-29 18:59:42 +0300
commit12d6e4640ce28d002e96d58c31cd5e7256258626 (patch)
treecf38fc26edc92e24b46dde96a7245d984ba09060 /numa.c
parent1945b9d8b03aad59e86bfe3a3194e6bbeffbad6a (diff)
downloadqemu-12d6e4640ce28d002e96d58c31cd5e7256258626.zip
qemu-12d6e4640ce28d002e96d58c31cd5e7256258626.tar.gz
qemu-12d6e4640ce28d002e96d58c31cd5e7256258626.tar.bz2
numa: Reject configuration if not all node IDs are present
We don't support sparse NUMA node IDs yet, so this changes QEMU to reject configs where not all nodes are present. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/numa.c b/numa.c
index c254127..2fde740 100644
--- a/numa.c
+++ b/numa.c
@@ -160,9 +160,24 @@ error:
void set_numa_nodes(void)
{
+ int i;
+
+ assert(max_numa_nodeid <= MAX_NODES);
+
+ /* No support for sparse NUMA node IDs yet: */
+ for (i = max_numa_nodeid - 1; i >= 0; i--) {
+ /* Report large node IDs first, to make mistakes easier to spot */
+ if (!numa_info[i].present) {
+ error_report("numa: Node ID missing: %d", i);
+ exit(1);
+ }
+ }
+
+ /* This must be always true if all nodes are present: */
+ assert(nb_numa_nodes == max_numa_nodeid);
+
if (nb_numa_nodes > 0) {
uint64_t numa_total;
- int i;
if (nb_numa_nodes > MAX_NODES) {
nb_numa_nodes = MAX_NODES;