Skip to contentSkip to conversation

hmp queue

GIT PULL Applied Dr. David Alan Gilbert (git) 2 participants 5 messages Feb 21, 2017 – Feb 23, 2017

lore
Share & tools
lore
#0 lore raw

From: "Dr. David Alan Gilbert" <[email protected]>

The following changes since commit 796b288f7be875045670f963ce99991b3c8e96ac:

Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2017-02-21 15:48:22 +0000)

are available in the git repository at:

git://github.com/dagrh/qemu.git tags/pull-hmp-20170221

for you to fetch changes up to 854e67fea6a6f181163a5467fc9ba04de8d181bb:

monitor: Fix crashes when using HMP commands without CPU (2017-02-21 18:29:01 +0000)

----------------------------------------------------------------
HMP pull

Note, I had seen a fail in the vhost-user/flags-mismatch on one host in one build, but not others with the same patches; and these patches go nowhere near that, so I think that's a separate vhost-user issue.

----------------------------------------------------------------
Eric Blake (1):
hmp: fix block_set_io_throttle

Pavel Hrdina (1):
monitor: add poll-* properties into query-iothreads result

Thomas Huth (1):
monitor: Fix crashes when using HMP commands without CPU

 hmp.c                   | 18 +++++++++++++++---
 iothread.c              |  3 +++
 monitor.c               | 42 ++++++++++++++++++++++++++++++++++--------
 qapi-schema.json        | 15 ++++++++++++++-
 target/i386/monitor.c   | 16 +++++++++++++++-
 target/ppc/monitor.c    |  4 ++++
 target/sh4/monitor.c    |  5 +++++
 target/sparc/monitor.c  |  4 ++++
 target/xtensa/monitor.c |  4 ++++
 9 files changed, 98 insertions(+), 13 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/3] hmp: fix block_set_io_throttle

From: Eric Blake <[email protected]>

Commit 7a9877a made the 'device' parameter to BlockIOThrottle optional, favoring 'id' instead. But it forgot to update the HMP usage to set has_device, which makes all attempts to change throttling via HMP fail with "Need exactly one of 'device' and 'id'"

Message-Id: <[email protected]>

---
 hmp.c | 1 +
 1 file changed, 1 insertion(+)
hmp.c +1 -0
index 2bc4f06..0c80596 100644
@@ -1552,6 +1552,7 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
     BlockIOThrottle throttle = {
+        .has_device = true,
         .device = (char *) qdict_get_str(qdict, "device"),
         .bps = qdict_get_int(qdict, "bps"),
         .bps_rd = qdict_get_int(qdict, "bps_rd"),
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 2/3] monitor: add poll-* properties into query-iothreads result

In reply to Dr. David Alan Gilbert (git)

From: Pavel Hrdina <[email protected]>

IOthreads were recently extended by new properties that can enable/disable and configure aio polling. This will also allow other tools that uses QEMU to probe for existence of those new properties via query-qmp-schema.

Message-Id: <3163c16d6ab4257f7be9ad44fe9cc0ce8c359e5a.1486718555.git.phrdina@redhat.com>

---
 hmp.c            |  9 +++++++--
 iothread.c       |  3 +++
 qapi-schema.json | 15 ++++++++++++++-
 3 files changed, 24 insertions(+), 3 deletions(-)
hmp.c +7 -2
index 0c80596..8b0c2b0 100644
@@ -2149,10 +2149,15 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
 {
     IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
     IOThreadInfoList *info;
+    IOThreadInfo *value;
 
     for (info = info_list; info; info = info->next) {
-        monitor_printf(mon, "%s: thread_id=%" PRId64 "\n",
-                       info->value->id, info->value->thread_id);
+        value = info->value;
+        monitor_printf(mon, "%s:\n", value->id);
+        monitor_printf(mon, "  thread_id=%" PRId64 "\n", value->thread_id);
+        monitor_printf(mon, "  poll-max-ns=%" PRId64 "\n", value->poll_max_ns);
+        monitor_printf(mon, "  poll-grow=%" PRId64 "\n", value->poll_grow);
+        monitor_printf(mon, "  poll-shrink=%" PRId64 "\n", value->poll_shrink);
     }
 
     qapi_free_IOThreadInfoList(info_list);
iothread.c +3 -0
index 257b01d..beeb870 100644
@@ -268,6 +268,9 @@ static int query_one_iothread(Object *object, void *opaque)
     info = g_new0(IOThreadInfo, 1);
     info->id = iothread_get_id(iothread);
     info->thread_id = iothread->thread_id;
+    info->poll_max_ns = iothread->poll_max_ns;
+    info->poll_grow = iothread->poll_grow;
+    info->poll_shrink = iothread->poll_shrink;
 
     elem = g_new0(IOThreadInfoList, 1);
     elem->value = info;
qapi-schema.json +14 -1
index e9a6364..f6ca18c 100644
@@ -1427,10 +1427,23 @@
 #
 # @thread-id: ID of the underlying host thread
 #
+# @poll-max-ns: maximum polling time in ns, 0 means polling is disabled
+#               (since 2.9)
+#
+# @poll-grow: how many ns will be added to polling time, 0 means that it's not
+#             configured (since 2.9)
+#
+# @poll-shrink: how many ns will be removed from polling time, 0 means that
+#               it's not configured (since 2.9)
+#
 # Since: 2.0
 ##
 { 'struct': 'IOThreadInfo',
-  'data': {'id': 'str', 'thread-id': 'int'} }
+  'data': {'id': 'str',
+           'thread-id': 'int',
+           'poll-max-ns': 'int',
+           'poll-grow': 'int',
+           'poll-shrink': 'int' } }
 
 ##
 # @query-iothreads:
