[libvirt] [PATCH 0/2] qemu: Fix propagation of 'qemu_id' parameter in the vcpus

The propagation code got misplaced in the code that optimizes the extraction of the halted state of the vcpus. Peter Krempa (2): tests: qemumonitorjson: Rename 'qemu-id' to 'enable-id' in cpu info test qemu: monitor: Properly propagate the 'qemu_id' field through the matcher src/qemu/qemu_monitor.c | 3 ++ .../qemumonitorjson-cpuinfo-ppc64-basic.data | 10 ++++++- .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 20 +++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 30 ++++++++++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 30 ++++++++++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 24 ++++++++++------ ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 15 ++++++---- .../qemumonitorjson-cpuinfo-x86-full.data | 33 ++++++++++++++-------- tests/qemumonitorjsontest.c | 5 +++- 9 files changed, 136 insertions(+), 34 deletions(-) -- 2.10.2

The field is named 'enable_id' in other structures and a patch recently added 'qemu_id' which has different semantics. To avoid confusion in the tests rename the field. --- .../qemumonitorjson-cpuinfo-ppc64-basic.data | 2 +- .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 4 ++-- .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 6 +++--- .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 6 +++--- .../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 16 ++++++++-------- ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 10 +++++----- .../qemumonitorjson-cpuinfo-x86-full.data | 22 +++++++++++----------- tests/qemumonitorjsontest.c | 2 +- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data index ae7c2f4..9969648 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='21925' - qemu-id='1' + enable-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data index 5c0a6af..643f6ec 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='21925' - qemu-id='1' + enable-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -38,7 +38,7 @@ online=yes hotpluggable=yes thread-id='22131' - qemu-id='2' + enable-id='2' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data index ba4044e..43780ee 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='21925' - qemu-id='1' + enable-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -38,7 +38,7 @@ online=yes hotpluggable=yes thread-id='22131' - qemu-id='2' + enable-id='2' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' @@ -75,7 +75,7 @@ online=yes hotpluggable=yes thread-id='22223' - qemu-id='3' + enable-id='3' type='host-spapr-cpu-core' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data index d2c56ef..dfa2d3f 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='21925' - qemu-id='1' + enable-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -38,7 +38,7 @@ online=yes hotpluggable=yes thread-id='23170' - qemu-id='3' + enable-id='3' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' @@ -75,7 +75,7 @@ online=yes hotpluggable=yes thread-id='22741' - qemu-id='2' + enable-id='2' type='host-spapr-cpu-core' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data index c2f541b..2519ad3 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='35232' - qemu-id='1' + enable-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='1' @@ -10,7 +10,7 @@ online=yes hotpluggable=no thread-id='35233' - qemu-id='2' + enable-id='2' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[2]' topology: core='8' vcpus='1' @@ -18,7 +18,7 @@ online=yes hotpluggable=no thread-id='35234' - qemu-id='3' + enable-id='3' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[3]' topology: core='16' vcpus='1' @@ -26,7 +26,7 @@ online=yes hotpluggable=no thread-id='35235' - qemu-id='4' + enable-id='4' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[4]' topology: core='24' vcpus='1' @@ -34,7 +34,7 @@ online=yes hotpluggable=no thread-id='35236' - qemu-id='5' + enable-id='5' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[5]' topology: core='32' vcpus='1' @@ -42,7 +42,7 @@ online=yes hotpluggable=no thread-id='35237' - qemu-id='6' + enable-id='6' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[6]' topology: core='40' vcpus='1' @@ -50,7 +50,7 @@ online=yes hotpluggable=no thread-id='35238' - qemu-id='7' + enable-id='7' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[7]' topology: core='48' vcpus='1' @@ -58,7 +58,7 @@ online=yes hotpluggable=no thread-id='35239' - qemu-id='8' + enable-id='8' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[8]' topology: core='56' vcpus='1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data index 67dfc01..1fea077 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='518291' - qemu-id='1' + enable-id='1' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[0]' topology: socket='0' core='0' thread='0' vcpus='1' @@ -10,7 +10,7 @@ online=yes hotpluggable=no thread-id='518292' - qemu-id='2' + enable-id='2' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[2]' topology: socket='0' core='0' thread='1' vcpus='1' @@ -18,7 +18,7 @@ online=yes hotpluggable=no thread-id='518294' - qemu-id='3' + enable-id='3' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[3]' topology: socket='0' core='1' thread='0' vcpus='1' @@ -26,7 +26,7 @@ online=yes hotpluggable=no thread-id='518295' - qemu-id='4' + enable-id='4' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[4]' topology: socket='0' core='1' thread='1' vcpus='1' @@ -34,7 +34,7 @@ online=yes hotpluggable=no thread-id='518296' - qemu-id='5' + enable-id='5' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[5]' topology: socket='1' core='0' thread='0' vcpus='1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data index dba3745..c827892 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data @@ -2,7 +2,7 @@ online=yes hotpluggable=no thread-id='895040' - qemu-id='1' + enable-id='1' type='Broadwell-x86_64-cpu' qom_path='/machine/unattached/device[0]' topology: socket='0' core='0' thread='0' vcpus='1' @@ -10,7 +10,7 @@ online=yes hotpluggable=yes thread-id='895056' - qemu-id='2' + enable-id='2' type='Broadwell-x86_64-cpu' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' @@ -19,7 +19,7 @@ online=yes hotpluggable=yes thread-id='895057' - qemu-id='3' + enable-id='3' type='Broadwell-x86_64-cpu' alias='vcpu2' qom_path='/machine/peripheral/vcpu2' @@ -28,7 +28,7 @@ online=yes hotpluggable=yes thread-id='895058' - qemu-id='4' + enable-id='4' type='Broadwell-x86_64-cpu' alias='vcpu3' qom_path='/machine/peripheral/vcpu3' @@ -37,7 +37,7 @@ online=yes hotpluggable=yes thread-id='895059' - qemu-id='5' + enable-id='5' type='Broadwell-x86_64-cpu' alias='vcpu4' qom_path='/machine/peripheral/vcpu4' @@ -46,7 +46,7 @@ online=yes hotpluggable=yes thread-id='895060' - qemu-id='6' + enable-id='6' type='Broadwell-x86_64-cpu' alias='vcpu5' qom_path='/machine/peripheral/vcpu5' @@ -55,7 +55,7 @@ online=yes hotpluggable=yes thread-id='895061' - qemu-id='7' + enable-id='7' type='Broadwell-x86_64-cpu' alias='vcpu6' qom_path='/machine/peripheral/vcpu6' @@ -64,7 +64,7 @@ online=yes hotpluggable=yes thread-id='895062' - qemu-id='8' + enable-id='8' type='Broadwell-x86_64-cpu' alias='vcpu7' qom_path='/machine/peripheral/vcpu7' @@ -73,7 +73,7 @@ online=yes hotpluggable=yes thread-id='895063' - qemu-id='9' + enable-id='9' type='Broadwell-x86_64-cpu' alias='vcpu8' qom_path='/machine/peripheral/vcpu8' @@ -82,7 +82,7 @@ online=yes hotpluggable=yes thread-id='895064' - qemu-id='10' + enable-id='10' type='Broadwell-x86_64-cpu' alias='vcpu9' qom_path='/machine/peripheral/vcpu9' @@ -91,7 +91,7 @@ online=yes hotpluggable=yes thread-id='895065' - qemu-id='11' + enable-id='11' type='Broadwell-x86_64-cpu' alias='vcpu10' qom_path='/machine/peripheral/vcpu10' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ed4190b..a60f0a0 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2489,7 +2489,7 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus, (unsigned long long) vcpu->tid); if (vcpu->id != 0) - virBufferAsprintf(&buf, "qemu-id='%d'\n", vcpu->id); + virBufferAsprintf(&buf, "enable-id='%d'\n", vcpu->id); if (vcpu->type) virBufferAsprintf(&buf, "type='%s'\n", vcpu->type); -- 2.10.2

