On Fri, 8 Jul 2016 14:04:23 +0200 Peter Krempa <pkre...@redhat.com> wrote:
> On Fri, Jul 08, 2016 at 13:54:58 +0200, Igor Mammedov wrote: > > On Thu, 7 Jul 2016 17:17:14 +0200 > > Peter Krempa <pkre...@redhat.com> wrote: > > > > > Add a helper that looks up the NUMA node for a given CPU and use it to > > > fill the node_id in the PPC and X86 impls of query-hotpluggable-cpus. > > > > > > Signed-off-by: Peter Krempa <pkre...@redhat.com> > > > --- > > > hw/i386/pc.c | 7 +++++++ > > > hw/ppc/spapr.c | 8 ++++++-- > > > include/sysemu/numa.h | 1 + > > > numa.c | 13 +++++++++++++ > > > 4 files changed, 27 insertions(+), 2 deletions(-) > > > > > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > > > index 4ba02c4..a0b9507 100644 > > > --- a/hw/i386/pc.c > > > +++ b/hw/i386/pc.c > > > @@ -2115,6 +2115,7 @@ static HotpluggableCPUList > > > *pc_query_hotpluggable_cpus(MachineState *machine) > > > HotpluggableCPUList *head = NULL; > > > PCMachineState *pcms = PC_MACHINE(machine); > > > const char *cpu_type; > > > + int node_id; > > > > > > cpu = pcms->possible_cpus->cpus[0].cpu; > > > assert(cpu); /* BSP is always present */ > > > @@ -2138,6 +2139,12 @@ static HotpluggableCPUList > > > *pc_query_hotpluggable_cpus(MachineState *machine) > > > cpu_props->core_id = topo.core_id; > > > cpu_props->has_thread_id = true; > > > cpu_props->thread_id = topo.smt_id; > > > + > > > + if ((node_id = numa_node_get_by_cpu_index(i)) >= 0) { > > > + cpu_props->has_node_id = true; > > > + cpu_props->node_id = node_id; > > > + } > > I've not included node_id for a reason, > > "-numa cpus=1,2,3..." looks to me hopelessly broken now but > > I've not came up with an idea how to redo it in nice and clean way yet. > > > > Alternative could be CLI-less numa configuration, where QEMU is started > > without "-numa cpus" but with "-S" then mgmt could call > > query_hotpluggable_cpus() to get possible CPUs and then > > map them to numa nodes with a new QMP command using attributes > > it got from query_hotpluggable_cpus(). > > I think this could work for libvirt. The CPU index we currently expose > in the XML would become just a libvirt internal detail and the new QMP > command would be used to do the setup. Adding some QMP calls during VM > startup is okay. > > > it's along the way start QEMU -smp 1,maxcpus=X and then add > > remaining CPUs with device_add after getting properties from > > query_hotpluggable_cpus(). > > I'm going to use a similar approach even for the hotpluggable cpus so I > can query the data for a new VM. On the other hand I can't make libvirt > use the approach with -smp 1,... all the time since we guarantee that a > XML that worked on a older version will be migratable back to the older > version. Could you explain a little bit more about issue? > > > then at machine_done time we can adjust DT/ACPI data to reflect > > configured mapping. > > In such case this series can be dropped since it provides what I need > differently. > > Thanks, > > Peter >