mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
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>
This commit is contained in:
parent
ba1ba5cca3
commit
79e0793614
5 changed files with 28 additions and 26 deletions
|
@ -123,6 +123,9 @@ typedef struct {
|
|||
* Returns an array of @CPUArchId architecture-dependent CPU IDs
|
||||
* which includes CPU IDs for present and possible to hotplug CPUs.
|
||||
* Caller is responsible for freeing returned list.
|
||||
* @get_default_cpu_node_id:
|
||||
* returns default board specific node_id value for CPU slot specified by
|
||||
* index @idx in @ms->possible_cpus[]
|
||||
* @has_hotpluggable_cpus:
|
||||
* If true, board supports CPUs creation with -device/device_add.
|
||||
* @default_cpu_type:
|
||||
|
@ -196,6 +199,7 @@ struct MachineClass {
|
|||
CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,
|
||||
unsigned cpu_index);
|
||||
const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
|
||||
int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue