From nobody Thu May 2 02:48:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498573648341224.46680129644255; Tue, 27 Jun 2017 07:27:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37D1CFEEE2; Tue, 27 Jun 2017 14:27:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8509E95336; Tue, 27 Jun 2017 14:27:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8331C1841C41; Tue, 27 Jun 2017 14:27:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5RERG32004918 for ; Tue, 27 Jun 2017 10:27:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id CD45E843AA; Tue, 27 Jun 2017 14:27:16 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id C749E843BD; Tue, 27 Jun 2017 14:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 37D1CFEEE2 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 37D1CFEEE2 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 27 Jun 2017 16:27:10 +0200 Message-Id: <919368a724a3637221f965a24137ecffddede3ed.1498573630.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH] qemu: domain: Use vcpu 'node-id' property and pass it back to qemu X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 27 Jun 2017 14:27:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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: Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1452053 Reviewed-by: John Ferlan --- 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-n= ode-full-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-n= ode-full-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-n= ode-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 virDomainVcpuD= ef *vcpu) virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NUL= L) < 0) goto error; + if (vcpupriv->node_id !=3D -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 =3D info[i].socket_id; vcpupriv->core_id =3D info[i].core_id; vcpupriv->thread_id =3D info[i].thread_id; + vcpupriv->node_id =3D info[i].node_id; vcpupriv->vcpus =3D 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 =3D -1; cpus[i].core_id =3D -1; cpus[i].thread_id =3D -1; + cpus[i].node_id =3D -1; cpus[i].vcpus =3D 0; cpus[i].tid =3D 0; cpus[i].halted =3D false; @@ -1902,6 +1903,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl vcpus[mastervcpu].socket_id =3D hotplugvcpus[i].socket_id; vcpus[mastervcpu].core_id =3D hotplugvcpus[i].core_id; vcpus[mastervcpu].thread_id =3D hotplugvcpus[i].thread_id; + vcpus[mastervcpu].node_id =3D hotplugvcpus[i].node_id; vcpus[mastervcpu].vcpus =3D 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 hotplug= ged */ /* name of the qemu type to add in case of hotplug */ diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-ful= l-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-fu= ll-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-ful= l-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-hotpl= ug.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-ful= l.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.da= ta 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=3D'0'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'2033724' + enable-id=3D'1' + query-cpus-id=3D'0' + type=3D'Broadwell-x86_64-cpu' + qom_path=3D'/machine/unattached/device[0]' + topology: socket=3D'0' core=3D'0' thread=3D'0' node=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'1'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'2033725' + enable-id=3D'2' + query-cpus-id=3D'1' + type=3D'Broadwell-x86_64-cpu' + qom_path=3D'/machine/unattached/device[2]' + topology: socket=3D'0' core=3D'0' thread=3D'1' node=3D'1' vcpus=3D'1' +[vcpu libvirt-id=3D'2'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'0' core=3D'1' thread=3D'0' node=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'3'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'0' core=3D'1' thread=3D'1' node=3D'1' vcpus=3D'1' +[vcpu libvirt-id=3D'4'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'1' core=3D'0' thread=3D'0' node=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'5'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'1' core=3D'0' thread=3D'1' node=3D'1' vcpus=3D'1' +[vcpu libvirt-id=3D'6'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'1' core=3D'1' thread=3D'0' node=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'7'] + online=3Dno + hotpluggable=3Dyes + type=3D'Broadwell-x86_64-cpu' + topology: socket=3D'1' core=3D'1' thread=3D'1' node=3D'1' vcpus=3D'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 vc= pus, virBufferAsprintf(&buf, " core=3D'%d'", vcpu->core_id); if (vcpu->thread_id !=3D -1) virBufferAsprintf(&buf, " thread=3D'%d'", vcpu->thread_id); + if (vcpu->node_id !=3D -1) + virBufferAsprintf(&buf, " node=3D'%d'", vcpu->node_id); if (vcpu->vcpus !=3D 0) virBufferAsprintf(&buf, " vcpus=3D'%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); --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list