src/qemu/qemu_command.c | 4 + src/qemu/qemu_domain.c | 1 + src/qemu/qemu_domain.h | 1 + src/qemu/qemu_monitor.c | 2 + src/qemu/qemu_monitor.h | 1 + ...qemumonitorjson-cpuinfo-x86-node-full-cpus.json | 35 +++++++++ ...umonitorjson-cpuinfo-x86-node-full-hotplug.json | 87 ++++++++++++++++++++++ .../qemumonitorjson-cpuinfo-x86-node-full.data | 48 ++++++++++++ tests/qemumonitorjsontest.c | 3 + 9 files changed, 182 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
vcpu properties gathered from query-hotpluggable cpus need to be passed
back to qemu. As qemu did not use the node-id property until now and
libvirt forgot to pass it back properly (it was parsed but not passed
around) we did not honor this.
This patch adds node-id to the structures where it was missing and
passes it around as necessary.
The test data was generated with a VM with following config:
<numa>
<cell id='0' cpus='0,2,4,6' memory='512000' unit='KiB'/>
<cell id='1' cpus='1,3,5,7' memory='512000' unit='KiB'/>
</numa>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452053
---
src/qemu/qemu_command.c | 4 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_monitor.c | 2 +
src/qemu/qemu_monitor.h | 1 +
...qemumonitorjson-cpuinfo-x86-node-full-cpus.json | 35 +++++++++
...umonitorjson-cpuinfo-x86-node-full-hotplug.json | 87 ++++++++++++++++++++++
.../qemumonitorjson-cpuinfo-x86-node-full.data | 48 ++++++++++++
tests/qemumonitorjsontest.c | 3 +
9 files changed, 182 insertions(+)
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c53ab97b9..3fe291863 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10508,6 +10508,10 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0)
goto error;
+ if (vcpupriv->node_id != -1 &&
+ virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0)
+ goto error;
+
return ret;
error:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8e7404da6..0d9cd94b2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6986,6 +6986,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
vcpupriv->socket_id = info[i].socket_id;
vcpupriv->core_id = info[i].core_id;
vcpupriv->thread_id = info[i].thread_id;
+ vcpupriv->node_id = info[i].node_id;
vcpupriv->vcpus = info[i].vcpus;
VIR_FREE(vcpupriv->type);
VIR_STEAL_PTR(vcpupriv->type, info[i].type);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index aae322473..365b23c96 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -359,6 +359,7 @@ struct _qemuDomainVcpuPrivate {
int socket_id;
int core_id;
int thread_id;
+ int node_id;
int vcpus;
};
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5c29b3763..2b0afcc21 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1750,6 +1750,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus,
cpus[i].socket_id = -1;
cpus[i].core_id = -1;
cpus[i].thread_id = -1;
+ cpus[i].node_id = -1;
cpus[i].vcpus = 0;
cpus[i].tid = 0;
cpus[i].halted = false;
@@ -1902,6 +1903,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id;
vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id;
vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id;
+ vcpus[mastervcpu].node_id = hotplugvcpus[i].node_id;
vcpus[mastervcpu].vcpus = hotplugvcpus[i].vcpus;
VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path);
VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 8956bf929..1697db55c 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -483,6 +483,7 @@ struct _qemuMonitorCPUInfo {
int socket_id;
int core_id;
int thread_id;
+ int node_id;
unsigned int vcpus; /* number of vcpus added if given entry is hotplugged */
/* name of the qemu type to add in case of hotplug */
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
new file mode 100644
index 000000000..6b39efa69
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json
@@ -0,0 +1,35 @@
+{
+ "return": [
+ {
+ "arch": "x86",
+ "current": true,
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "CPU": 0,
+ "qom_path": "/machine/unattached/device[0]",
+ "pc": 1048956,
+ "halted": true,
+ "thread_id": 2033724
+ },
+ {
+ "arch": "x86",
+ "current": false,
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "CPU": 1,
+ "qom_path": "/machine/unattached/device[2]",
+ "pc": 1037318,
+ "halted": true,
+ "thread_id": 2033725
+ }
+ ],
+ "id": "libvirt-21"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
new file mode 100644
index 000000000..dfddd9632
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json
@@ -0,0 +1,87 @@
+{
+ "return": [
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 1
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 1,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 1,
+ "node-id": 1,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[2]",
+ "type": "Broadwell-x86_64-cpu"
+ },
+ {
+ "props": {
+ "core-id": 0,
+ "thread-id": 0,
+ "node-id": 0,
+ "socket-id": 0
+ },
+ "vcpus-count": 1,
+ "qom-path": "/machine/unattached/device[0]",
+ "type": "Broadwell-x86_64-cpu"
+ }
+ ],
+ "id": "libvirt-20"
+}
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
new file mode 100644
index 000000000..070ea084e
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data
@@ -0,0 +1,48 @@
+[vcpu libvirt-id='0']
+ online=yes
+ hotpluggable=no
+ thread-id='2033724'
+ 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' node='0' vcpus='1'
+[vcpu libvirt-id='1']
+ online=yes
+ hotpluggable=no
+ thread-id='2033725'
+ enable-id='2'
+ query-cpus-id='1'
+ type='Broadwell-x86_64-cpu'
+ qom_path='/machine/unattached/device[2]'
+ topology: socket='0' core='0' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='2']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='0' core='1' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='3']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='0' core='1' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='4']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='0' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='5']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='0' thread='1' node='1' vcpus='1'
+[vcpu libvirt-id='6']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='1' thread='0' node='0' vcpus='1'
+[vcpu libvirt-id='7']
+ online=no
+ hotpluggable=yes
+ type='Broadwell-x86_64-cpu'
+ topology: socket='1' core='1' thread='1' node='1' vcpus='1'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e9f9d47b5..6da27f783 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2604,6 +2604,8 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
virBufferAsprintf(&buf, " core='%d'", vcpu->core_id);
if (vcpu->thread_id != -1)
virBufferAsprintf(&buf, " thread='%d'", vcpu->thread_id);
+ if (vcpu->node_id != -1)
+ virBufferAsprintf(&buf, " node='%d'", vcpu->node_id);
if (vcpu->vcpus != 0)
virBufferAsprintf(&buf, " vcpus='%u'", vcpu->vcpus);
virBufferAddLit(&buf, "\n");
@@ -2913,6 +2915,7 @@ mymain(void)
DO_TEST_CPU_INFO("x86-basic-pluggable", 8);
DO_TEST_CPU_INFO("x86-full", 11);
+ DO_TEST_CPU_INFO("x86-node-full", 8);
DO_TEST_CPU_INFO("ppc64-basic", 24);
DO_TEST_CPU_INFO("ppc64-hotplug-1", 24);
--
2.12.2
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 06/27/2017 10:27 AM, Peter Krempa wrote: > vcpu properties gathered from query-hotpluggable cpus need to be passed > back to qemu. As qemu did not use the node-id property until now and > libvirt forgot to pass it back properly (it was parsed but not passed > around) we did not honor this. > > This patch adds node-id to the structures where it was missing and > passes it around as necessary. > > The test data was generated with a VM with following config: > <numa> > <cell id='0' cpus='0,2,4,6' memory='512000' unit='KiB'/> > <cell id='1' cpus='1,3,5,7' memory='512000' unit='KiB'/> > </numa> > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452053 > --- > src/qemu/qemu_command.c | 4 + > src/qemu/qemu_domain.c | 1 + > src/qemu/qemu_domain.h | 1 + > src/qemu/qemu_monitor.c | 2 + > src/qemu/qemu_monitor.h | 1 + > ...qemumonitorjson-cpuinfo-x86-node-full-cpus.json | 35 +++++++++ > ...umonitorjson-cpuinfo-x86-node-full-hotplug.json | 87 ++++++++++++++++++++++ > .../qemumonitorjson-cpuinfo-x86-node-full.data | 48 ++++++++++++ > tests/qemumonitorjsontest.c | 3 + > 9 files changed, 182 insertions(+) > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data > Searching through sources for 'core_id', 'socket_id', and 'thread_id' - would qemuProcessValidateHotpluggableVcpus need to be adjusted as well? Reviewed-by: John Ferlan <jferlan@redhat.com> John FWIW: Perhaps missed as part of commit '1213f0f8a' the comments to qemuMonitorJSONProcessHotpluggableCpusReply do not include node-id. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Jul 10, 2017 at 06:47:57 -0400, John Ferlan wrote: > > > On 06/27/2017 10:27 AM, Peter Krempa wrote: > > vcpu properties gathered from query-hotpluggable cpus need to be passed > > back to qemu. As qemu did not use the node-id property until now and > > libvirt forgot to pass it back properly (it was parsed but not passed > > around) we did not honor this. > > > > This patch adds node-id to the structures where it was missing and > > passes it around as necessary. > > > > The test data was generated with a VM with following config: > > <numa> > > <cell id='0' cpus='0,2,4,6' memory='512000' unit='KiB'/> > > <cell id='1' cpus='1,3,5,7' memory='512000' unit='KiB'/> > > </numa> > > > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452053 > > --- > > src/qemu/qemu_command.c | 4 + > > src/qemu/qemu_domain.c | 1 + > > src/qemu/qemu_domain.h | 1 + > > src/qemu/qemu_monitor.c | 2 + > > src/qemu/qemu_monitor.h | 1 + > > ...qemumonitorjson-cpuinfo-x86-node-full-cpus.json | 35 +++++++++ > > ...umonitorjson-cpuinfo-x86-node-full-hotplug.json | 87 ++++++++++++++++++++++ > > .../qemumonitorjson-cpuinfo-x86-node-full.data | 48 ++++++++++++ > > tests/qemumonitorjsontest.c | 3 + > > 9 files changed, 182 insertions(+) > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-cpus.json > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full-hotplug.json > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data > > > > Searching through sources for 'core_id', 'socket_id', and 'thread_id' - > would qemuProcessValidateHotpluggableVcpus need to be adjusted as well? Good point. Since the node_id stuff was added later to qemu it should not break that condition, but I'll certainly add it there as well before pushing. > > Reviewed-by: John Ferlan <jferlan@redhat.com> > > John > > FWIW: Perhaps missed as part of commit '1213f0f8a' the comments to > qemuMonitorJSONProcessHotpluggableCpusReply do not include node-id. It wasn't reported by qemu at that time, so I just forgot to propagate it further since it worked ... -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.