qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: mjrosato@linux.vnet.ibm.com, thuth@redhat.com,
	pkrempa@redhat.com, ehabkost@redhat.com, aik@ozlabs.ru,
	armbru@redhat.com, agraf@suse.de, borntraeger@de.ibm.com,
	qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com,
	pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, afaerber@suse.de,
	david@gibson.dropbear.id.au
Subject: [Qemu-devel] [PATCH v2 1/5] QMP: add query-hotpluggable-cpus
Date: Tue,  8 Mar 2016 14:18:11 +0100	[thread overview]
Message-ID: <1457443095-213125-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1457443095-213125-1-git-send-email-imammedo@redhat.com>

it will allow mgmt to query present and possible to hotplug
CPU objects, it is required from a target platform that
wish to support command to implement
 qmp_query_hotpluggable_cpus()
functioni, which will return a list of possible CPU objects
with options that would be needed for hotplugging possible
CPU objects.

For RFC there are:
'type': 'str' - OQOM CPU object type for usage with device_add

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 inspect whatever object/abstraction
the target platform considers as CPU object.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 qapi-schema.json                    | 39 +++++++++++++++++++++++++++++++++++++
 qmp-commands.hx                     | 34 ++++++++++++++++++++++++++++++++
 stubs/Makefile.objs                 |  1 +
 stubs/qmp_query_hotpluggable_cpus.c |  9 +++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 stubs/qmp_query_hotpluggable_cpus.c

diff --git a/qapi-schema.json b/qapi-schema.json
index 362c9d8..c59840d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4122,3 +4122,42 @@
 ##
 { 'enum': 'ReplayMode',
   'data': [ 'none', 'record', 'play' ] }
+
+##
+# CpuInstanceProps
+#
+# @node: NUMA node ID the CPU belongs to, optional
+# @socket: socket number within node/board the CPU belongs to, optional
+# @core: core number within socket the CPU belongs to, optional
+# @thread: thread number within core the CPU belongs to, optional
+#
+# Since: 2.7
+{ 'struct': 'CpuInstanceProps',
+  'data': { '*node': 'int',
+            '*socket': 'int',
+            '*core': 'int',
+            '*thread': 'int'
+  }
+}
+
+##
+# @HotpluggableCPU
+#
+# @type: CPU object type for usage with device_add command
+# @qom-path: link to existing CPU object if CPU is present or
+#            omitted if CPU is not present.
+# @props: list of properties to be used for hotplugging CPU
+#
+# Since: 2.7
+{ 'struct': 'HotpluggableCPU',
+  'data': { 'type': 'str',
+            '*qom-path': 'str',
+            '*props': 'CpuInstanceProps'
+          }
+}
+
+##
+# @query-hotpluggable-cpus
+#
+# Since: 2.6
+{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b629673..39687ad 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4853,3 +4853,37 @@ 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": [
+     {"core": 0, "socket": 1, "thread": 2}, "type": "qemu64-x86_64-cpu"},
+     {"core": 0, "socket": 1, "thread": 1}, "type": "qemu64-x86_64-cpu"},
+     {"core": 0, "socket": 1, "thread": 0}, "type": "qemu64-x86_64-cpu"},
+     {"core": 0, "socket": 0, "thread": 2}, "type": "qemu64-x86_64-cpu"},
+     {"core": 0, "socket": 0, "thread": 1}, "type": "qemu64-x86_64-cpu", "qom-path": "/machine/unattached/device[3]"},
+     {"core": 0, "socket": 0, "thread": 0}, "type": "qemu64-x86_64-cpu", "qom-path": "/machine/unattached/device[0]"}
+   ]}'
+
+Example for SPAPR target started with -smp 2,cores=2,maxcpus=4:
+
+-> { "execute": "query-hotpluggable-cpus" }
+<- {"return": [
+     {"core": 1 }, "type": "spapr-cpu-core"},
+     {"core": 0 }, "type": "spapr-cpu-core", "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;
+}
-- 
1.8.3.1

  reply	other threads:[~2016-03-08 13:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 13:18 [Qemu-devel] [PATCH v2 0/5] spapr: QMP: add query-hotpluggable-cpus Igor Mammedov
2016-03-08 13:18 ` Igor Mammedov [this message]
2016-03-08 16:46   ` [Qemu-devel] [PATCH v2 1/5] " Eric Blake
2016-03-09  3:15     ` David Gibson
2016-03-09  9:34     ` Igor Mammedov
2016-03-08 13:18 ` [Qemu-devel] [PATCH v2 2/5] spapr: convert slot name property to numeric core and links Igor Mammedov
2016-03-08 15:09   ` Bharata B Rao
2016-03-09  9:27     ` Igor Mammedov
2016-03-08 16:48   ` Eric Blake
2016-03-09  9:40     ` Igor Mammedov
2016-03-09  3:19   ` David Gibson
2016-03-09  9:48     ` Igor Mammedov
2016-03-08 13:18 ` [Qemu-devel] [PATCH v2 3/5] qdev: hotplug: introduce HotplugHandler.pre_plug() callback Igor Mammedov
2016-03-08 13:18 ` [Qemu-devel] [PATCH v2 4/5] spapr: check if cpu core is already present Igor Mammedov
2016-03-08 14:34   ` Bharata B Rao
2016-03-09 10:07     ` Igor Mammedov
2016-03-10  5:22       ` David Gibson
2016-03-10  6:02         ` Bharata B Rao
2016-03-10 10:39           ` Igor Mammedov
2016-03-10 14:45             ` Bharata B Rao
2016-03-11 10:31               ` Igor Mammedov
2016-03-15  6:10             ` David Gibson
2016-03-15 11:05               ` Igor Mammedov
2016-03-15 23:38                 ` David Gibson
2016-03-16 15:26                   ` Igor Mammedov
2016-03-08 13:18 ` [Qemu-devel] [PATCH v2 5/5] spapr: implement query-hotpluggable-cpus QMP command Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457443095-213125-2-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=armbru@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mjrosato@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).