From patchwork Tue Mar 15 13:24:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 8588361 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D9A6C0553 for ; Tue, 15 Mar 2016 13:24:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A03E120272 for ; Tue, 15 Mar 2016 13:24:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAA22201DD for ; Tue, 15 Mar 2016 13:24:32 +0000 (UTC) Received: from localhost ([::1]:48190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afoxc-0008QB-2I for patchwork-qemu-devel@patchwork.kernel.org; Tue, 15 Mar 2016 09:24:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afoxP-0008NW-F8 for qemu-devel@nongnu.org; Tue, 15 Mar 2016 09:24:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afoxO-0002JR-8N for qemu-devel@nongnu.org; Tue, 15 Mar 2016 09:24:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afoxO-0002JH-0S; Tue, 15 Mar 2016 09:24:18 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 9E4DF7208C; Tue, 15 Mar 2016 13:24:17 +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 int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2FDOBxR003385; Tue, 15 Mar 2016 09:24:15 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 15 Mar 2016 14:24:07 +0100 Message-Id: <1458048248-4605-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1458048248-4605-1-git-send-email-imammedo@redhat.com> References: <1458048248-4605-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 15 Mar 2016 13:24:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: mjrosato@linux.vnet.ibm.com, pkrempa@redhat.com, ehabkost@redhat.com, agraf@suse.de, armbru@redhat.com, borntraeger@de.ibm.com, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, dgibson@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v3 1/2] QMP: add query-hotpluggable-cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP it will allow mgmt to query present and hotpluggable CPU objects, it is required from a target platform that wish to support command to implement qmp_query_hotpluggable_cpus() function, which will return a list of possible CPU objects with options that would be needed for hotplugging possible CPU objects. There are: 'type': 'str' - QOM CPU object type for usage with device_add 'vcpus-count': 'int' - number of logical VCPU threads per CPU object (mgmt needs to know) and a set of optional fields that are to used for hotplugging a CPU objects and would allows mgmt tools to know what/where it could be hotplugged; [node],[socket],[core],[thread] For present CPUs there is a 'qom-path' field which would allow mgmt to inspect whatever object/abstraction the target platform considers as CPU object. Signed-off-by: Igor Mammedov --- v3: - add 'vcpus-count' field, pkrempa@redhat.com - s/CpuInstanceProps/CpuInstanceProperties/ - use '#optional' marker - make "props" as always present even if it's empty - fix JSON examples - fix minor typos --- qapi-schema.json | 41 +++++++++++++++++++++++++++++++++++ qmp-commands.hx | 43 +++++++++++++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/qmp_query_hotpluggable_cpus.c | 9 ++++++++ 4 files changed, 94 insertions(+) create mode 100644 stubs/qmp_query_hotpluggable_cpus.c diff --git a/qapi-schema.json b/qapi-schema.json index 362c9d8..105511d 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4122,3 +4122,44 @@ ## { 'enum': 'ReplayMode', 'data': [ 'none', 'record', 'play' ] } + +## +# CpuInstanceProperties +# +# @node: NUMA node ID the CPU belongs to, optional +# @socket: #optional socket number within node/board the CPU belongs to +# @core: #optional core number within socket the CPU belongs to +# @thread: #optional thread number within core the CPU belongs to +# +# Since: 2.7 +{ 'struct': 'CpuInstanceProperties', + 'data': { '*node': 'int', + '*socket': 'int', + '*core': 'int', + '*thread': 'int' + } +} + +## +# @HotpluggableCPU +# +# @type: CPU object type for usage with device_add command +# @props: list of properties to be used for hotplugging CPU +# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides +# @qom-path: #optional link to existing CPU object if CPU is present or +# omitted if CPU is not present. +# +# Since: 2.7 +{ 'struct': 'HotpluggableCPU', + 'data': { 'type': 'str', + 'vcpus-count': 'int', + 'props': 'CpuInstanceProperties', + '*qom-path': 'str' + } +} + +## +# @query-hotpluggable-cpus +# +# Since: 2.7 +{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] } diff --git a/qmp-commands.hx b/qmp-commands.hx index b629673..41a00b3 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -4853,3 +4853,46 @@ Example: {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840, "pop-vlan": 1, "id": 251658240} ]} + +EQMP + + { + .name = "query-hotpluggable-cpus", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_query_hotpluggable_cpus, + }, + +SQMP +Show existing/possible CPUs +------------------------------- + +Arguments: None. + +Example for x86 target started with -smp 2,sockets=2,cores=1,threads=3,maxcpus=6: + +-> { "execute": "query-hotpluggable-cpus" } +<- {"return": [ + { "props": { "core": 0, "socket": 1, "thread": 2}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1 }, + { "props": { "core": 0, "socket": 1, "thread": 1}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1 }, + { "props": { "core": 0, "socket": 1, "thread": 0}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1 }, + { "props": { "core": 0, "socket": 0, "thread": 2}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1 }, + { "props": { "core": 0, "socket": 0, "thread": 1}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1, + "qom-path": "/machine/unattached/device[3]"}, + { "props": { "core": 0, "socket": 0, "thread": 0}, + "type": "qemu64-x86_64-cpu", "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]"} + ]}' + +Example for SPAPR target started with -smp 2,cores=2,maxcpus=4: + +-> { "execute": "query-hotpluggable-cpus" } +<- {"return": [ + { "props": { "core": 1 }, "type": "spapr-cpu-core", "vcpus-count": 1 }, + { "props": { "core": 0 }, "type": "spapr-cpu-core", "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]"} + ]}' diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index e922de9..0011173 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -39,3 +39,4 @@ stub-obj-y += qmp_pc_dimm_device_list.o stub-obj-y += target-monitor-defs.o stub-obj-y += target-get-monitor-def.o stub-obj-y += vhost.o +stub-obj-y += qmp_query_hotpluggable_cpus.o diff --git a/stubs/qmp_query_hotpluggable_cpus.c b/stubs/qmp_query_hotpluggable_cpus.c new file mode 100644 index 0000000..21a75a3 --- /dev/null +++ b/stubs/qmp_query_hotpluggable_cpus.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "qapi/qmp/qerror.h" +#include "qmp-commands.h" + +HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) +{ + error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); + return NULL; +}