From 3f35c3b166c18043596768448e5d91b5d52f8353 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 20 Jan 2017 17:03:59 -0600 Subject: hmp: fix block_set_io_throttle 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'" CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake Message-Id: <20170120230359.4244-1-eblake@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Dr. David Alan Gilbert --- hmp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 2bc4f06..0c80596 100644 --- a/hmp.c +++ b/hmp.c @@ -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"), -- cgit v1.1 From 5fc00480ab1ce767f1c6c63ae644e960295fed2c Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Fri, 10 Feb 2017 10:41:17 +0100 Subject: monitor: add poll-* properties into query-iothreads result 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. Signed-off-by: Pavel Hrdina Message-Id: <3163c16d6ab4257f7be9ad44fe9cc0ce8c359e5a.1486718555.git.phrdina@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Dr. David Alan Gilbert --- hmp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 0c80596..8b0c2b0 100644 --- a/hmp.c +++ b/hmp.c @@ -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); -- cgit v1.1 From 854e67fea6a6f181163a5467fc9ba04de8d181bb Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 13 Jan 2017 13:12:35 +0100 Subject: monitor: Fix crashes when using HMP commands without CPU 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. Signed-off-by: Thomas Huth Message-Id: <1484309555-1935-1-git-send-email-thuth@redhat.com> Reviewed-by: Markus Armbruster Acked-by: David Gibson Signed-off-by: Dr. David Alan Gilbert --- hmp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 8b0c2b0..aba728f 100644 --- a/hmp.c +++ b/hmp.c @@ -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); } -- cgit v1.1