From nobody Sun Feb 8 22:34:49 2026 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494415977263770.9968602086376; Wed, 10 May 2017 04:32:57 -0700 (PDT) Received: from localhost ([::1]:41924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8PrS-000164-J3 for importer@patchew.org; Wed, 10 May 2017 07:32:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8Pp6-0007Zb-53 for qemu-devel@nongnu.org; Wed, 10 May 2017 07:30:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8Pp5-0001jB-4a for qemu-devel@nongnu.org; Wed, 10 May 2017 07:30:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8Pp2-0001hp-AK; Wed, 10 May 2017 07:30:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E47D80C0B; Wed, 10 May 2017 11:30:23 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48BEB7DFF5; Wed, 10 May 2017 11:30:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3E47D80C0B Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=imammedo@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3E47D80C0B From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 10 May 2017 13:29:49 +0200 Message-Id: <1494415802-227633-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1494415802-227633-1-git-send-email-imammedo@redhat.com> References: <1494415802-227633-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 10 May 2017 11:30:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 05/18] numa: add check that board supports cpu_index to node mapping 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: Peter Maydell , Andrew Jones , Eduardo Habkost , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Shannon Zhao , Paolo Bonzini , David Gibson 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" Default node mapping initialization already checks that board supports cpu_index to node mapping and refuses to start if it's not supported. Do the same for explicitly provided mapping "-numa node,cpus=3D..." Signed-off-by: Igor Mammedov Reviewed-by: Andrew Jones Reviewed-by: David Gibson --- v3: - amend erre msg to print: "NUMA is not supported by this machine-type" (Eduardo) --- numa.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/numa.c b/numa.c index bcdfca2..7182481 100644 --- a/numa.c +++ b/numa.c @@ -141,10 +141,12 @@ uint32_t numa_get_node(ram_addr_t addr, Error **errp) return -1; } =20 -static void parse_numa_node(NumaNodeOptions *node, QemuOpts *opts, Error *= *errp) +static void parse_numa_node(MachineState *ms, NumaNodeOptions *node, + QemuOpts *opts, Error **errp) { uint16_t nodenr; uint16List *cpus =3D NULL; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 if (node->has_nodeid) { nodenr =3D node->nodeid; @@ -163,6 +165,10 @@ static void parse_numa_node(NumaNodeOptions *node, Qem= uOpts *opts, Error **errp) return; } =20 + if (!mc->cpu_index_to_instance_props) { + error_report("NUMA is not supported by this machine-type"); + exit(1); + } for (cpus =3D node->cpus; cpus; cpus =3D cpus->next) { if (cpus->value >=3D max_cpus) { error_setg(errp, @@ -253,6 +259,7 @@ static void parse_numa_distance(NumaDistOptions *dist, = Error **errp) static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) { NumaOptions *object =3D NULL; + MachineState *ms =3D opaque; Error *err =3D NULL; =20 { @@ -267,7 +274,7 @@ static int parse_numa(void *opaque, QemuOpts *opts, Err= or **errp) =20 switch (object->type) { case NUMA_OPTIONS_TYPE_NODE: - parse_numa_node(&object->u.node, opts, &err); + parse_numa_node(ms, &object->u.node, opts, &err); if (err) { goto end; } @@ -452,7 +459,7 @@ void parse_numa_opts(MachineState *ms) numa_info[i].node_cpu =3D bitmap_new(max_cpus); } =20 - if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, NULL, NULL))= { + if (qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, NULL)) { exit(1); } =20 --=20 2.7.4