From patchwork Fri Jun 26 08:07:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wangting (Kathy)" X-Patchwork-Id: 488636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6C6381402B4 for ; Fri, 26 Jun 2015 18:08:03 +1000 (AEST) Received: from localhost ([::1]:58766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Og5-0007jy-IT for incoming@patchwork.ozlabs.org; Fri, 26 Jun 2015 04:08:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Ofn-0007T1-81 for qemu-devel@nongnu.org; Fri, 26 Jun 2015 04:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8Ofj-0001ET-6u for qemu-devel@nongnu.org; Fri, 26 Jun 2015 04:07:43 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:19587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Ofh-0001DX-20 for qemu-devel@nongnu.org; Fri, 26 Jun 2015 04:07:39 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CNR41667; Fri, 26 Jun 2015 16:07:27 +0800 (CST) Received: from localhost (10.177.26.100) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Fri, 26 Jun 2015 16:07:17 +0800 From: Ting Wang To: , Date: Fri, 26 Jun 2015 16:07:13 +0800 Message-ID: <1435306033-58372-1-git-send-email-kathy.wangting@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.26.100] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: famz@redhat.com, wu.wubin@huawei.com, stefanha@redhat.com, Ting Wang Subject: [Qemu-devel] [PATCH v5] hmp: add info iothreads command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make "info iothreads" available on the HMP monitor. For example, the results are as follows when executing qemu command with "-object iothread,id=iothread-1 -object iothread,id=iothread-2". (qemu) info iothreads iothread-1: thread_id=123 iothread-2: thread_id=456 Signed-off-by: Ting Wang Reviewed-by: Markus Armbruster Reviewed-by: Luiz Capitulino Reviewed-by: Amos Jianjun Kong --- v5: use "for" instead of "while" --- hmp-commands.hx | 2 ++ hmp.c | 13 +++++++++++++ hmp.h | 1 + monitor.c | 7 +++++++ 4 files changed, 23 insertions(+)execute diff --git a/hmp-commands.hx b/hmp-commands.hx index d3b7932..c8c8d79 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1790,6 +1790,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 070aaf8..7192494 100644 --- a/hmp.c +++ b/hmp.c @@ -1963,6 +1963,19 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) qapi_free_MemoryDeviceInfoList(info_list); } +void hmp_info_iothreads(Monitor *mon, const QDict *qdict) +{ + IOThreadInfoList *info_list = qmp_query_iothreads(NULL); + IOThreadInfoList *info; + + for (info = info_list; info; info = info->next) { + monitor_printf(mon, "%s: thread_id=%" PRId64 "\n", + info->value->id, info->value->thread_id); + } + + qapi_free_IOThreadInfoList(info_list); +} + void hmp_qom_list(Monitor *mon, const QDict *qdict) { const char *path = qdict_get_try_str(qdict, "path"); diff --git a/hmp.h b/hmp.h index 0cf4f2a..c139a97 100644 --- a/hmp.h +++ b/hmp.h @@ -39,6 +39,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 aeea2b5..917e827 100644 --- a/monitor.c +++ b/monitor.c @@ -2850,6 +2850,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 = "rocker", .args_type = "name:s", .params = "name",