From nobody Wed Oct 22 15:02:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519726624068514.6711869020247; Tue, 27 Feb 2018 02:17:04 -0800 (PST) Received: from localhost ([::1]:35976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqcJa-00051M-6p for importer@patchew.org; Tue, 27 Feb 2018 05:16:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqcI9-0004EF-VE for qemu-devel@nongnu.org; Tue, 27 Feb 2018 05:15:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqcI3-0006CU-9y for qemu-devel@nongnu.org; Tue, 27 Feb 2018 05:15:25 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39384 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqcI3-0006C4-5P; Tue, 27 Feb 2018 05:15:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7897EAEA0; Tue, 27 Feb 2018 10:15:08 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 862D71C734; Tue, 27 Feb 2018 10:14:59 +0000 (UTC) From: David Hildenbrand To: qemu-s390x@nongnu.org Date: Tue, 27 Feb 2018 11:14:58 +0100 Message-Id: <20180227101458.13750-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Feb 2018 10:15:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Feb 2018 10:15:08 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2] numa: we don't implement NUMA for s390x X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , Cornelia Huck , David Hildenbrand , qemu-devel@nongnu.org, Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now it is possible to crash QEMU for s390x by providing e.g. -numa node,nodeid=3D0,cpus=3D0-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=3D0,cpus=3D0-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 --- hw/s390x/s390-virtio-ccw.c | 6 ++++-- numa.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 4abbe89847..9b402eebde 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -391,9 +391,11 @@ static void s390_machine_device_unplug_request(Hotplug= Handler *hotplug_dev, static CpuInstanceProperties s390_cpu_index_to_props(MachineState *machine, unsigned cpu_index) { - g_assert(machine->possible_cpus && cpu_index < machine->possible_cpus-= >len); + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + const CPUArchIdList *possible_cpus =3D mc->possible_cpu_arch_ids(ms); =20 - return machine->possible_cpus->cpus[cpu_index].props; + assert(cpu_index < possible_cpus->len); + return possible_cpus->cpus[cpu_index].props; } =20 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, NumaNodeOpt= ions *node, return; } =20 - 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); } --=20 2.14.3