* [Qemu-devel] [PATCH v2] hmp: add info iothreads command
@ 2015-03-12 8:35 Ting Wang
2015-03-12 9:05 ` Fam Zheng
2015-03-12 14:03 ` Stefan Hajnoczi
0 siblings, 2 replies; 7+ messages in thread
From: Ting Wang @ 2015-03-12 8:35 UTC (permalink / raw)
To: famz, stefanha, pbonzini, qemu-devel; +Cc: Ting Wang
Make "info iothreads" available on the HMP monitor.
The results are as follows:
id1: thread_id1
id2: thread_id2
Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
---
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,
},
};
--
1.8.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 8:35 [Qemu-devel] [PATCH v2] hmp: add info iothreads command Ting Wang
@ 2015-03-12 9:05 ` Fam Zheng
2015-03-12 9:08 ` Ting Wang
2015-03-12 9:32 ` Ting Wang
2015-03-12 14:03 ` Stefan Hajnoczi
1 sibling, 2 replies; 7+ messages in thread
From: Fam Zheng @ 2015-03-12 9:05 UTC (permalink / raw)
To: Ting Wang; +Cc: pbonzini, qemu-devel, stefanha
On Thu, 03/12 16:35, Ting Wang wrote:
> Make "info iothreads" available on the HMP monitor.
>
> The results are as follows:
> id1: thread_id1
> id2: thread_id2
Does this match the actual output format? I think you're missing a "=".
>
> Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
> ---
> 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,
Please remove the trailing whitespace. You can use scripts/checkpatch.pl to
catch the coding style issues your self.
You should also add documentation in hmp-commands.hx.
Fam
> + 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
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 9:05 ` Fam Zheng
@ 2015-03-12 9:08 ` Ting Wang
2015-03-12 9:32 ` Ting Wang
1 sibling, 0 replies; 7+ messages in thread
From: Ting Wang @ 2015-03-12 9:08 UTC (permalink / raw)
To: Fam Zheng; +Cc: pbonzini, qemu-devel, stefanha
On 2015-3-12 17:05, Fam Zheng wrote:
> On Thu, 03/12 16:35, Ting Wang wrote:
>> Make "info iothreads" available on the HMP monitor.
>>
>> The results are as follows:
>> id1: thread_id1
>> id2: thread_id2
>
> Does this match the actual output format? I think you're missing a "=".
>
Oh, sorry. I will fix it.
Ting
>>
>> Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
>> ---
>> 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,
>
> Please remove the trailing whitespace. You can use scripts/checkpatch.pl to
> catch the coding style issues your self.
>
> You should also add documentation in hmp-commands.hx.
>
> Fam
>
>> + 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
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 9:05 ` Fam Zheng
2015-03-12 9:08 ` Ting Wang
@ 2015-03-12 9:32 ` Ting Wang
2015-03-12 9:41 ` Fam Zheng
1 sibling, 1 reply; 7+ messages in thread
From: Ting Wang @ 2015-03-12 9:32 UTC (permalink / raw)
To: Fam Zheng; +Cc: pbonzini, qemu-devel, stefanha
On 2015-3-12 17:05, Fam Zheng wrote:
> On Thu, 03/12 16:35, Ting Wang wrote:
>> Make "info iothreads" available on the HMP monitor.
>>
>> The results are as follows:
>> id1: thread_id1
>> id2: thread_id2
>
> Does this match the actual output format? I think you're missing a "=".
>
>>
>> Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
>> ---
>> 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,
>
> Please remove the trailing whitespace. You can use scripts/checkpatch.pl to
> catch the coding style issues your self.
OK. Thank you.
>
> You should also add documentation in hmp-commands.hx.
>
> Fam
>
It is a command in "info" group, I think documentation as follows is OK, do you agree with it?
>> 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
Ting
>> + 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
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 9:32 ` Ting Wang
@ 2015-03-12 9:41 ` Fam Zheng
0 siblings, 0 replies; 7+ messages in thread
From: Fam Zheng @ 2015-03-12 9:41 UTC (permalink / raw)
To: Ting Wang; +Cc: pbonzini, qemu-devel, stefanha
On Thu, 03/12 17:32, Ting Wang wrote:
> It is a command in "info" group, I think documentation as follows is OK, do you agree with it?
> >> 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
Yes, looks good.
Fam
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 8:35 [Qemu-devel] [PATCH v2] hmp: add info iothreads command Ting Wang
2015-03-12 9:05 ` Fam Zheng
@ 2015-03-12 14:03 ` Stefan Hajnoczi
2015-03-13 1:32 ` Ting Wang
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2015-03-12 14:03 UTC (permalink / raw)
To: Ting Wang; +Cc: pbonzini, famz, qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
On Thu, Mar 12, 2015 at 04:35:24PM +0800, Ting Wang wrote:
> +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);
%ld does not work on 32-bit hosts or 64-bit Windows hosts where long is
32-bit.
Please use the PRId64 format specifier macro for the int64_t thread_id.
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: add info iothreads command
2015-03-12 14:03 ` Stefan Hajnoczi
@ 2015-03-13 1:32 ` Ting Wang
0 siblings, 0 replies; 7+ messages in thread
From: Ting Wang @ 2015-03-13 1:32 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: pbonzini, famz, qemu-devel, stefanha
On 2015-3-12 22:03, Stefan Hajnoczi wrote:
> On Thu, Mar 12, 2015 at 04:35:24PM +0800, Ting Wang wrote:
>> +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);
>
> %ld does not work on 32-bit hosts or 64-bit Windows hosts where long is
> 32-bit.
>
> Please use the PRId64 format specifier macro for the int64_t thread_id.
>
OK, I will fix it.
Thank you very much.
Ting
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-13 1:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 8:35 [Qemu-devel] [PATCH v2] hmp: add info iothreads command Ting Wang
2015-03-12 9:05 ` Fam Zheng
2015-03-12 9:08 ` Ting Wang
2015-03-12 9:32 ` Ting Wang
2015-03-12 9:41 ` Fam Zheng
2015-03-12 14:03 ` Stefan Hajnoczi
2015-03-13 1:32 ` Ting Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).