numa: we don't implement NUMA for s390x
PATCH v3 1/1 numa: we don't implement NUMA for s390x
Right now it is possible to crash QEMU for s390x by providing e.g.
-numa node,nodeid=0,cpus=0-1
Problem is, that numa.c uses mc->cpu_index_to_instance_props as an indicator whether NUMA is supported by a machine type. We don't implement NUMA for s390x ("topology") yet. However we need mc->cpu_index_to_instance_props for query-cpus.
So let's fix this case by also checking for mc->get_default_cpu_node_id, which will be needed by machine_set_cpu_numa_node().
qemu-system-s390x: -numa node,nodeid=0,cpus=0-1: NUMA is not supported by
this machine-type
While at it, make s390_cpu_index_to_props() look like on other architectures.
--- hw/s390x/s390-virtio-ccw.c | 8 +++++--- numa.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
hw/s390x/s390-virtio-ccw.c +5 -3
@@ -388,12 +388,14 @@ static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev, } } -static CpuInstanceProperties s390_cpu_index_to_props (MachineState *machine, +static CpuInstanceProperties s390_cpu_index_to_props (MachineState *ms,unsigned cpu_index) { -g_assert (machine->possible_cpus && cpu_index < machine->possible_cpus->len); +MachineClass *mc =MACHINE_GET_CLASS (ms); +const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids (ms); -return machine->possible_cpus->cpus[cpu_index].props; +assert (cpu_index < possible_cpus->len); +return possible_cpus->cpus[cpu_index].props; }static const CPUArchIdList *s390_possible_cpu_arch_ids (MachineState *ms)
numa.c +1 -1
@@ -80,7 +80,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,return ; } -if (!mc->cpu_index_to_instance_props) { +if (!mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id) {error_report ("NUMA is not supported by this machine-type" );exit (1 ); }
Signature · 1 line
2.14.3
Quoted 11 lines · David Hildenbrand
Right now it is possible to crash QEMU for s390x by providing e.g.
-numa node,nodeid=0,cpus=0-1Problem is, that
numa.cusesmc->cpu_index_to_instance_propsas an indicator whether NUMA is supported by a machine type. We don't implement NUMA for s390x ("topology") yet. However we needmc->cpu_index_to_instance_propsfor query-cpus.So let's fix this case by also checking for
mc->get_default_cpu_node_id, which will be needed bymachine_set_cpu_numa_node().
Quoted 7 lines
qemu-system-s390x: -numa node,nodeid=0,cpus=0-1: NUMA is not supported by
this machine-typeWhile at it, make
s390_cpu_index_to_props()look like on other architectures.Signed-off-by David Hildenbrand <[email protected]>
Quoted 41 lines
--- hw/s390x/s390-virtio-ccw.c | 8 +++++--- numa.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)hw/s390x/s390-virtio-ccw.c +5
-3@@ -388,12 +388,14 @@ static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev, } } -static CpuInstanceProperties s390_cpu_index_to_props (MachineState *machine, +static CpuInstanceProperties s390_cpu_index_to_props (MachineState *ms,unsigned cpu_index) { -g_assert (machine->possible_cpus && cpu_index < machine->possible_cpus->len); +MachineClass *mc =MACHINE_GET_CLASS (ms); +const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids (ms); -return machine->possible_cpus->cpus[cpu_index].props; +assert (cpu_index < possible_cpus->len); +return possible_cpus->cpus[cpu_index].props; }static const CPUArchIdList *s390_possible_cpu_arch_ids (MachineState *ms)numa.c +1
-1@@ -80,7 +80,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,return ; } -if (!mc->cpu_index_to_instance_props) { +if (!mc->cpu_index_to_instance_props || !mc->get_default_cpu_node_id) {error_report ("NUMA is not supported by this machine-type" );exit (1 ); }
Cornelia Huck
AppliedQuoted 14 lines · On Tue, 27 Feb 2018 12:02:55 +0100 David Hildenbrand <[email protected]> wrote:
Right now it is possible to crash QEMU for s390x by providing e.g.
-numa node,nodeid=0,cpus=0-1Problem is, that
numa.cusesmc->cpu_index_to_instance_propsas an indicator whether NUMA is supported by a machine type. We don't implement NUMA for s390x ("topology") yet. However we needmc->cpu_index_to_instance_propsfor query-cpus.So let's fix this case by also checking for
mc->get_default_cpu_node_id, which will be needed bymachine_set_cpu_numa_node().qemu-system-s390x: -numa node,nodeid=0,cpus=0-1: NUMA is not supported by
this machine-type
Quoted 8 lines
While at it, make
s390_cpu_index_to_props()look like on other architectures.Signed-off-by David Hildenbrand <[email protected]>--- hw/s390x/s390-virtio-ccw.c | 8 +++++--- numa.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
Thanks, applied.