From nobody Fri Oct 24 21:59:52 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518785223352392.5329422976629; Fri, 16 Feb 2018 04:47:03 -0800 (PST) Received: from localhost ([::1]:44830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emfPq-0002hg-Jq for importer@patchew.org; Fri, 16 Feb 2018 07:47:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emfI7-0004TH-5w for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:39:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emfI6-0003bW-6m for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:39:03 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33986 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 1emfI6-0003bP-2L for qemu-devel@nongnu.org; Fri, 16 Feb 2018 07:39:02 -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 9B83C407519B; Fri, 16 Feb 2018 12:39:01 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5467EAF033; Fri, 16 Feb 2018 12:39:00 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 13:37:20 +0100 Message-Id: <1518784641-43151-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1518784641-43151-1-git-send-email-imammedo@redhat.com> References: <1518784641-43151-1-git-send-email-imammedo@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.7]); Fri, 16 Feb 2018 12:39:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Feb 2018 12:39:01 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'imammedo@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 v3 8/9] QMP: add set-numa-node command 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@linaro.org, pkrempa@redhat.com, ehabkost@redhat.com, cohuck@redhat.com, armbru@redhat.com, pbonzini@redhat.com, david@gibson.dropbear.id.au 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" Command is allowed to run only in preconfig stage and will allow to configure numa mapping for CPUs depending on possible CPUs layout (query-hotpluggable-cpus) for given machine instance. Signed-off-by: Igor Mammedov --- numa.c | 5 +++++ qapi-schema.json | 14 ++++++++++++++ tests/qmp-test.c | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/numa.c b/numa.c index 04e34eb..e3b7f15 100644 --- a/numa.c +++ b/numa.c @@ -446,6 +446,11 @@ void parse_numa_opts(MachineState *ms) } } =20 +void qmp_set_numa_node(NumaOptions *cmd, Error **errp) +{ + parse_NumaOptions(MACHINE(qdev_get_machine()), cmd, errp); +} + void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **er= rp) { int node_id =3D object_property_get_int(OBJECT(dev), "node-id", &error= _abort); diff --git a/qapi-schema.json b/qapi-schema.json index 4365dfe..a96c31f 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3201,3 +3201,17 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @set-numa-node: +# +# Runtime equivalent of '-numa' CLI option, available at +# preconfigure stage to configure numa mapping before initializing +# machine. +# +# Since 2.12 +## +{ 'command': 'set-numa-node', 'boxed': true, + 'data': 'NumaOptions', + 'runstates': [ 'preconfig' ] +} diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 4ab0b7c..b0de2b1 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -324,6 +324,8 @@ static void test_qmp_preconfig(void) /* enabled commands, no error expected */ g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-commands' }"))); g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-hotpluggable-cpus'= }"))); + g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node'," + " 'arguments': { 'type': 'node', 'nodeid': 0 } }"))); =20 /* forbidden commands, expected error */ g_assert(is_err(qtest_qmp(qs, "{ 'execute': 'query-cpus' }"))); @@ -347,6 +349,10 @@ static void test_qmp_preconfig(void) /* enabled commands, no error expected */ g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-cpus' }"))); =20 + /* forbidden commands, expected error */ + g_assert(is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node'," + " 'arguments': { 'type': 'node', 'nodeid': 1 } }"))); + qtest_quit(qs); } =20 --=20 2.7.4