]> git.proxmox.com Git - mirror_qemu.git/commit
numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
authorIgor Mammedov <imammedo@redhat.com>
Thu, 1 Jun 2017 10:53:28 +0000 (12:53 +0200)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 19 Sep 2017 19:51:33 +0000 (16:51 -0300)
commit79e0793614fcd6b5674fa96180b66971c37d1dfd
tree6e5ea5fbd24dc2d96fb60c6a200e7ce729d7f1a3
parentba1ba5cca3962a9cc400c713c736b4fb8db1f38e
numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed

Calculating default node-ids for CPUs in possible_cpu_arch_ids()
is rather fragile since defaults calculation uses nb_numa_nodes but
callback might be potentially called early before all -numa CLI
options are parsed, which would lead to cpus assigned only upto
nb_numa_nodes at the time possible_cpu_arch_ids() is called.

Issue was introduced by
(7c88e65 numa: mirror cpu to node mapping in MachineState::possible_cpus)
and for example CLI:
  -smp 4 -numa node,cpus=0 -numa node
would set props.node-id in possible_cpus array for every non
explicitly mapped CPU to the first node.

Issue is not visible to guest nor to mgmt interface due to
  1) implictly mapped cpus are forced to the first node in
     case of partial mapping
  2) in case of default mapping possible_cpu_arch_ids() is
     called after all -numa options are parsed (resulting
     in correct mapping).

However it's fragile to rely on late execution of
possible_cpu_arch_ids(), therefore add machine specific
callback that returns node-id for CPU and use it to calculate/
set defaults at machine_numa_finish_init() time when all -numa
options are parsed.

Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1496314408-163972-1-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
hw/arm/virt.c
hw/core/machine.c
hw/i386/pc.c
hw/ppc/spapr.c
include/hw/boards.h