Skip to contentSkip to conversation

hmp.c: Revert hmp_info_cpus output format

PATCH In review [email protected] 6 participants 10 messages Mar 27, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hmp.c: Revert hmp_info_cpus output format

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
 hmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hmp.c +1 -1
index 679467d85a..a25c7bd9a8 100644
@@ -381,7 +381,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
 
         monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
                        cpu->value->cpu_index);
-        monitor_printf(mon, " thread-id=%" PRId64 "\n", cpu->value->thread_id);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
     }
 
     qapi_free_CpuInfoFastList(cpu_list);
Signature · 1 line
2.14.3
#1 lore raw
Quoted 6 lines · On Tue, Mar 27, 2018 at 06:08:00PM +0530, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Libvirt doesn't use HMP, only QMP, so this shouldn't have broken libvirt afaik. HMP is not intended to be a stable API so these kind of changes should be expected.

Quoted 26 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
 hmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hmp.c +1 -1
index 679467d85a..a25c7bd9a8 100644
@@ -381,7 +381,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
 
         monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
                        cpu->value->cpu_index);
-        monitor_printf(mon, " thread-id=%" PRId64 "\n", cpu->value->thread_id);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
     }
 
     qapi_free_CpuInfoFastList(cpu_list);
Signature · 1 line
2.14.3

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re-adding qemu-devel address - please don't drop the mailing list from CC's when replying to messages on the list.

Quoted 9 lines · satheesh rajendran
Quoted 8 lines · Daniel P. Berrangé
Quoted 6 lines · On Tue, Mar 27, 2018 at 06:08:00PM +0530, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 5 lines
Quoted 3 lines

Libvirt doesn't use HMP, only QMP, so this shouldn't have broken libvirt afaik. HMP is not intended to be a stable API so these kind of changes should be expected.

Am sure avocado test framework uses this output for parsing to extract threadid

If avocado is relying on the HMP then it should be updated to use QMP, as HMP is not a stable API for automation.

Quoted 9 lines

and in libvirt atleast I checked below code uses it, I hope keeping the format same as previous won't affect anything?

in src/qemu/qemu_monitor_text.c
int
qemuMonitorTextQueryCPUs(qemuMonitorPtr mon,
struct qemuMonitorQueryCpusEntry **entries, size_t *nentries)
...

This libvirt code is only executed when managing QEMU versions < 0.15, so not affected.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
Quoted 2 lines · Daniel P. Berrangé

Re-adding qemu-devel address - please don't drop the mailing list from CC's when replying to messages on the list.

Sorry, Missed intially, had resent it but was too late :-(.

Quoted 11 lines · satheesh rajendran
Quoted 9 lines · Daniel P. Berrangé
Quoted 8 lines · On Tue, Mar 27, 2018 at 06:08:00PM +0530, [email protected] wrote:
Quoted 6 lines

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Libvirt doesn't use HMP, only QMP, so this shouldn't have broken libvirt afaik. HMP is not intended to be a stable API so these kind of changes should be expected.

Am sure avocado test framework uses this output for parsing to extract threadid

If avocado is relying on the HMP then it should be updated to use QMP, as HMP is not a stable API for automation.

Sure, Thanks, will change it.

Quoted 10 lines
Quoted 9 lines

and in libvirt atleast I checked below code uses it, I hope keeping the format same as previous won't affect anything?

in src/qemu/qemu_monitor_text.c
int
qemuMonitorTextQueryCPUs(qemuMonitorPtr mon,
struct qemuMonitorQueryCpusEntry **entries, size_t *nentries)
...

Quoted 3 lines

This libvirt code is only executed when managing QEMU versions < 0.15, so not affected.

Okies :-)

Regards,
-Satheesh

Quoted 7 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw
In reply to Daniel P. Berrangé
Quoted 11 lines · Daniel P. Berrangé
Quoted 6 lines · On Tue, Mar 27, 2018 at 06:08:00PM +0530, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Libvirt doesn't use HMP, only QMP, so this shouldn't have broken libvirt afaik. HMP is not intended to be a stable API so these kind of changes should be expected.

Am sure avocado test framework uses this output for parsing to extract threadid and in libvirt atleast I checked below code uses it, I hope keeping the format same as previous won't affect anything?

in src/qemu/qemu_monitor_text.c
int
qemuMonitorTextQueryCPUs(qemuMonitorPtr mon,
struct qemuMonitorQueryCpusEntry **entries, size_t *nentries)
...
if (qemuMonitorHMPCommand(mon, "info cpus", &qemucpus) < 0)
return -1;

/*
* This is the gross format we're about to parse :-{ *
* (qemu) info cpus
* * CPU #0: pc=0x00000000000f0c4a thread_id=30019
* CPU #1: pc=0x00000000fffffff0 thread_id=30020
* CPU #2: pc=0x00000000fffffff0 (halted) thread_id=30021
*
*/
....

        /* Extract host Thread ID */
        if ((offset = strstr(line, "thread_id=")) == NULL)

