Skip to contentSkip to conversation

qemu-monitor: HMP cpu-add wrapper

RFC PATCH Applied Jason J. Herne 4 participants 4 messages Dec 11, 2013 – Dec 16, 2013

lore
Share & tools
lore
#0 lore raw

RFC PATCH v4 1/1 qemu-monitor: HMP cpu-add wrapper

From: "Jason J. Herne" <[email protected]>

Add HMP cpu-add wrapper to allow cpu hot plugging via monitor.

---
 hmp-commands.hx | 13 +++++++++++++
 hmp.c           | 10 ++++++++++
 hmp.h           |  1 +
 3 files changed, 24 insertions(+)
hmp-commands.hx +13 -0
index caae5ad..028a8a1 100644
@@ -1620,6 +1620,19 @@ Executes a qemu-io command on the given block device.
 ETEXI
 
     {
+        .name       = "cpu-add",
+        .args_type  = "id:i",
+        .params     = "id",
+        .help       = "add cpu",
+        .mhandler.cmd  = hmp_cpu_add,
+    },
+
+STEXI
+@item cpu-add @var{id}
+Add CPU with id @var{id}
+ETEXI
+
+    {
         .name       = "info",
         .args_type  = "item:s?",
         .params     = "[subcommand]",
hmp.c +10 -0
index 32ee285..c513f9b 100644
@@ -1525,6 +1525,16 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &errp);
 }
 
+void hmp_cpu_add(Monitor *mon, const QDict *qdict)
+{
+    int cpuid;
+    Error *err = NULL;
+
+    cpuid = qdict_get_int(qdict, "id");
+    qmp_cpu_add(cpuid, &err);
+    hmp_handle_error(mon, &err);
+}
+
 void hmp_chardev_add(Monitor *mon, const QDict *qdict)
 {
     const char *args = qdict_get_str(qdict, "args");
hmp.h +1 -0
index 54cf71f..f92fc89 100644
@@ -89,5 +89,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
 void hmp_chardev_add(Monitor *mon, const QDict *qdict);
 void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
 void hmp_qemu_io(Monitor *mon, const QDict *qdict);
+void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 
 #endif
Signature · 1 line
1.8.3.2
#1 lore raw

On 12/11/2013 01:24 PM, Jason J. Herne wrote:

I forgot to modify the subject line to remove "[PATCH RFC v4]". My apologies!

Signature · 1 line
-- Jason J. Herne ([email protected])
Reviewed-by on v4 1/1
#2 lore raw
In reply to Jason J. Herne
Quoted 71 lines · On Wed, 11 Dec 2013 13:24:14 -0500 "Jason J. Herne" <[email protected]> wrote:

From: "Jason J. Herne" <[email protected]>

Add HMP cpu-add wrapper to allow cpu hot plugging via monitor.

---
 hmp-commands.hx | 13 +++++++++++++
 hmp.c           | 10 ++++++++++
 hmp.h           |  1 +
 3 files changed, 24 insertions(+)
hmp-commands.hx +13 -0
index caae5ad..028a8a1 100644
@@ -1620,6 +1620,19 @@ Executes a qemu-io command on the given block device.
 ETEXI
 
     {
+        .name       = "cpu-add",
+        .args_type  = "id:i",
+        .params     = "id",
+        .help       = "add cpu",
+        .mhandler.cmd  = hmp_cpu_add,
+    },
+
+STEXI
+@item cpu-add @var{id}
+Add CPU with id @var{id}
+ETEXI
+
+    {
         .name       = "info",
         .args_type  = "item:s?",
         .params     = "[subcommand]",
hmp.c +10 -0
index 32ee285..c513f9b 100644
@@ -1525,6 +1525,16 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &errp);
 }
 
+void hmp_cpu_add(Monitor *mon, const QDict *qdict)
+{
+    int cpuid;
+    Error *err = NULL;
+
+    cpuid = qdict_get_int(qdict, "id");
+    qmp_cpu_add(cpuid, &err);
+    hmp_handle_error(mon, &err);
+}
+
 void hmp_chardev_add(Monitor *mon, const QDict *qdict)
 {
     const char *args = qdict_get_str(qdict, "args");
hmp.h +1 -0
index 54cf71f..f92fc89 100644
@@ -89,5 +89,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
 void hmp_chardev_add(Monitor *mon, const QDict *qdict);
 void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
 void hmp_qemu_io(Monitor *mon, const QDict *qdict);
+void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 
 #endif
Signature · 1 line
1.8.3.2
Signature · 2 lines
Regards,
  Igor
#3 lore raw
In reply to Jason J. Herne
Quoted 5 lines · On Wed, 11 Dec 2013 13:24:14 -0500 "Jason J. Herne" <[email protected]> wrote:

From: "Jason J. Herne" <[email protected]>

Add HMP cpu-add wrapper to allow cpu hot plugging via monitor.

Applied to the qmp branch, thanks.

Quoted 62 lines
---
 hmp-commands.hx | 13 +++++++++++++
 hmp.c           | 10 ++++++++++
 hmp.h           |  1 +
 3 files changed, 24 insertions(+)
hmp-commands.hx +13 -0
index caae5ad..028a8a1 100644
@@ -1620,6 +1620,19 @@ Executes a qemu-io command on the given block device.
 ETEXI
 
     {
+        .name       = "cpu-add",
+        .args_type  = "id:i",
+        .params     = "id",
+        .help       = "add cpu",
+        .mhandler.cmd  = hmp_cpu_add,
+    },
+
+STEXI
+@item cpu-add @var{id}
+Add CPU with id @var{id}
+ETEXI
+
+    {
         .name       = "info",
         .args_type  = "item:s?",
         .params     = "[subcommand]",
hmp.c +10 -0
index 32ee285..c513f9b 100644
@@ -1525,6 +1525,16 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
     hmp_handle_error(mon, &errp);
 }
 
+void hmp_cpu_add(Monitor *mon, const QDict *qdict)
+{
+    int cpuid;
+    Error *err = NULL;
+
+    cpuid = qdict_get_int(qdict, "id");
+    qmp_cpu_add(cpuid, &err);
+    hmp_handle_error(mon, &err);
+}
+
 void hmp_chardev_add(Monitor *mon, const QDict *qdict)
 {
     const char *args = qdict_get_str(qdict, "args");
hmp.h +1 -0
index 54cf71f..f92fc89 100644
@@ -89,5 +89,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
 void hmp_chardev_add(Monitor *mon, const QDict *qdict);
 void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
 void hmp_qemu_io(Monitor *mon, const QDict *qdict);
+void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 
 #endif