From patchwork Thu Mar 12 08:35:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wangting (Kathy)" X-Patchwork-Id: 449334 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 16B8814012F for ; Thu, 12 Mar 2015 19:37:53 +1100 (AEDT) Received: from localhost ([::1]:58568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVycp-0003XU-9j for incoming@patchwork.ozlabs.org; Thu, 12 Mar 2015 04:37:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVycQ-0002oR-1A for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:37:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVycL-0004Pi-I7 for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:37:25 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:53914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVycK-0004P2-NU for qemu-devel@nongnu.org; Thu, 12 Mar 2015 04:37:21 -0400 Received: from 172.24.2.119 (EHLO szxeml433-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BCZ93896; Thu, 12 Mar 2015 16:37:16 +0800 (CST) Received: from localhost (10.177.26.100) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.158.1; Thu, 12 Mar 2015 16:35:41 +0800 From: Ting Wang To: , , , Date: Thu, 12 Mar 2015 16:35:24 +0800 Message-ID: <1426149324-116508-1-git-send-email-kathy.wangting@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.26.100] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5501503D.00C5, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f592cf74a68a166efba314f6068a463e X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: Ting Wang Subject: [Qemu-devel] [PATCH v2] 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. The results are as follows: id1: thread_id1 id2: thread_id2 Signed-off-by: Ting Wang --- 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..e87cb14 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, }, };