Regards,
-Satheesh

Quoted 35 lines
Quoted 27 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
 hmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hmp.c +1 -1
index 679467d85a..a25c7bd9a8 100644
@@ -381,7 +381,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
 
         monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
                        cpu->value->cpu_index);
-        monitor_printf(mon, " thread-id=%" PRId64 "\n", cpu->value->thread_id);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
     }
 
     qapi_free_CpuInfoFastList(cpu_list);
Signature · 1 line
2.14.3

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/1
#6 lore raw
In reply to [email protected]
Quoted 7 lines · On 03/27/2018 07:38 AM, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 7 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
  hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I'm not opposed to this patch (because it is a trivial way to keep older stuff working), but agree with Daniel that HMP output can change at any time, so other stuff relying on HMP should be fixed. Libvirt is not affected, so if we DO take this into 2.12, we should update the commit message to drop mention of libvirt being impacted, maybe along the lines of:

Commit 137b5cb6 refactored 'info cpus' output, changing 'thread_id' to 'thread-id'. While HMP is not a stable interface, it is trivial to keep the spelling consistent for test frameworks that have not yet updated to using QMP.

With the improved commit message,

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by
#7 lore raw
Quoted 22 lines · On Tue, 27 Mar 2018 08:59:04 -0500 Eric Blake <[email protected]> wrote:
Quoted 7 lines · On 03/27/2018 07:38 AM, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 7 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
  hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)  

I'm not opposed to this patch (because it is a trivial way to keep older stuff working), but agree with Daniel that HMP output can change at any time, so other stuff relying on HMP should be fixed. Libvirt is not affected, so if we DO take this into 2.12, we should update the commit message to drop mention of libvirt being impacted, maybe along the lines of:

Quoted 8 lines

Commit 137b5cb6 refactored 'info cpus' output, changing 'thread_id' to 'thread-id'. While HMP is not a stable interface, it is trivial to keep the spelling consistent for test frameworks that have not yet updated to using QMP.

With the improved commit message,

Yes, that certainly makes sense.

#8 lore raw
Quoted 30 lines · Cornelia Huck
Quoted 27 lines · On Tue, 27 Mar 2018 08:59:04 -0500 Eric Blake <[email protected]> wrote:
Quoted 7 lines · On 03/27/2018 07:38 AM, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 7 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
  hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)  

I'm not opposed to this patch (because it is a trivial way to keep older stuff working), but agree with Daniel that HMP output can change at any time, so other stuff relying on HMP should be fixed. Libvirt is not affected, so if we DO take this into 2.12, we should update the commit message to drop mention of libvirt being impacted, maybe along the lines of:

Commit 137b5cb6 refactored 'info cpus' output, changing 'thread_id' to 'thread-id'. While HMP is not a stable interface, it is trivial to keep the spelling consistent for test frameworks that have not yet updated to using QMP.

Quoted 8 lines
Quoted 3 lines

With the improved commit message,

Yes, that certainly makes sense.

Right. Seems I got carried away during the thread_id to thread-id conversion.

Signature · 2 lines
Regards,
 Viktor Mihajlovski
#9 lore raw
In reply to [email protected]

[adding the maintainer in cc]

Quoted 7 lines · On 03/27/2018 07:38 AM, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

Quoted 7 lines

This patch just reverts back output format to 'thread_id'.

CC Viktor Mihajlovski <[email protected]>
---
  hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I can take this through my qapi tree if David is happy with it

Quoted 15 lines
hmp.c +1 -1
index 679467d85a..a25c7bd9a8 100644
@@ -381,7 +381,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
 
          monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
                         cpu->value->cpu_index);
-        monitor_printf(mon, " thread-id=%" PRId64 "\n", cpu->value->thread_id);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
      }
 
      qapi_free_CpuInfoFastList(cpu_list);
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#10 lore raw
Quoted 12 lines · * Eric Blake ([email protected]) wrote:

[adding the maintainer in cc]

Quoted 9 lines · On 03/27/2018 07:38 AM, [email protected] wrote:

From: Satheesh Rajendran <[email protected]>

This commit 137b5cb6ab565cb3781d5337591e155932b4230e refactors info cpus output and changes output format from 'thread_id' to 'thread-id', this would break parsing of output in above layers like libvirt, test framework etc.

This patch just reverts back output format to 'thread_id'.

Quoted 7 lines
Quoted 5 lines
CC Viktor Mihajlovski <[email protected]>
---
  hmp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I can take this through my qapi tree if David is happy with it

Yes, with the commit message change you suggested.

Quoted 20 lines
Quoted 14 lines
hmp.c +1 -1
index 679467d85a..a25c7bd9a8 100644
@@ -381,7 +381,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
          monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
                         cpu->value->cpu_index);
-        monitor_printf(mon, " thread-id=%" PRId64 "\n", cpu->value->thread_id);
+        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
      }
      qapi_free_CpuInfoFastList(cpu_list);
 
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK