From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0Zq-0005Zt-20 for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:42:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW0Zm-0003rk-QU for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:42:54 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:62419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0Zl-0003qy-Rj for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:42:50 -0400 From: Ting Wang Date: Thu, 12 Mar 2015 18:42:27 +0800 Message-ID: <1426156947-117292-1-git-send-email-kathy.wangting@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v3] hmp: add info iothreads command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: famz@redhat.com, qemu-devel@nongnu.org Cc: pbonzini@redhat.com, stefanha@redhat.com, Ting Wang Make "info iothreads" available on the HMP monitor. The results are as follows: id1: thread_id=thread_id1 id2: thread_id=thread_id2 Signed-off-by: Ting Wang --- v3: fix comment and the trailing whitespace v2: add braces for if --- hmp-commands.hx | 2 ++ hmp.c | 22 ++++++++++++++++++++++ hmp.h | 1 + monitor.c | 7 +++++++ 4 files changed, 32 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index d5022d8..67d76ed 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1746,6 +1746,8 @@ show roms show the TPM device @item info memory-devices show the memory devices +@item info iothreads +show iothreads @end table ETEXI diff --git a/hmp.c b/hmp.c index 71c28bc..22b1a1f 100644 --- a/hmp.c +++ b/hmp.c @@ -821,6 +821,28 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) qapi_free_TPMInfoList(info_list); } +void hmp_info_iothreads(Monitor *mon, const QDict *qdict) +{ + IOThreadInfoList *head = NULL, *elem = NULL; + + head = qmp_query_iothreads(NULL); + if (!head) { + monitor_printf(mon, "No iothread has been added\n"); + return; + } + + elem = head; + while (elem) { + if (elem->value) { + monitor_printf(mon, "%s: thread_id=%ld\n", elem->value->id, + elem->value->thread_id); + } + elem = elem->next; + } + + qapi_free_IOThreadInfoList(head); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); diff --git a/hmp.h b/hmp.h index 81177b2..d99090e 100644 --- a/hmp.h +++ b/hmp.h @@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict); void hmp_info_pci(Monitor *mon, const QDict *qdict); void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); void hmp_info_tpm(Monitor *mon, const QDict *qdict); +void hmp_info_iothreads(Monitor *mon, const QDict *qdict); void hmp_quit(Monitor *mon, const QDict *qdict); void hmp_stop(Monitor *mon, const QDict *qdict); void hmp_system_reset(Monitor *mon, const QDict *qdict); diff --git a/monitor.c b/monitor.c index c86a89e..076a306 100644 --- a/monitor.c +++ b/monitor.c @@ -2924,6 +2924,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_memory_devices, }, { + .name = "iothreads", + .args_type = "", + .params = "", + .help = "show iothreads", + .mhandler.cmd = hmp_info_iothreads, + }, + { .name = NULL, }, }; -- 1.8.5