Signature · 1 line
2.9.3
#3 lore raw

[Qemu-devel] [PULL 3/3] monitor: Fix crashes when using HMP commands without CPU

In reply to Dr. David Alan Gilbert (git)

From: Thomas Huth <[email protected]>

When running certain HMP commands ("info registers", "info cpustats", "info tlb", "nmi", "memsave" or dumping virtual memory) with the "none" machine, QEMU crashes with a segmentation fault. This happens because the "none" machine does not have any CPUs by default, but these HMP commands did not check for a valid CPU pointer yet. Add such checks now, so we get an error message about the missing CPU instead.

Message-Id: <[email protected]>

---
 hmp.c                   |  8 +++++++-
 monitor.c               | 42 ++++++++++++++++++++++++++++++++++--------
 target/i386/monitor.c   | 16 +++++++++++++++-
 target/ppc/monitor.c    |  4 ++++
 target/sh4/monitor.c    |  5 +++++
 target/sparc/monitor.c  |  4 ++++
 target/xtensa/monitor.c |  4 ++++
 7 files changed, 73 insertions(+), 10 deletions(-)
hmp.c +7 -1
index 8b0c2b0..aba728f 100644
@@ -1014,8 +1014,14 @@ void hmp_memsave(Monitor *mon, const QDict *qdict)
     const char *filename = qdict_get_str(qdict, "filename");
     uint64_t addr = qdict_get_int(qdict, "val");
     Error *err = NULL;
+    int cpu_index = monitor_get_cpu_index();
 
-    qmp_memsave(addr, size, filename, true, monitor_get_cpu_index(), &err);
+    if (cpu_index < 0) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
+
+    qmp_memsave(addr, size, filename, true, cpu_index, &err);
     hmp_handle_error(mon, &err);
 }
 
monitor.c +34 -8

102 lines not on this page · raw message

target/i386/monitor.c +15 -1
index 468aa07..77ead60 100644
@@ -210,6 +210,10 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
     CPUArchState *env;
 
     env = mon_get_cpu_env();
+    if (!env) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
 
     if (!(env->cr[0] & CR0_PG_MASK)) {
         monitor_printf(mon, "PG disabled\n");
@@ -529,6 +533,10 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict)
     CPUArchState *env;
 
     env = mon_get_cpu_env();
+    if (!env) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
 
     if (!(env->cr[0] & CR0_PG_MASK)) {
         monitor_printf(mon, "PG disabled\n");
@@ -624,7 +632,13 @@ const MonitorDef *target_monitor_defs(void)
 
 void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
 {
-    x86_cpu_dump_local_apic_state(mon_get_cpu(), (FILE *)mon, monitor_fprintf,
+    CPUState *cs = mon_get_cpu();
+
+    if (!cs) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
+    x86_cpu_dump_local_apic_state(cs, (FILE *)mon, monitor_fprintf,
                                   CPU_DUMP_FPU);
 }
 
target/ppc/monitor.c +4 -0
index c2d0806..b8f30e9 100644
@@ -62,6 +62,10 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
     CPUArchState *env1 = mon_get_cpu_env();
 
+    if (!env1) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
     dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
 }
 
target/sh4/monitor.c +5 -0
index 426e5d4..4c7f36c 100644
@@ -44,6 +44,11 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
     CPUArchState *env = mon_get_cpu_env();
     int i;
 
+    if (!env) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
+
     monitor_printf (mon, "ITLB:\n");
     for (i = 0 ; i < ITLB_SIZE ; i++)
         print_tlb (mon, i, &env->itlb[i]);
target/sparc/monitor.c +4 -0
index 7cc1b0f..f3ca524 100644
@@ -32,6 +32,10 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
     CPUArchState *env1 = mon_get_cpu_env();
 
+    if (!env1) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
     dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
 }
 
target/xtensa/monitor.c +4 -0
index f3fa4cd..2ee2b5b 100644
@@ -31,5 +31,9 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
     CPUArchState *env1 = mon_get_cpu_env();
 
+    if (!env1) {
+        monitor_printf(mon, "No CPU available\n");
+        return;
+    }
     dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
 }
Signature · 1 line
2.9.3
#4 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 12 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The following changes since commit 796b288f7be875045670f963ce99991b3c8e96ac:

Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2017-02-21 15:48:22 +0000)

are available in the git repository at:

git://github.com/dagrh/qemu.git tags/pull-hmp-20170221

for you to fetch changes up to 854e67fea6a6f181163a5467fc9ba04de8d181bb:

Quoted 8 lines

monitor: Fix crashes when using HMP commands without CPU (2017-02-21 18:29:01 +0000)

----------------------------------------------------------------
HMP pull

Note, I had seen a fail in the vhost-user/flags-mismatch on one host in one build, but not others with the same patches; and these patches go nowhere near that, so I think that's a separate vhost-user issue.

Applied, thanks.

-- PMM