From nobody Sat Feb 7 18:58:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715121119427918.0642588770016; Tue, 7 May 2024 15:31:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 494ED1C21; Tue, 7 May 2024 18:31:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2A4E61C55; Tue, 7 May 2024 18:31:10 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E2751C17; Tue, 7 May 2024 18:31:07 -0400 (EDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 81DB81A4C for ; Tue, 7 May 2024 18:31:06 -0400 (EDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 447MV4rR014725 for ; Tue, 7 May 2024 22:31:05 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xyvvr00qy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 May 2024 22:31:05 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 447LDAIR009823 for ; Tue, 7 May 2024 22:27:06 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xyshuh5hg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 May 2024 22:27:06 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 447MR3S929426202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 7 May 2024 22:27:05 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7663E58061 for ; Tue, 7 May 2024 22:27:03 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33A0458043 for ; Tue, 7 May 2024 22:27:03 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.pok.ibm.com (unknown [9.12.68.85]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP for ; Tue, 7 May 2024 22:27:03 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 From: Collin Walling To: devel@lists.libvirt.org Subject: [RFC PATCH 1/1] qemu: monitor: parse deprecated-props from query-cpu-model-expansion response Date: Tue, 7 May 2024 18:24:21 -0400 Message-ID: <20240507222421.37660-2-walling@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507222421.37660-1-walling@linux.ibm.com> References: <20240507222421.37660-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ACq_1XqBvFpiMRzrnxHTIAXofN1wIMjb X-Proofpoint-ORIG-GUID: ACq_1XqBvFpiMRzrnxHTIAXofN1wIMjb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-07_14,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 phishscore=0 adultscore=0 bulkscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405070158 Message-ID-Hash: 36KJ3HXIJ6PENSKFJV3A2TSBPU3RJRWM X-Message-ID-Hash: 36KJ3HXIJ6PENSKFJV3A2TSBPU3RJRWM X-MailFrom: walling@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715121121137100001 query-cpu-model-expansion may report an array of deprecated properties. This array is optional, and may not be supported for a particular architecture or reported for a particular CPU model. If the output is present, then capture it and store in a qemuMonitorCPUModelInfo struct for later use. Baseline does not intend to use this feature, so pass NULL in place of the respective parameter in the relevant functions. The deprecated features will be retained in qemuCaps->kvm->hostCPU.info and will be stored in the capabilities cache file under the element using the following format: Signed-off-by: Collin Walling --- src/qemu/qemu_capabilities.c | 30 ++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 29 ++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 45525db803..5c36db27f8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4028,6 +4028,24 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *ca= ps, } } =20 + ctxt->node =3D hostCPUNode; + + if (virXPathNodeSet("./deprecatedProperties", ctxt, &nodes) > 0 && + (n =3D virXPathNodeSet("./property", ctxt, &nodes)) > 0) { + hostCPU->deprecated_props =3D g_new0(char *, n); + hostCPU->ndeprecated_props =3D n; + + for (i =3D 0; i < n; i++) { + ctxt->node =3D nodes[i]; + + if (!(hostCPU->deprecated_props[i] =3D virXMLPropString(ctxt->= node, "name"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing 'name' attribute for a host CPU = model deprecated property in QEMU capabilities cache")); + return -1; + } + } + } + caps->hostCPU.info =3D g_steal_pointer(&hostCPU); return 0; } @@ -4760,6 +4778,18 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *= caps, virBufferAddLit(buf, "/>\n"); } =20 + if (model->deprecated_props) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + + for (i =3D 0; i < model->ndeprecated_props; i++) + virBufferAsprintf(buf, "\n", + model->deprecated_props[i]); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6e81945201..1a2444b721 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1140,6 +1140,8 @@ struct _qemuMonitorCPUModelInfo { char *name; size_t nprops; qemuMonitorCPUProperty *props; + size_t ndeprecated_props; + char **deprecated_props; bool migratability; }; =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index eb84a3d938..39dc709693 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5006,6 +5006,7 @@ qemuMonitorJSONParseCPUModelData(virJSONValue *data, bool fail_no_props, virJSONValue **cpu_model, virJSONValue **cpu_props, + virJSONValue **cpu_deprecated_props, const char **cpu_name) { if (!(*cpu_model =3D virJSONValueObjectGetObject(data, "model"))) { @@ -5027,6 +5028,12 @@ qemuMonitorJSONParseCPUModelData(virJSONValue *data, return -1; } =20 + /* Unconditionally check for the deprecated-props array, as it is not + * a guarantee response even if QEMU supports it. */ + if (cpu_deprecated_props) + *cpu_deprecated_props =3D virJSONValueObjectGetArray(*cpu_model, + "deprecated-pro= ps"); + return 0; } =20 @@ -5034,6 +5041,7 @@ qemuMonitorJSONParseCPUModelData(virJSONValue *data, static int qemuMonitorJSONParseCPUModel(const char *cpu_name, virJSONValue *cpu_props, + virJSONValue *cpu_deprecated_props, qemuMonitorCPUModelInfo **model_info) { g_autoptr(qemuMonitorCPUModelInfo) machine_model =3D NULL; @@ -5052,6 +5060,16 @@ qemuMonitorJSONParseCPUModel(const char *cpu_name, return -1; } =20 + if (cpu_deprecated_props) { + size_t ndeprecated_props =3D virJSONValueArraySize(cpu_deprecated_= props); + machine_model->deprecated_props =3D g_new0(char *, ndeprecated_pro= ps); + + if (!(machine_model->deprecated_props =3D virJSONValueArrayToStrin= gList(cpu_deprecated_props))) + return -1; + + machine_model->ndeprecated_props =3D ndeprecated_props; + } + *model_info =3D g_steal_pointer(&machine_model); return 0; } @@ -5116,6 +5134,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon, g_autoptr(virJSONValue) fullData =3D NULL; virJSONValue *cpu_model; virJSONValue *cpu_props =3D NULL; + virJSONValue *cpu_deprecated_props =3D NULL; const char *cpu_name =3D ""; int rc; =20 @@ -5129,7 +5148,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon, =20 if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion", fail_no_props, &cpu_model, &cpu_p= rops, - &cpu_name) < 0) + &cpu_deprecated_props, &cpu_name)= < 0) return -1; =20 /* QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL requests "full" expans= ion @@ -5147,11 +5166,11 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mo= n, =20 if (qemuMonitorJSONParseCPUModelData(fullData, "query-cpu-model-ex= pansion", fail_no_props, &cpu_model, &c= pu_props, - &cpu_name) < 0) + &cpu_deprecated_props, &cpu_n= ame) < 0) return -1; } =20 - return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, model_info); + return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, cpu_deprecate= d_props, model_info); } =20 =20 @@ -5188,10 +5207,10 @@ qemuMonitorJSONGetCPUModelBaseline(qemuMonitor *mon, =20 if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-baseline", false, &cpu_model, &cpu_props, - &cpu_name) < 0) + NULL, &cpu_name) < 0) return -1; =20 - return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, baseline); + return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, NULL, baselin= e); } =20 =20 --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org