From nobody Sun Apr 28 16:36:54 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.zohomail.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 1520250290523916.1271483626814; Mon, 5 Mar 2018 03:44:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 162172821D; Mon, 5 Mar 2018 11:44:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2BF2605DC; Mon, 5 Mar 2018 11:44:48 +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 A97494A471; Mon, 5 Mar 2018 11:44:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25Bikp8010472 for ; Mon, 5 Mar 2018 06:44:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0B7B45D962; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 053105D960 for ; Mon, 5 Mar 2018 11:44:43 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF628C04BE1B for ; Mon, 5 Mar 2018 11:44:42 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25BiZYh048878 for ; Mon, 5 Mar 2018 06:44:42 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gh2ccqe2g-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:39 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:33 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:31 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25BiVVE58917092; Mon, 5 Mar 2018 11:44:31 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 546E15203F; Mon, 5 Mar 2018 10:36:11 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2C46652041; Mon, 5 Mar 2018 10:36:11 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:24 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0040-0000-0000-0000043ADFF8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0041-0000-0000-000020DDF167 Message-Id: <1520250269-12295-2-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Mar 2018 11:44:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Mar 2018 11:44:43 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 1/6] qemu: add capability detection for query-cpus-fast 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 05 Mar 2018 11:44:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Detect whether QEMU supports the QMP query-cpus-fast API and set QEMU_CAPS_QUERY_CPUS_FAST in this case. Signed-off-by: Viktor Mihajlovski Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer Acked-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 4 +++- src/qemu/qemu_capabilities.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b5eb8cf..6635f5e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -459,6 +459,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "pl011", "machine.pseries.max-cpu-compat", "dump-completed", + "query-cpus-fast", ); =20 =20 @@ -1579,7 +1580,8 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = =3D { { "query-qmp-schema", QEMU_CAPS_QUERY_QMP_SCHEMA }, { "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION}, { "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS}, - { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES} + { "query-named-block-nodes", QEMU_CAPS_QUERY_NAMED_BLOCK_NODES}, + { "query-cpus-fast", QEMU_CAPS_QUERY_CPUS_FAST} }; =20 struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index c2ec2be..e3c31ab 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -444,6 +444,7 @@ typedef enum { QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-= compat=3D */ QEMU_CAPS_DUMP_COMPLETED, /* DUMP_COMPLETED event */ + QEMU_CAPS_QUERY_CPUS_FAST, /* query-cpus-fast command */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 16:36:54 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.zohomail.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 1520250288835350.19955922556005; Mon, 5 Mar 2018 03:44:48 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06FCB2F30A5; Mon, 5 Mar 2018 11:44:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDE8662462; Mon, 5 Mar 2018 11:44:46 +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 49D0C4A46D; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25BiidW010464 for ; Mon, 5 Mar 2018 06:44:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id D20506062A; Mon, 5 Mar 2018 11:44:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C79E46061E for ; Mon, 5 Mar 2018 11:44:40 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEE114E90E for ; Mon, 5 Mar 2018 11:44:38 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25BiZf1048879 for ; Mon, 5 Mar 2018 06:44:38 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gh2ccqe2x-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:37 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:34 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:33 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25BiWrO54329576; Mon, 5 Mar 2018 11:44:32 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8141952043; Mon, 5 Mar 2018 10:36:12 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 585175203F; Mon, 5 Mar 2018 10:36:12 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:25 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0040-0000-0000-0000043ADFF9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0041-0000-0000-000020DDF169 Message-Id: <1520250269-12295-3-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Mar 2018 11:44:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Mar 2018 11:44:39 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 2/6] qemu: use query-cpus-fast in JSON monitor 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 05 Mar 2018 11:44:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use query-cpus-fast instead of query-cpus if supported by QEMU. Based on the QEMU_CAPS_QUERY_CPUS_FAST capability. Signed-off-by: Viktor Mihajlovski --- src/qemu/qemu_domain.c | 12 ++++++++++-- src/qemu/qemu_monitor.c | 30 ++++++++++++++++++------------ src/qemu/qemu_monitor.h | 7 +++++-- src/qemu/qemu_monitor_json.c | 37 +++++++++++++++++++++++++++---------- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 4 ++-- 6 files changed, 64 insertions(+), 29 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8b4efc8..4079fb3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8683,7 +8683,12 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; =20 - rc =3D qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus= , hotplug); + rc =3D qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), + &info, + maxvcpus, + hotplug, + virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qem= uCaps, + QEMU_CAPS_QUERY_CPUS_FAST)); =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; @@ -8803,7 +8808,10 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; =20 - haltedmap =3D qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcp= us); + haltedmap =3D qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), + maxvcpus, + virQEMUCapsGet(QEMU_DOMAIN_PRIVATE= (vm)->qemuCaps, + QEMU_CAPS_QUERY_CPU= S_FAST)); =20 if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap) goto cleanup; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ad5c572..22b2091 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1852,15 +1852,16 @@ qemuMonitorGetCPUInfoLegacy(struct qemuMonitorQuery= CpusEntry *cpuentries, * * This function stitches together data retrieved via query-hotpluggable-c= pus * which returns entities on the hotpluggable level (which may describe mo= re - * than one guest logical vcpu) with the output of query-cpus, having an e= ntry - * per enabled guest logical vcpu. + * than one guest logical vcpu) with the output of query-cpus (or + * query-cpus-fast), having an entry per enabled guest logical vcpu. * * query-hotpluggable-cpus conveys following information: * - topology information and number of logical vcpus this entry creates * - device type name of the entry that needs to be used when hotplugging - * - qom path in qemu which can be used to map the entry against query-cpus + * - qom path in qemu which can be used to map the entry against + * query-cpus[-fast] * - * query-cpus conveys following information: + * query-cpus[-fast] conveys following information: * - thread id of a given guest logical vcpu * - order in which the vcpus were inserted * - qom path to allow mapping the two together @@ -1895,7 +1896,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl for (i =3D 0; i < nhotplugvcpus; i++) totalvcpus +=3D hotplugvcpus[i].vcpus; =20 - /* trim '/thread...' suffix from the data returned by query-cpus */ + /* trim '/thread...' suffix from the data returned by query-cpus[-fast= ] */ for (i =3D 0; i < ncpuentries; i++) { if (cpuentries[i].qom_path && (tmp =3D strstr(cpuentries[i].qom_path, "/thread"))) @@ -1908,7 +1909,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl } =20 /* Note the order in which the hotpluggable entities are inserted by - * matching them to the query-cpus entries */ + * matching them to the query-cpus[-fast] entries */ for (i =3D 0; i < ncpuentries; i++) { for (j =3D 0; j < nhotplugvcpus; j++) { if (!cpuentries[i].qom_path || @@ -1963,7 +1964,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl } =20 if (anyvcpu =3D=3D maxvcpus) { - VIR_DEBUG("too many query-cpus entries for a given " + VIR_DEBUG("too many query-cpus[-fast] entries for a given " "query-hotpluggable-cpus entry"); return -1; } @@ -1991,6 +1992,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl * @vcpus: pointer filled by array of qemuMonitorCPUInfo structures * @maxvcpus: total possible number of vcpus * @hotplug: query data relevant for hotplug support + * @fast: use QMP query-cpus-fast if supported * * Detects VCPU information. If qemu doesn't support or fails reporting * information this function will return success as other parts of libvirt @@ -2003,7 +2005,8 @@ int qemuMonitorGetCPUInfo(qemuMonitorPtr mon, qemuMonitorCPUInfoPtr *vcpus, size_t maxvcpus, - bool hotplug) + bool hotplug, + bool fast) { struct qemuMonitorQueryHotpluggableCpusEntry *hotplugcpus =3D NULL; size_t nhotplugcpus =3D 0; @@ -2029,7 +2032,8 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, goto cleanup; =20 if (mon->json) - rc =3D qemuMonitorJSONQueryCPUs(mon, &cpuentries, &ncpuentries, ho= tplug); + rc =3D qemuMonitorJSONQueryCPUs(mon, &cpuentries, &ncpuentries, ho= tplug, + fast); else rc =3D qemuMonitorTextQueryCPUs(mon, &cpuentries, &ncpuentries); =20 @@ -2067,11 +2071,12 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, * qemuMonitorGetCpuHalted: * * Returns a bitmap of vcpu id's that are halted. The id's correspond to t= he - * 'CPU' field as reported by query-cpus'. + * 'CPU' field as reported by query-cpus[-fast]'. */ virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, - size_t maxvcpus) + size_t maxvcpus, + bool fast ATTRIBUTE_UNUSED) { struct qemuMonitorQueryCpusEntry *cpuentries =3D NULL; size_t ncpuentries =3D 0; @@ -2082,7 +2087,8 @@ qemuMonitorGetCpuHalted(qemuMonitorPtr mon, QEMU_CHECK_MONITOR_NULL(mon); =20 if (mon->json) - rc =3D qemuMonitorJSONQueryCPUs(mon, &cpuentries, &ncpuentries, fa= lse); + rc =3D qemuMonitorJSONQueryCPUs(mon, &cpuentries, &ncpuentries, fa= lse, + false); else rc =3D qemuMonitorTextQueryCPUs(mon, &cpuentries, &ncpuentries); =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 954ae88..7b92d41 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -530,8 +530,11 @@ void qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr list, int qemuMonitorGetCPUInfo(qemuMonitorPtr mon, qemuMonitorCPUInfoPtr *vcpus, size_t maxvcpus, - bool hotplug); -virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, size_t maxvcpus); + bool hotplug, + bool fast); +virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, + size_t maxvcpus, + bool fast); =20 int qemuMonitorGetVirtType(qemuMonitorPtr mon, virDomainVirtType *virtType); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a09e93e..6a5fb12 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1466,7 +1466,8 @@ int qemuMonitorJSONSystemReset(qemuMonitorPtr mon) static int qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data, struct qemuMonitorQueryCpusEntry **entries, - size_t *nentries) + size_t *nentries, + bool fast) { struct qemuMonitorQueryCpusEntry *cpus =3D NULL; int ret =3D -1; @@ -1491,11 +1492,19 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data, } =20 /* Some older qemu versions don't report the thread_id so treat th= is as - * non-fatal, simply returning no data */ - ignore_value(virJSONValueObjectGetNumberInt(entry, "CPU", &cpuid)); - ignore_value(virJSONValueObjectGetNumberInt(entry, "thread_id", &t= hread)); - ignore_value(virJSONValueObjectGetBoolean(entry, "halted", &halted= )); - qom_path =3D virJSONValueObjectGetString(entry, "qom_path"); + * non-fatal, simply returning no data. + * The return data of query-cpus-fast has different field names + */ + if (fast) { + ignore_value(virJSONValueObjectGetNumberInt(entry, "cpu-index"= , &cpuid)); + ignore_value(virJSONValueObjectGetNumberInt(entry, "thread-id"= , &thread)); + qom_path =3D virJSONValueObjectGetString(entry, "qom-path"); + } else { + ignore_value(virJSONValueObjectGetNumberInt(entry, "CPU", &cpu= id)); + ignore_value(virJSONValueObjectGetNumberInt(entry, "thread_id"= , &thread)); + ignore_value(virJSONValueObjectGetBoolean(entry, "halted", &ha= lted)); + qom_path =3D virJSONValueObjectGetString(entry, "qom_path"); + } =20 cpus[i].qemu_id =3D cpuid; cpus[i].tid =3D thread; @@ -1520,10 +1529,12 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data, * @mon: monitor object * @entries: filled with detected entries on success * @nentries: number of entries returned + * @force: force exit on error + * @fast: use query-cpus-fast * * Queries qemu for cpu-related information. Failure to execute the comman= d or * extract results does not produce an error as libvirt can continue witho= ut - * this information. + * this information, unless the caller has specified @force =3D=3D true. * * Returns 0 on success, -1 on a fatal error (oom ...) and -2 if the * query failed gracefully. @@ -1532,13 +1543,19 @@ int qemuMonitorJSONQueryCPUs(qemuMonitorPtr mon, struct qemuMonitorQueryCpusEntry **entries, size_t *nentries, - bool force) + bool force, + bool fast) { int ret =3D -1; - virJSONValuePtr cmd =3D qemuMonitorJSONMakeCommand("query-cpus", NULL); + virJSONValuePtr cmd; virJSONValuePtr reply =3D NULL; virJSONValuePtr data; =20 + if (fast) + cmd =3D qemuMonitorJSONMakeCommand("query-cpus-fast", NULL); + else + cmd =3D qemuMonitorJSONMakeCommand("query-cpus", NULL); + if (!cmd) return -1; =20 @@ -1553,7 +1570,7 @@ qemuMonitorJSONQueryCPUs(qemuMonitorPtr mon, goto cleanup; } =20 - ret =3D qemuMonitorJSONExtractCPUInfo(data, entries, nentries); + ret =3D qemuMonitorJSONExtractCPUInfo(data, entries, nentries, fast); =20 cleanup: virJSONValueFree(cmd); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index ec243be..e03299a 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -60,7 +60,8 @@ int qemuMonitorJSONSystemReset(qemuMonitorPtr mon); int qemuMonitorJSONQueryCPUs(qemuMonitorPtr mon, struct qemuMonitorQueryCpusEntry **entries, size_t *nentries, - bool force); + bool force, + bool fast); int qemuMonitorJSONGetVirtType(qemuMonitorPtr mon, virDomainVirtType *virtType); int qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 908ec3a..2e685ce 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1420,7 +1420,7 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const voi= d *data) goto cleanup; =20 if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), - &cpudata, &ncpudata, true) < 0) + &cpudata, &ncpudata, true, false) < 0) goto cleanup; =20 if (ncpudata !=3D 4) { @@ -2716,7 +2716,7 @@ testQemuMonitorCPUInfo(const void *opaque) goto cleanup; =20 rc =3D qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test), - &vcpus, data->maxvcpus, true); + &vcpus, data->maxvcpus, true, false); =20 if (rc < 0) goto cleanup; --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 16:36:54 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.zohomail.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 1520250296365952.5252037999369; Mon, 5 Mar 2018 03:44:56 -0800 (PST) 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 D9959757D5; Mon, 5 Mar 2018 11:44:54 +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 937566062A; Mon, 5 Mar 2018 11:44:54 +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 3AB3E18033EE; Mon, 5 Mar 2018 11:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25Bikni010485 for ; Mon, 5 Mar 2018 06:44:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8541162461; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D10F61F5C for ; Mon, 5 Mar 2018 11:44:43 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1459F85A01 for ; Mon, 5 Mar 2018 11:44:42 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25Bibs1077902 for ; Mon, 5 Mar 2018 06:44:41 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gh2uue7tg-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:41 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:35 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:34 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25BiXuw51576992; Mon, 5 Mar 2018 11:44:33 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE50D52043; Mon, 5 Mar 2018 10:36:13 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 85FC652041; Mon, 5 Mar 2018 10:36:13 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:26 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0040-0000-0000-0000041AE19F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0041-0000-0000-0000261DF05A Message-Id: <1520250269-12295-4-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Mar 2018 11:44:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Mar 2018 11:44:42 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.702 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 3/6] tests: add qemumonitorjson tests for query-cpus-fast 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.26]); Mon, 05 Mar 2018 11:44:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extended the json monitor test program with support for query-cpus-fast and added a sample file set for x86 data obtained using the it. Signed-off-by: Viktor Mihajlovski --- ...qemumonitorjson-cpuinfo-x86-full-fast-cpus.json | 71 +++++++++++++ ...umonitorjson-cpuinfo-x86-full-fast-hotplug.json | 115 +++++++++++++++++= +++ .../qemumonitorjson-cpuinfo-x86-full-fast.data | 109 +++++++++++++++++= ++ tests/qemumonitorjsontest.c | 118 ++++++++++++++++-= ---- tests/qemumonitortestutils.c | 6 ++ tests/qemumonitortestutils.h | 1 + 6 files changed, 394 insertions(+), 26 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-f= ull-fast.data diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-cpus.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fa= st-cpus.json new file mode 100644 index 0000000..88fd2b8 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-cpus.= json @@ -0,0 +1,71 @@ +{ + "return": [ + { + "arch": "x86", + "cpu-index": 0, + "qom-path": "/machine/unattached/device[0]", + "thread-id": 895040 + }, + { + "arch": "x86", + "cpu-index": 1, + "qom-path": "/machine/peripheral/vcpu1", + "thread-id": 895056 + }, + { + "arch": "x86", + "cpu-index": 2, + "qom-path": "/machine/peripheral/vcpu2", + "thread-id": 895057 + }, + { + "arch": "x86", + "cpu-index": 3, + "qom-path": "/machine/peripheral/vcpu3", + "thread-id": 895058 + }, + { + "arch": "x86", + "cpu-index": 4, + "qom-path": "/machine/peripheral/vcpu4", + "thread-id": 895059 + }, + { + "arch": "x86", + "cpu-index": 5, + "qom-path": "/machine/peripheral/vcpu5", + "thread-id": 895060 + }, + { + "arch": "x86", + "cpu-index": 6, + "qom-path": "/machine/peripheral/vcpu6", + "thread-id": 895061 + }, + { + "arch": "x86", + "cpu-index": 7, + "qom-path": "/machine/peripheral/vcpu7", + "thread-id": 895062 + }, + { + "arch": "x86", + "cpu-index": 8, + "qom-path": "/machine/peripheral/vcpu8", + "thread-id": 895063 + }, + { + "arch": "x86", + "cpu-index": 9, + "qom-path": "/machine/peripheral/vcpu9", + "thread-id": 895064 + }, + { + "arch": "x86", + "cpu-index": 10, + "qom-path": "/machine/peripheral/vcpu10", + "thread-id": 895065 + } + ], + "id": "libvirt-52" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t-hotplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full= -fast-hotplug.json new file mode 100644 index 0000000..aff5aa3 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast-hotpl= ug.json @@ -0,0 +1,115 @@ +{ + "return": [ + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 10 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu10", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 9 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu9", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 8 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu8", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 7 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu7", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 6 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu6", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 5 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu5", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 4 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu4", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 3 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu3", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 2 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu2", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/peripheral/vcpu1", + "type": "Broadwell-x86_64-cpu" + }, + { + "props": { + "core-id": 0, + "thread-id": 0, + "socket-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "Broadwell-x86_64-cpu" + } + ], + "id": "libvirt-51" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fas= t.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.da= ta new file mode 100644 index 0000000..1908e39 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full-fast.data @@ -0,0 +1,109 @@ +[vcpu libvirt-id=3D'0'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'895040' + 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' vcpus=3D'1' +[vcpu libvirt-id=3D'1'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895056' + enable-id=3D'2' + query-cpus-id=3D'1' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu1' + qom_path=3D'/machine/peripheral/vcpu1' + topology: socket=3D'1' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'2'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895057' + enable-id=3D'3' + query-cpus-id=3D'2' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu2' + qom_path=3D'/machine/peripheral/vcpu2' + topology: socket=3D'2' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'3'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895058' + enable-id=3D'4' + query-cpus-id=3D'3' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu3' + qom_path=3D'/machine/peripheral/vcpu3' + topology: socket=3D'3' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'4'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895059' + enable-id=3D'5' + query-cpus-id=3D'4' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu4' + qom_path=3D'/machine/peripheral/vcpu4' + topology: socket=3D'4' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'5'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895060' + enable-id=3D'6' + query-cpus-id=3D'5' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu5' + qom_path=3D'/machine/peripheral/vcpu5' + topology: socket=3D'5' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'6'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895061' + enable-id=3D'7' + query-cpus-id=3D'6' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu6' + qom_path=3D'/machine/peripheral/vcpu6' + topology: socket=3D'6' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'7'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895062' + enable-id=3D'8' + query-cpus-id=3D'7' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu7' + qom_path=3D'/machine/peripheral/vcpu7' + topology: socket=3D'7' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'8'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895063' + enable-id=3D'9' + query-cpus-id=3D'8' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu8' + qom_path=3D'/machine/peripheral/vcpu8' + topology: socket=3D'8' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'9'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895064' + enable-id=3D'10' + query-cpus-id=3D'9' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu9' + qom_path=3D'/machine/peripheral/vcpu9' + topology: socket=3D'9' core=3D'0' thread=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'10'] + online=3Dyes + hotpluggable=3Dyes + thread-id=3D'895065' + enable-id=3D'11' + query-cpus-id=3D'10' + type=3D'Broadwell-x86_64-cpu' + alias=3D'vcpu10' + qom_path=3D'/machine/peripheral/vcpu10' + topology: socket=3D'10' core=3D'0' thread=3D'0' vcpus=3D'1' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 2e685ce..a932e39 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1360,6 +1360,42 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(str= uct qemuMonitorQueryCpusEntr return true; } =20 +static int +testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(qemuMonitorTestPtr test, + struct qemuMonitorQueryC= pusEntry *expect, + bool fast, + size_t num) +{ + struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; + size_t ncpudata =3D 0; + size_t i; + int ret =3D -1; + + if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), + &cpudata, &ncpudata, true, fast) < 0) + goto cleanup; + + if (ncpudata !=3D num) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "Expecting ncpupids =3D %zu but got %zu", num, ncpu= data); + goto cleanup; + } + + for (i =3D 0; i < ncpudata; i++) { + if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, + expect + i))= { + virReportError(VIR_ERR_INTERNAL_ERROR, + "vcpu entry %zu does not match expected data", = i); + goto cleanup; + } + } + + ret =3D 0; + + cleanup: + qemuMonitorQueryCpusFree(cpudata, ncpudata); + return ret; +} =20 static int testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data) @@ -1367,15 +1403,16 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) virDomainXMLOptionPtr xmlopt =3D (virDomainXMLOptionPtr)data; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, xmlopt); int ret =3D -1; - struct qemuMonitorQueryCpusEntry *cpudata =3D NULL; - struct qemuMonitorQueryCpusEntry expect[] =3D { - {0, 17622, (char *) "/machine/unattached/device[0]", true}, - {1, 17624, (char *) "/machine/unattached/device[1]", true}, - {2, 17626, (char *) "/machine/unattached/device[2]", true}, - {3, 17628, NULL, true}, + struct qemuMonitorQueryCpusEntry expect_slow[] =3D { + {0, 17622, (char *) "/machine/unattached/device[0]", true}, + {1, 17624, (char *) "/machine/unattached/device[1]", true}, + {2, 17626, (char *) "/machine/unattached/device[2]", true}, + {3, 17628, NULL, true}, + }; + struct qemuMonitorQueryCpusEntry expect_fast[] =3D { + {0, 17629, (char *) "/machine/unattached/device[0]", false}, + {1, 17630, (char *) "/machine/unattached/device[1]", false}, }; - size_t ncpudata =3D 0; - size_t i; =20 if (!test) return -1; @@ -1419,29 +1456,37 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const v= oid *data) "}") < 0) goto cleanup; =20 - if (qemuMonitorJSONQueryCPUs(qemuMonitorTestGetMonitor(test), - &cpudata, &ncpudata, true, false) < 0) + if (qemuMonitorTestAddItem(test, "query-cpus-fast", + "{" + " \"return\": [" + " {" + " \"cpu-index\": 0," + " \"qom-path\": \"/machine/unatt= ached/device[0]\"," + " \"thread-id\": 17629" + " }," + " {" + " \"cpu-index\": 1," + " \"qom-path\": \"/machine/unatt= ached/device[1]\"," + " \"thread-id\": 17630" + " }" + " ]," + " \"id\": \"libvirt-8\"" + "}") < 0) goto cleanup; =20 - if (ncpudata !=3D 4) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Expecting ncpupids =3D 4 but got %zu", ncpudata); + /* query-cpus */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_slo= w, + false, 4)) goto cleanup; - } =20 - for (i =3D 0; i < ncpudata; i++) { - if (!testQemuMonitorJSONqemuMonitorJSONQueryCPUsEqual(cpudata + i, - expect + i))= { - virReportError(VIR_ERR_INTERNAL_ERROR, - "vcpu entry %zu does not match expected data", = i); - goto cleanup; - } - } + /* query-cpus-fast */ + if (testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(test, expect_fas= t, + true, 2)) + goto cleanup; =20 ret =3D 0; =20 cleanup: - qemuMonitorQueryCpusFree(cpudata, ncpudata); qemuMonitorTestFree(test); return ret; } @@ -2612,6 +2657,7 @@ struct testCPUInfoData { const char *name; size_t maxvcpus; virDomainXMLOptionPtr xmlopt; + bool fast; }; =20 =20 @@ -2678,12 +2724,14 @@ testQemuMonitorCPUInfo(const void *opaque) { const struct testCPUInfoData *data =3D opaque; qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, data->xmlop= t); + virDomainObjPtr vm =3D NULL; char *queryCpusFile =3D NULL; char *queryHotpluggableFile =3D NULL; char *dataFile =3D NULL; char *queryCpusStr =3D NULL; char *queryHotpluggableStr =3D NULL; char *actual =3D NULL; + const char *queryCpusFunction; qemuMonitorCPUInfoPtr vcpus =3D NULL; int rc; int ret =3D -1; @@ -2712,11 +2760,20 @@ testQemuMonitorCPUInfo(const void *opaque) queryHotpluggableStr) < 0) goto cleanup; =20 - if (qemuMonitorTestAddItem(test, "query-cpus", queryCpusStr) < 0) + if (data->fast) + queryCpusFunction =3D "query-cpus-fast"; + else + queryCpusFunction =3D "query-cpus"; + + if (qemuMonitorTestAddItem(test, queryCpusFunction, queryCpusStr) < 0) goto cleanup; =20 + vm =3D qemuMonitorTestGetDomainObj(test); + if (!vm) + return -1; + rc =3D qemuMonitorGetCPUInfo(qemuMonitorTestGetMonitor(test), - &vcpus, data->maxvcpus, true, false); + &vcpus, data->maxvcpus, true, data->fast); =20 if (rc < 0) goto cleanup; @@ -2872,7 +2929,15 @@ mymain(void) =20 #define DO_TEST_CPU_INFO(name, maxvcpus) \ do { \ - struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt}; \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, fa= lse}; \ + if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ + &data) < 0) \ + ret =3D -1; \ + } while (0) + +#define DO_TEST_CPU_INFO_FAST(name, maxvcpus) \ + do { \ + struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, tr= ue}; \ if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \ &data) < 0) \ ret =3D -1; \ @@ -2956,6 +3021,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_FAST("x86-full-fast", 11); =20 DO_TEST_CPU_INFO("ppc64-basic", 24); DO_TEST_CPU_INFO("ppc64-hotplug-1", 24); diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 5e30fb0..b20d59a 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1439,3 +1439,9 @@ qemuMonitorTestGetAgent(qemuMonitorTestPtr test) { return test->agent; } + +virDomainObjPtr +qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test) +{ + return test->vm; +} diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 8b19b37..3604a1b 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -96,5 +96,6 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test); =20 qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test); qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test); +virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test); =20 #endif /* __VIR_QEMU_MONITOR_TEST_UTILS_H__ */ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 16:36:54 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.zohomail.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 152025029675279.33128297146425; Mon, 5 Mar 2018 03:44:56 -0800 (PST) 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 61BE77FEC2; Mon, 5 Mar 2018 11:44:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AC9817AB1; Mon, 5 Mar 2018 11:44:55 +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 CEF2B4A473; Mon, 5 Mar 2018 11:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25BikUa010486 for ; Mon, 5 Mar 2018 06:44:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 858BE62462; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D1CE61F5E for ; Mon, 5 Mar 2018 11:44:45 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B4F64DD49 for ; Mon, 5 Mar 2018 11:44:44 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25BiQKN029998 for ; Mon, 5 Mar 2018 06:44:44 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gh3gg4r87-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:42 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:37 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:35 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25BiZs860620970; Mon, 5 Mar 2018 11:44:35 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9FD652043; Mon, 5 Mar 2018 10:36:14 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B2D505203F; Mon, 5 Mar 2018 10:36:14 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:27 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0040-0000-0000-0000043ADFFB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0041-0000-0000-000020DDF16C Message-Id: <1520250269-12295-5-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Mar 2018 11:44:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 05 Mar 2018 11:44:44 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.702 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 4/6] qemu: add architecture-specific CPU info handling 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.25]); Mon, 05 Mar 2018 11:44:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extract architecture specific data from query-cpus[-fast] if available. A new function qemuMonitorJSONExtractCPUArchInfo() uses a call-back table to find and call architecture-specific extraction handlers. Initially, there's a handler for s390 cpu info to set the halted property depending on the s390 cpu state returned by QEMU. With this it's still possible to report the halted condition even when using query-cpus-fast. Signed-off-by: Viktor Mihajlovski --- src/qemu/qemu_monitor.c | 4 +-- src/qemu/qemu_monitor_json.c | 79 ++++++++++++++++++++++++++++++++++++++++= ++-- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 22b2091..5840e25 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2076,7 +2076,7 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon, virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, size_t maxvcpus, - bool fast ATTRIBUTE_UNUSED) + bool fast) { struct qemuMonitorQueryCpusEntry *cpuentries =3D NULL; size_t ncpuentries =3D 0; @@ -2088,7 +2088,7 @@ qemuMonitorGetCpuHalted(qemuMonitorPtr mon, =20 if (mon->json) rc =3D qemuMonitorJSONQueryCPUs(mon, &cpuentries, &ncpuentries, fa= lse, - false); + fast); else rc =3D qemuMonitorTextQueryCPUs(mon, &cpuentries, &ncpuentries); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6a5fb12..1924cfe 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1451,15 +1451,85 @@ int qemuMonitorJSONSystemReset(qemuMonitorPtr mon) } =20 =20 -/* +/** + * qemuMonitorJSONExtractCPUS390Info: + * @jsoncpu: pointer to a single JSON cpu entry + * @cpu: pointer to a single cpu entry + * + * Derive the legacy cpu info 'halted' information + * from the more accurate s390 cpu state. @cpu is + * modified only on success. + * + * Note: the 'uninitialized' s390 cpu state can't be + * mapped to halted yes/no. + * + * A s390 cpu entry could look like this + * { "arch": "s390", + * "cpu-index": 0, + * "qom-path": "/machine/unattached/device[0]", + * "thread_id": 3081, + * "cpu-state": "operating" } + * + */ +static void +qemuMonitorJSONExtractCPUS390Info(virJSONValuePtr jsoncpu, + struct qemuMonitorQueryCpusEntry *cpu) +{ + const char *cpu_state =3D virJSONValueObjectGetString(jsoncpu, "cpu-st= ate"); + + if (STREQ_NULLABLE(cpu_state, "operating") || + STREQ_NULLABLE(cpu_state, "load")) + cpu->halted =3D false; + else if (STREQ_NULLABLE(cpu_state, "stopped") || + STREQ_NULLABLE(cpu_state, "check-stop")) + cpu->halted =3D true; +} + +/** + * qemuMonitorJSONExtractCPUArchInfo: + * @arch: virtual CPU's architecture + * @jsoncpu: pointer to a single JSON cpu entry + * @cpu: pointer to a single cpu entry * + * Extracts architecure specific virtual CPU data for a single + * CPU from the QAPI response using an architecture specific + * function. + * + */ +static void +qemuMonitorJSONExtractCPUArchInfo(const char *arch, + virJSONValuePtr jsoncpu, + struct qemuMonitorQueryCpusEntry *cpu) +{ + if (STREQ_NULLABLE(arch, "s390")) + qemuMonitorJSONExtractCPUS390Info(jsoncpu, cpu); +} + +/** + * qemuMonitorJSONExtractCPUArchInfo: + * @data: JSON response data + * @entries: filled with detected cpu entries on success + * @nentries: number of entries returned + * @fast: true if this is a response from query-cpus-fast + * + * The JSON response @data will have the following format + * in case @fast =3D=3D false * [{ "arch": "x86", * "current": true, * "CPU": 0, * "qom_path": "/machine/unattached/device[0]", * "pc": -2130415978, * "halted": true, - * "thread_id": 2631237}, + * "thread_id": 2631237, + * ...}, + * {...} + * ] + * and for @fast =3D=3D true + * [{ "arch": "x86", + * "cpu-index": 0, + * "qom-path": "/machine/unattached/device[0]", + * "thread_id": 2631237, + * ...}, * {...} * ] */ @@ -1486,6 +1556,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data, int thread =3D 0; bool halted =3D false; const char *qom_path; + const char *arch; if (!entry) { ret =3D -2; goto cleanup; @@ -1511,6 +1582,10 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data, cpus[i].halted =3D halted; if (VIR_STRDUP(cpus[i].qom_path, qom_path) < 0) goto cleanup; + + /* process optional architecture-specific data */ + arch =3D virJSONValueObjectGetString(entry, "arch"); + qemuMonitorJSONExtractCPUArchInfo(arch, entry, cpus + i); } =20 VIR_STEAL_PTR(*entries, cpus); --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 16:36:54 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.zohomail.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 1520250293447424.4754789348625; Mon, 5 Mar 2018 03:44:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F63981DFA; Mon, 5 Mar 2018 11:44:52 +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 DEF615D964; Mon, 5 Mar 2018 11:44:51 +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 A56CA18033EB; Mon, 5 Mar 2018 11:44:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25BikgE010479 for ; Mon, 5 Mar 2018 06:44:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 430705F707; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C9D2177E9 for ; Mon, 5 Mar 2018 11:44:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28746C04BE22 for ; Mon, 5 Mar 2018 11:44:43 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25Biatd035465 for ; Mon, 5 Mar 2018 06:44:42 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gh3ggvgu4-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:41 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:38 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:36 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25Bia6O55115860; Mon, 5 Mar 2018 11:44:36 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1242A52045; Mon, 5 Mar 2018 10:36:16 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id DED5752041; Mon, 5 Mar 2018 10:36:15 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:28 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0008-0000-0000-000004D7DD76 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0009-0000-0000-00001E6AEEB2 Message-Id: <1520250269-12295-6-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Mar 2018 11:44:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Mar 2018 11:44:43 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.702 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 5/6] tests: add testcase for s390 query-cpus-fast 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Mar 2018 11:44:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The s390 testcase verifies that the s390-specific cpu-state field is correctly mapped to the halted property. Since a few of the x86 and ppc testcases return "halted": "true" it was necessary to update the respective .data files. Signed-off-by: Viktor Mihajlovski Reviewed-by: Boris Fiuczynski --- .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data | 8 ++++++++ .../qemumonitorjson-cpuinfo-s390-fast-cpus.json | 21 +++++++++++++++++= ++++ .../qemumonitorjson-cpuinfo-s390-fast-hotplug.json | 21 +++++++++++++++++= ++++ .../qemumonitorjson-cpuinfo-s390-fast.data | 19 +++++++++++++++++= ++ ...qemumonitorjson-cpuinfo-x86-basic-pluggable.data | 5 +++++ .../qemumonitorjson-cpuinfo-x86-node-full.data | 2 ++ tests/qemumonitorjsontest.c | 5 +++++ 7 files changed, 81 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-= fast-cpus.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-= fast-hotplug.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-= fast.data diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplu= g-4.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-= 4.data index 7c90889..5f6b865 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data @@ -52,41 +52,49 @@ alias=3D'vcpu0' qom_path=3D'/machine/peripheral/vcpu0' topology: core=3D'8' vcpus=3D'8' + halted [vcpu libvirt-id=3D'9'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23171' query-cpus-id=3D'17' + halted [vcpu libvirt-id=3D'10'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23172' query-cpus-id=3D'18' + halted [vcpu libvirt-id=3D'11'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23173' query-cpus-id=3D'19' + halted [vcpu libvirt-id=3D'12'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23174' query-cpus-id=3D'20' + halted [vcpu libvirt-id=3D'13'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23175' query-cpus-id=3D'21' + halted [vcpu libvirt-id=3D'14'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23176' query-cpus-id=3D'22' + halted [vcpu libvirt-id=3D'15'] online=3Dyes hotpluggable=3Dyes thread-id=3D'23177' query-cpus-id=3D'23' + halted [vcpu libvirt-id=3D'16'] online=3Dyes hotpluggable=3Dyes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-cp= us.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-cpus.= json new file mode 100644 index 0000000..4082e0e --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-cpus.json @@ -0,0 +1,21 @@ +{ + "return": [ + { + "arch": "s390", + "cpu-index": 0, + "props": {"core-id": 0}, + "qom-path": "/machine/unattached/device[0]", + "thread-id": 89504, + "cpu-state": "operating" + }, + { + "arch": "s390", + "cpu-index": 1, + "props": {"core-id": 1}, + "qom-path": "/machine/unattached/device[1]", + "thread-id": 89505, + "cpu-state": "stopped" + } + ], + "id": "libvirt-42" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-ho= tplug.json b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-ho= tplug.json new file mode 100644 index 0000000..8016b5b --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast-hotplug.j= son @@ -0,0 +1,21 @@ +{ + "return": [ + { + "props": { + "core-id": 1 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[1]", + "type": "host-s390x-cpu" + }, + { + "props": { + "core-id": 0 + }, + "vcpus-count": 1, + "qom-path": "/machine/unattached/device[0]", + "type": "host-s390x-cpu" + } + ], + "id": "libvirt-41" +} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast.da= ta b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast.data new file mode 100644 index 0000000..9fc7041 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-s390-fast.data @@ -0,0 +1,19 @@ +[vcpu libvirt-id=3D'0'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'89504' + enable-id=3D'1' + query-cpus-id=3D'0' + type=3D'host-s390x-cpu' + qom_path=3D'/machine/unattached/device[0]' + topology: core=3D'0' vcpus=3D'1' +[vcpu libvirt-id=3D'1'] + online=3Dyes + hotpluggable=3Dno + thread-id=3D'89505' + enable-id=3D'2' + query-cpus-id=3D'1' + type=3D'host-s390x-cpu' + qom_path=3D'/machine/unattached/device[1]' + topology: core=3D'1' vcpus=3D'1' + halted diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pl= uggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-= pluggable.data index 93cefb9..9a1788d 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable= .data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable= .data @@ -7,6 +7,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[0]' topology: socket=3D'0' core=3D'0' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'1'] online=3Dyes hotpluggable=3Dno @@ -16,6 +17,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[2]' topology: socket=3D'0' core=3D'0' thread=3D'1' vcpus=3D'1' + halted [vcpu libvirt-id=3D'2'] online=3Dyes hotpluggable=3Dno @@ -25,6 +27,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[3]' topology: socket=3D'0' core=3D'1' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'3'] online=3Dyes hotpluggable=3Dno @@ -34,6 +37,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[4]' topology: socket=3D'0' core=3D'1' thread=3D'1' vcpus=3D'1' + halted [vcpu libvirt-id=3D'4'] online=3Dyes hotpluggable=3Dno @@ -43,6 +47,7 @@ type=3D'qemu64-x86_64-cpu' qom_path=3D'/machine/unattached/device[5]' topology: socket=3D'1' core=3D'0' thread=3D'0' vcpus=3D'1' + halted [vcpu libvirt-id=3D'5'] online=3Dno hotpluggable=3Dyes diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-ful= l.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.da= ta index 070ea08..0f7dbf1 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-node-full.data @@ -7,6 +7,7 @@ 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' + halted [vcpu libvirt-id=3D'1'] online=3Dyes hotpluggable=3Dno @@ -16,6 +17,7 @@ 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' + halted [vcpu libvirt-id=3D'2'] online=3Dno hotpluggable=3Dyes diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index a932e39..c642166 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2712,6 +2712,9 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vc= pus, virBufferAddLit(&buf, "\n"); } =20 + if (vcpu->halted) + virBufferAddLit(&buf, "halted\n"); + virBufferAdjustIndent(&buf, -4); } =20 @@ -3029,6 +3032,8 @@ mymain(void) DO_TEST_CPU_INFO("ppc64-hotplug-4", 24); DO_TEST_CPU_INFO("ppc64-no-threads", 16); =20 + DO_TEST_CPU_INFO_FAST("s390-fast", 2); + #define DO_TEST_BLOCK_NODE_DETECT(testname) \ do { \ if (virTestRun("node-name-detect(" testname ")", \ --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 16:36:54 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.zohomail.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 152025029004678.07363577579349; Mon, 5 Mar 2018 03:44:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B471281DE4; Mon, 5 Mar 2018 11:44:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D06117167; Mon, 5 Mar 2018 11:44:48 +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 5634B4A46F; Mon, 5 Mar 2018 11:44:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w25Bil7n010501 for ; Mon, 5 Mar 2018 06:44:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id F34E95D9C9; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E51685D753 for ; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 275F776531 for ; Mon, 5 Mar 2018 11:44:46 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w25BiaGK035453 for ; Mon, 5 Mar 2018 06:44:45 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gh3ggvgvg-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Mon, 05 Mar 2018 06:44:43 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Mar 2018 11:44:40 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Mar 2018 11:44:37 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w25BibvV55771156; Mon, 5 Mar 2018 11:44:37 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F08E52041; Mon, 5 Mar 2018 10:36:17 +0000 (GMT) Received: from bradbury.ibm.com (unknown [9.152.222.40]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 16D225203F; Mon, 5 Mar 2018 10:36:17 +0000 (GMT) From: Viktor Mihajlovski To: libvir-list@redhat.com, pkrempa@redhat.com Date: Mon, 5 Mar 2018 12:44:29 +0100 In-Reply-To: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> References: <1520250269-12295-1-git-send-email-mihajlov@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18030511-0040-0000-0000-0000041AE1A2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030511-0041-0000-0000-0000261DF05C Message-Id: <1520250269-12295-7-git-send-email-mihajlov@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803050141 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Mar 2018 11:44:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Mar 2018 11:44:46 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mihajlov@de.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.702 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 6/6] qemu: refresh vcpu halted state only via query-cpus-fast 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Mar 2018 11:44:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In order to not affect running VMs, refreshing the halted state is only performed if QEMU supports the query-cpus-fast QAPI. Signed-off-by: Viktor Mihajlovski Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer --- src/qemu/qemu_domain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4079fb3..a5fcf22 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8801,8 +8801,13 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, return 0; =20 /* The halted state is interresting only on s390(x). On other platforms - * the data would be stale at the time when it would be used. */ - if (!ARCH_IS_S390(vm->def->os.arch)) + * the data would be stale at the time when it would be used. + * Calling qemuMonitorGetCpuHalted() can adversely affect the running + * VM's performance unless QEMU supports query-cpus-fast. + */ + if (!ARCH_IS_S390(vm->def->os.arch) || + !virQEMUCapsGet(QEMU_DOMAIN_PRIVATE(vm)->qemuCaps, + QEMU_CAPS_QUERY_CPUS_FAST)) return 0; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list