Commit 3f71c797689a4a70 added 'qemu_id' field to track the id of the cpu as reported by query-cpus. The patch did not include changes necessary to propagate the id through the functions matching the data to the libvirt cpu structures and thus all vcpus had id 0. --- src/qemu/qemu_monitor.c | 3 +++ .../qemumonitorjson-cpuinfo-ppc64-basic.data | 8 ++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 16 +++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 24 ++++++++++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 24 ++++++++++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 8 ++++++++ ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 5 +++++ .../qemumonitorjson-cpuinfo-x86-full.data | 11 ++++++++++ tests/qemumonitorjsontest.c | 3 +++ 9 files changed, 102 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3ff31e4..3f86887 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1672,6 +1672,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus, for (i = 0; i < ncpus; i++) { cpus[i].id = 0; + cpus[i].qemu_id = -1; cpus[i].socket_id = -1; cpus[i].core_id = -1; cpus[i].thread_id = -1; @@ -1729,6 +1730,7 @@ qemuMonitorGetCPUInfoLegacy(struct qemuMonitorQueryCpusEntry *cpuentries, if (i < ncpuentries) { vcpus[i].tid = cpuentries[i].tid; vcpus[i].halted = cpuentries[i].halted; + vcpus[i].qemu_id = cpuentries[i].qemu_id; } /* for legacy hotplug to work we need to fake the vcpu count added by @@ -1866,6 +1868,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl } } + vcpus[anyvcpu].qemu_id = cpuentries[j].qemu_id; vcpus[anyvcpu].tid = cpuentries[j].tid; vcpus[anyvcpu].halted = cpuentries[j].halted; } diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data index 9969648..eaa797c 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='21925' enable-id='1' + query-cpus-id='0' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -10,30 +11,37 @@ online=yes hotpluggable=no thread-id='21926' + query-cpus-id='1' [vcpu libvirt-id='2'] online=yes hotpluggable=no thread-id='21927' + query-cpus-id='2' [vcpu libvirt-id='3'] online=yes hotpluggable=no thread-id='21928' + query-cpus-id='3' [vcpu libvirt-id='4'] online=yes hotpluggable=no thread-id='21930' + query-cpus-id='4' [vcpu libvirt-id='5'] online=yes hotpluggable=no thread-id='21931' + query-cpus-id='5' [vcpu libvirt-id='6'] online=yes hotpluggable=no thread-id='21932' + query-cpus-id='6' [vcpu libvirt-id='7'] online=yes hotpluggable=no thread-id='21933' + query-cpus-id='7' [vcpu libvirt-id='8'] online=no hotpluggable=yes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data index 643f6ec..a0aca86 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='21925' enable-id='1' + query-cpus-id='0' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -10,35 +11,43 @@ online=yes hotpluggable=no thread-id='21926' + query-cpus-id='1' [vcpu libvirt-id='2'] online=yes hotpluggable=no thread-id='21927' + query-cpus-id='2' [vcpu libvirt-id='3'] online=yes hotpluggable=no thread-id='21928' + query-cpus-id='3' [vcpu libvirt-id='4'] online=yes hotpluggable=no thread-id='21930' + query-cpus-id='4' [vcpu libvirt-id='5'] online=yes hotpluggable=no thread-id='21931' + query-cpus-id='5' [vcpu libvirt-id='6'] online=yes hotpluggable=no thread-id='21932' + query-cpus-id='6' [vcpu libvirt-id='7'] online=yes hotpluggable=no thread-id='21933' + query-cpus-id='7' [vcpu libvirt-id='8'] online=yes hotpluggable=yes thread-id='22131' enable-id='2' + query-cpus-id='8' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' @@ -47,30 +56,37 @@ online=yes hotpluggable=yes thread-id='22132' + query-cpus-id='9' [vcpu libvirt-id='10'] online=yes hotpluggable=yes thread-id='22133' + query-cpus-id='10' [vcpu libvirt-id='11'] online=yes hotpluggable=yes thread-id='22134' + query-cpus-id='11' [vcpu libvirt-id='12'] online=yes hotpluggable=yes thread-id='22135' + query-cpus-id='12' [vcpu libvirt-id='13'] online=yes hotpluggable=yes thread-id='22136' + query-cpus-id='13' [vcpu libvirt-id='14'] online=yes hotpluggable=yes thread-id='22137' + query-cpus-id='14' [vcpu libvirt-id='15'] online=yes hotpluggable=yes thread-id='22138' + query-cpus-id='15' [vcpu libvirt-id='16'] online=no hotpluggable=yes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data index 43780ee..7a367ce 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='21925' enable-id='1' + query-cpus-id='0' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -10,35 +11,43 @@ online=yes hotpluggable=no thread-id='21926' + query-cpus-id='1' [vcpu libvirt-id='2'] online=yes hotpluggable=no thread-id='21927' + query-cpus-id='2' [vcpu libvirt-id='3'] online=yes hotpluggable=no thread-id='21928' + query-cpus-id='3' [vcpu libvirt-id='4'] online=yes hotpluggable=no thread-id='21930' + query-cpus-id='4' [vcpu libvirt-id='5'] online=yes hotpluggable=no thread-id='21931' + query-cpus-id='5' [vcpu libvirt-id='6'] online=yes hotpluggable=no thread-id='21932' + query-cpus-id='6' [vcpu libvirt-id='7'] online=yes hotpluggable=no thread-id='21933' + query-cpus-id='7' [vcpu libvirt-id='8'] online=yes hotpluggable=yes thread-id='22131' enable-id='2' + query-cpus-id='8' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' @@ -47,35 +56,43 @@ online=yes hotpluggable=yes thread-id='22132' + query-cpus-id='9' [vcpu libvirt-id='10'] online=yes hotpluggable=yes thread-id='22133' + query-cpus-id='10' [vcpu libvirt-id='11'] online=yes hotpluggable=yes thread-id='22134' + query-cpus-id='11' [vcpu libvirt-id='12'] online=yes hotpluggable=yes thread-id='22135' + query-cpus-id='12' [vcpu libvirt-id='13'] online=yes hotpluggable=yes thread-id='22136' + query-cpus-id='13' [vcpu libvirt-id='14'] online=yes hotpluggable=yes thread-id='22137' + query-cpus-id='14' [vcpu libvirt-id='15'] online=yes hotpluggable=yes thread-id='22138' + query-cpus-id='15' [vcpu libvirt-id='16'] online=yes hotpluggable=yes thread-id='22223' enable-id='3' + query-cpus-id='16' type='host-spapr-cpu-core' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' @@ -84,27 +101,34 @@ online=yes hotpluggable=yes thread-id='22224' + query-cpus-id='17' [vcpu libvirt-id='18'] online=yes hotpluggable=yes thread-id='22225' + query-cpus-id='18' [vcpu libvirt-id='19'] online=yes hotpluggable=yes thread-id='22226' + query-cpus-id='19' [vcpu libvirt-id='20'] online=yes hotpluggable=yes thread-id='22227' + query-cpus-id='20' [vcpu libvirt-id='21'] online=yes hotpluggable=yes thread-id='22228' + query-cpus-id='21' [vcpu libvirt-id='22'] online=yes hotpluggable=yes thread-id='22229' + query-cpus-id='22' [vcpu libvirt-id='23'] online=yes hotpluggable=yes thread-id='22230' + query-cpus-id='23' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data index dfa2d3f..7c90889 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='21925' enable-id='1' + query-cpus-id='0' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='8' @@ -10,35 +11,43 @@ online=yes hotpluggable=no thread-id='21926' + query-cpus-id='1' [vcpu libvirt-id='2'] online=yes hotpluggable=no thread-id='21927' + query-cpus-id='2' [vcpu libvirt-id='3'] online=yes hotpluggable=no thread-id='21928' + query-cpus-id='3' [vcpu libvirt-id='4'] online=yes hotpluggable=no thread-id='21930' + query-cpus-id='4' [vcpu libvirt-id='5'] online=yes hotpluggable=no thread-id='21931' + query-cpus-id='5' [vcpu libvirt-id='6'] online=yes hotpluggable=no thread-id='21932' + query-cpus-id='6' [vcpu libvirt-id='7'] online=yes hotpluggable=no thread-id='21933' + query-cpus-id='7' [vcpu libvirt-id='8'] online=yes hotpluggable=yes thread-id='23170' enable-id='3' + query-cpus-id='16' type='host-spapr-cpu-core' alias='vcpu0' qom_path='/machine/peripheral/vcpu0' @@ -47,35 +56,43 @@ online=yes hotpluggable=yes thread-id='23171' + query-cpus-id='17' [vcpu libvirt-id='10'] online=yes hotpluggable=yes thread-id='23172' + query-cpus-id='18' [vcpu libvirt-id='11'] online=yes hotpluggable=yes thread-id='23173' + query-cpus-id='19' [vcpu libvirt-id='12'] online=yes hotpluggable=yes thread-id='23174' + query-cpus-id='20' [vcpu libvirt-id='13'] online=yes hotpluggable=yes thread-id='23175' + query-cpus-id='21' [vcpu libvirt-id='14'] online=yes hotpluggable=yes thread-id='23176' + query-cpus-id='22' [vcpu libvirt-id='15'] online=yes hotpluggable=yes thread-id='23177' + query-cpus-id='23' [vcpu libvirt-id='16'] online=yes hotpluggable=yes thread-id='22741' enable-id='2' + query-cpus-id='8' type='host-spapr-cpu-core' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' @@ -84,27 +101,34 @@ online=yes hotpluggable=yes thread-id='22742' + query-cpus-id='9' [vcpu libvirt-id='18'] online=yes hotpluggable=yes thread-id='22743' + query-cpus-id='10' [vcpu libvirt-id='19'] online=yes hotpluggable=yes thread-id='22744' + query-cpus-id='11' [vcpu libvirt-id='20'] online=yes hotpluggable=yes thread-id='22745' + query-cpus-id='12' [vcpu libvirt-id='21'] online=yes hotpluggable=yes thread-id='22746' + query-cpus-id='13' [vcpu libvirt-id='22'] online=yes hotpluggable=yes thread-id='22747' + query-cpus-id='14' [vcpu libvirt-id='23'] online=yes hotpluggable=yes thread-id='22748' + query-cpus-id='15' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data index 2519ad3..2612fa6 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='35232' enable-id='1' + query-cpus-id='0' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[1]' topology: core='0' vcpus='1' @@ -11,6 +12,7 @@ hotpluggable=no thread-id='35233' enable-id='2' + query-cpus-id='1' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[2]' topology: core='8' vcpus='1' @@ -19,6 +21,7 @@ hotpluggable=no thread-id='35234' enable-id='3' + query-cpus-id='2' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[3]' topology: core='16' vcpus='1' @@ -27,6 +30,7 @@ hotpluggable=no thread-id='35235' enable-id='4' + query-cpus-id='3' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[4]' topology: core='24' vcpus='1' @@ -35,6 +39,7 @@ hotpluggable=no thread-id='35236' enable-id='5' + query-cpus-id='4' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[5]' topology: core='32' vcpus='1' @@ -43,6 +48,7 @@ hotpluggable=no thread-id='35237' enable-id='6' + query-cpus-id='5' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[6]' topology: core='40' vcpus='1' @@ -51,6 +57,7 @@ hotpluggable=no thread-id='35238' enable-id='7' + query-cpus-id='6' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[7]' topology: core='48' vcpus='1' @@ -59,6 +66,7 @@ hotpluggable=no thread-id='35239' enable-id='8' + query-cpus-id='7' type='host-spapr-cpu-core' qom_path='/machine/unattached/device[8]' topology: core='56' vcpus='1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data index 1fea077..93cefb9 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='518291' enable-id='1' + query-cpus-id='0' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[0]' topology: socket='0' core='0' thread='0' vcpus='1' @@ -11,6 +12,7 @@ hotpluggable=no thread-id='518292' enable-id='2' + query-cpus-id='1' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[2]' topology: socket='0' core='0' thread='1' vcpus='1' @@ -19,6 +21,7 @@ hotpluggable=no thread-id='518294' enable-id='3' + query-cpus-id='2' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[3]' topology: socket='0' core='1' thread='0' vcpus='1' @@ -27,6 +30,7 @@ hotpluggable=no thread-id='518295' enable-id='4' + query-cpus-id='3' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[4]' topology: socket='0' core='1' thread='1' vcpus='1' @@ -35,6 +39,7 @@ hotpluggable=no thread-id='518296' enable-id='5' + query-cpus-id='4' type='qemu64-x86_64-cpu' qom_path='/machine/unattached/device[5]' topology: socket='1' core='0' thread='0' vcpus='1' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data index c827892..1908e39 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data @@ -3,6 +3,7 @@ hotpluggable=no thread-id='895040' enable-id='1' + query-cpus-id='0' type='Broadwell-x86_64-cpu' qom_path='/machine/unattached/device[0]' topology: socket='0' core='0' thread='0' vcpus='1' @@ -11,6 +12,7 @@ hotpluggable=yes thread-id='895056' enable-id='2' + query-cpus-id='1' type='Broadwell-x86_64-cpu' alias='vcpu1' qom_path='/machine/peripheral/vcpu1' @@ -20,6 +22,7 @@ hotpluggable=yes thread-id='895057' enable-id='3' + query-cpus-id='2' type='Broadwell-x86_64-cpu' alias='vcpu2' qom_path='/machine/peripheral/vcpu2' @@ -29,6 +32,7 @@ hotpluggable=yes thread-id='895058' enable-id='4' + query-cpus-id='3' type='Broadwell-x86_64-cpu' alias='vcpu3' qom_path='/machine/peripheral/vcpu3' @@ -38,6 +42,7 @@ hotpluggable=yes thread-id='895059' enable-id='5' + query-cpus-id='4' type='Broadwell-x86_64-cpu' alias='vcpu4' qom_path='/machine/peripheral/vcpu4' @@ -47,6 +52,7 @@ hotpluggable=yes thread-id='895060' enable-id='6' + query-cpus-id='5' type='Broadwell-x86_64-cpu' alias='vcpu5' qom_path='/machine/peripheral/vcpu5' @@ -56,6 +62,7 @@ hotpluggable=yes thread-id='895061' enable-id='7' + query-cpus-id='6' type='Broadwell-x86_64-cpu' alias='vcpu6' qom_path='/machine/peripheral/vcpu6' @@ -65,6 +72,7 @@ hotpluggable=yes thread-id='895062' enable-id='8' + query-cpus-id='7' type='Broadwell-x86_64-cpu' alias='vcpu7' qom_path='/machine/peripheral/vcpu7' @@ -74,6 +82,7 @@ hotpluggable=yes thread-id='895063' enable-id='9' + query-cpus-id='8' type='Broadwell-x86_64-cpu' alias='vcpu8' qom_path='/machine/peripheral/vcpu8' @@ -83,6 +92,7 @@ hotpluggable=yes thread-id='895064' enable-id='10' + query-cpus-id='9' type='Broadwell-x86_64-cpu' alias='vcpu9' qom_path='/machine/peripheral/vcpu9' @@ -92,6 +102,7 @@ hotpluggable=yes thread-id='895065' enable-id='11' + query-cpus-id='10' type='Broadwell-x86_64-cpu' alias='vcpu10' qom_path='/machine/peripheral/vcpu10' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index a60f0a0..a7d4d5a 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2491,6 +2491,9 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus, if (vcpu->id != 0) virBufferAsprintf(&buf, "enable-id='%d'\n", vcpu->id); + if (vcpu->qemu_id != -1) + virBufferAsprintf(&buf, "query-cpus-id='%d'\n", vcpu->qemu_id); + if (vcpu->type) virBufferAsprintf(&buf, "type='%s'\n", vcpu->type); -- 2.10.2

On 22.11.2016 10:51, Peter Krempa wrote:
Commit 3f71c797689a4a70 added 'qemu_id' field to track the id of the cpu as reported by query-cpus. The patch did not include changes necessary to propagate the id through the functions matching the data to the libvirt cpu structures and thus all vcpus had id 0. --- src/qemu/qemu_monitor.c | 3 +++ .../qemumonitorjson-cpuinfo-ppc64-basic.data | 8 ++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 16 +++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 24 ++++++++++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 24 ++++++++++++++++++++++ .../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 8 ++++++++ ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 5 +++++ .../qemumonitorjson-cpuinfo-x86-full.data | 11 ++++++++++ tests/qemumonitorjsontest.c | 3 +++ 9 files changed, 102 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3ff31e4..3f86887 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1672,6 +1672,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus,
for (i = 0; i < ncpus; i++) { cpus[i].id = 0; + cpus[i].qemu_id = -1; cpus[i].socket_id = -1; cpus[i].core_id = -1; cpus[i].thread_id = -1; @@ -1729,6 +1730,7 @@ qemuMonitorGetCPUInfoLegacy(struct qemuMonitorQueryCpusEntry *cpuentries, if (i < ncpuentries) { vcpus[i].tid = cpuentries[i].tid; vcpus[i].halted = cpuentries[i].halted; + vcpus[i].qemu_id = cpuentries[i].qemu_id; }
/* for legacy hotplug to work we need to fake the vcpu count added by @@ -1866,6 +1868,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl } }
+ vcpus[anyvcpu].qemu_id = cpuentries[j].qemu_id; vcpus[anyvcpu].tid = cpuentries[j].tid; vcpus[anyvcpu].halted = cpuentries[j].halted; } Looks good to me. Since presently s390 does only support legacy hotplug w/o unplug, the second hunk will essentially do the trick. [...]
Thanks! -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Tue, Nov 22, 2016 at 10:51:09AM +0100, Peter Krempa wrote:
The propagation code got misplaced in the code that optimizes the extraction of the halted state of the vcpus.
Peter Krempa (2): tests: qemumonitorjson: Rename 'qemu-id' to 'enable-id' in cpu info test qemu: monitor: Properly propagate the 'qemu_id' field through the matcher
src/qemu/qemu_monitor.c | 3 ++ .../qemumonitorjson-cpuinfo-ppc64-basic.data | 10 ++++++- .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data | 20 +++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data | 30 ++++++++++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 30 ++++++++++++++++++-- .../qemumonitorjson-cpuinfo-ppc64-no-threads.data | 24 ++++++++++------ ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 15 ++++++---- .../qemumonitorjson-cpuinfo-x86-full.data | 33 ++++++++++++++-------- tests/qemumonitorjsontest.c | 5 +++- 9 files changed, 136 insertions(+), 34 deletions(-)
ACK series, Jan
participants (3)
-
Ján Tomko
-
Peter Krempa
-
Viktor Mihajlovski