* [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x
@ 2018-02-27 11:02 David Hildenbrand
2018-02-27 11:43 ` Christian Borntraeger
2018-03-06 10:11 ` Cornelia Huck
0 siblings, 2 replies; 3+ messages in thread
From: David Hildenbrand @ 2018-02-27 11:02 UTC (permalink / raw)
To: qemu-s390x
Cc: qemu-devel, Eduardo Habkost, Cornelia Huck, Christian Borntraeger,
David Hildenbrand
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.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
hw/s390x/s390-virtio-ccw.c | 8 +++++---
numa.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 4abbe89847..1eff4a6274 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -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)
diff --git a/numa.c b/numa.c
index 7e0e789b02..103b93f5cb 100644
--- a/numa.c
+++ b/numa.c
@@ -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);
}
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x
2018-02-27 11:02 [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x David Hildenbrand
@ 2018-02-27 11:43 ` Christian Borntraeger
2018-03-06 10:11 ` Cornelia Huck
1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2018-02-27 11:43 UTC (permalink / raw)
To: David Hildenbrand, qemu-s390x; +Cc: qemu-devel, Eduardo Habkost, Cornelia Huck
On 02/27/2018 12:02 PM, David Hildenbrand wrote:
> 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.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> hw/s390x/s390-virtio-ccw.c | 8 +++++---
> numa.c | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 4abbe89847..1eff4a6274 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -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)
> diff --git a/numa.c b/numa.c
> index 7e0e789b02..103b93f5cb 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -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);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x
2018-02-27 11:02 [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x David Hildenbrand
2018-02-27 11:43 ` Christian Borntraeger
@ 2018-03-06 10:11 ` Cornelia Huck
1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2018-03-06 10:11 UTC (permalink / raw)
To: David Hildenbrand
Cc: qemu-s390x, qemu-devel, Eduardo Habkost, Christian Borntraeger
On Tue, 27 Feb 2018 12:02:55 +0100
David Hildenbrand <david@redhat.com> wrote:
> 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.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> hw/s390x/s390-virtio-ccw.c | 8 +++++---
> numa.c | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
Thanks, applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-06 10:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 11:02 [Qemu-devel] [PATCH v3] numa: we don't implement NUMA for s390x David Hildenbrand
2018-02-27 11:43 ` Christian Borntraeger
2018-03-06 10:11 ` Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).