qemu-e2k/hw/core
Igor Mammedov 79e0793614 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>
2017-09-19 16:51:33 -03:00
..
Makefile.objs hw/core: nmi.c can be compiled as common-obj nowadays 2017-06-05 17:23:36 +03:00
bus.c bus: do not unref hotplug handler 2017-03-01 11:51:28 +04:00
empty_slot.c hw/core: Clean up includes 2016-01-29 15:07:25 +00:00
fw-path-provider.c hw/core: Clean up includes 2016-01-29 15:07:25 +00:00
generic-loader.c hw/core/generic-loader: Fix crash when running without CPU 2017-05-10 10:19:23 +03:00
hotplug.c qdev: hotplug: drop HotplugHandler.post_plug callback 2016-11-15 17:20:37 +02:00
irq.c tcg: drop global lock during TCG code execution 2017-02-24 10:32:45 +00:00
loader-fit.c loader: Support Flattened Image Trees (FIT images) 2017-02-21 23:47:40 +00:00
loader.c fw_cfg: rename read callback 2017-09-08 16:15:17 +03:00
machine.c numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed 2017-09-19 16:51:33 -03:00
nmi.c nmi: remove x86 specific nmi handling 2016-05-23 16:53:46 +02:00
null-machine.c hw/core/null-machine: Print error message when using the -kernel parameter 2017-04-20 15:22:41 -03:00
or-irq.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
platform-bus.c platform-bus: use get_uint() for "addr" property 2017-06-20 14:31:32 +02:00
ptimer.c qemu-timer: do not include sysemu/cpus.h from util/qemu-timer.h 2017-03-14 13:28:18 +01:00
qdev-properties-system.c qdev: Add const qualifier to PropertyInfo definitions 2017-07-14 12:04:42 +02:00
qdev-properties.c qapi: Change data type of the FOO_lookup generated for enum FOO 2017-09-04 13:09:13 +02:00
qdev.c qdev: support properties which don't set a default value 2017-07-17 13:36:06 +01:00
register.c register: display register prefix (name) since it is available 2017-06-04 18:42:55 +03:00
reset.c hw: move reset handlers from vl.c to hw/core 2017-01-16 17:52:35 +01:00
stream.c hw/core: Clean up includes 2016-01-29 15:07:25 +00:00
sysbus.c sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE 2017-05-17 10:37:01 -03:00
uboot_image.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00