On Thu, Feb 12, 2015 at 07:22:37PM +0100, Paolo Bonzini wrote:
> On 12/02/2015 18:50, Eduardo Habkost wrote:
> > +
> > + if (!bitmap_full(seen_cpus, max_cpus)) {
> > + char *msg;
> > + bitmap_complement(seen_cpus, seen_cpus, max_cpus);
> > + msg = enumerate_cpus(seen_cpus, max_cpus);
> > + error_report("warning: CPU(s) not present in any NUMA nodes: %s",
> > msg);
> > + g_free(msg);
> > + }
>
> What happens if you have a single node (useful to give it a memdev via
> -numa node,memdev=...)? It would be nice in this case to avoid the
> warning and assign all CPUs to node 0.
The existing code at set_numa_nodes()/parse_numa_opts() should already do what
you suggest when we have only one node:
for (i = 0; i < nb_numa_nodes; i++) {
if (!bitmap_empty(numa_info[i].node_cpu, MAX_CPUMASK_BITS)) {
break;
}
}
/* assigning the VCPUs round-robin is easier to implement, guest OSes
* must cope with this anyway, because there are BIOSes out there in
* real machines which also use this scheme.
*/
if (i == nb_numa_nodes) {
for (i = 0; i < max_cpus; i++) {
set_bit(i, numa_info[i % nb_numa_nodes].node_cpu);
}
}
I don't like how it ignores socket topology, but it is good enough for the
one-node case, at least.
--
Eduardo