From nobody Mon Sep 8 17:03:34 2025 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; dkim=fail; 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756999208; cv=none; d=zohomail.com; s=zohoarc; b=KxfYZLn2KRpkFaW/vV5pYX15PIrWgrSPZQcaX+MB7VrpCRiievEhCd68UHtdQxIjABG3m8eYDD8UtmGKNxJjd+HE1HJb16wJBQ6x5OWxlwcwFey7A4ZvbnF5RhfE9u/WYsJF9buZsJ8CzxY//MWlUsBk2i+ngQWHI+QU+ADokB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756999208; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=bX8tw6x7kInKyBFJgPNzUFwNeQQXO+tXsUDe/brG638=; b=SAmlGpa0UpbZmC06sbRJt2woQGogv4PzSzniKV9P9dMn6TempvLRxfovaeszPv+ehv2i39peB1+Bn2jPh8asvEAX69Gv9sxkAemhsiOzLSRe2j2NVIUTfQBNRNlqpIeSMBDaDSpiLJ7li2G2fhmkvDWofD5tj79Z9+KXAlOgn5c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756999207992803.8501079117574; Thu, 4 Sep 2025 08:20:07 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B846D44334; Thu, 4 Sep 2025 11:20:06 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 4111A442F6; Thu, 4 Sep 2025 10:52:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 5D62444376; Thu, 4 Sep 2025 10:52:24 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B58264440F for ; Thu, 4 Sep 2025 10:47:38 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-jlG-ci8SPNGBVNIjAjM0nw-1; Thu, 04 Sep 2025 10:47:36 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EBC70180034D for ; Thu, 4 Sep 2025 14:47:35 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7B17D1800452 for ; Thu, 4 Sep 2025 14:47:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756997258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bX8tw6x7kInKyBFJgPNzUFwNeQQXO+tXsUDe/brG638=; b=QR80i9wauji+xk9Xw7jnpqhY8O1PjbnQT+ZYu7Axfbi1zpUevtwygM8U6oinWWkxo/QTsB Zy9bkKudHXQ2GB08osvQ7rPLTjyCWU8GizhwmqUX2zcRkktdRW2ro1zSzXnMfVXa5V3XvR 5LmTP3XDktk4oN4nxkRCvHFEI2CHebY= X-MC-Unique: jlG-ci8SPNGBVNIjAjM0nw-1 X-Mimecast-MFC-AGG-ID: jlG-ci8SPNGBVNIjAjM0nw_1756997256 To: devel@lists.libvirt.org Subject: [PATCH 14/14] qemu: Don't query unavailable-features if qom-list-get is supported Date: Thu, 4 Sep 2025 16:47:02 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cBs1B48qUHuwp4BfKuG89rN3oM79d87pY9OsvZII8Uc_1756997256 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JI4VQL3K2N3BI7FOOHOFJXXJATIFODKE X-Message-ID-Hash: JI4VQL3K2N3BI7FOOHOFJXXJATIFODKE X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756999210159116600 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark With qom-list-get we already have the value of unavailable-features property in the returned object (just like we have all values of all bool properties). Let's use the value from there instead of querying for it separately using qom-get. After this patch only a single QMP command is used for getting all the required info about guest CPUs created by QEMU 10.1 or newer. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 32 ++++++++++++++++--- .../get-guest-cpu-SierraForest.json | 23 ------------- .../get-guest-cpu-SkylakeClient.json | 14 -------- 3 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f8be1a79b1..9345115241 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6598,6 +6598,7 @@ struct _qemuMonitorJSONCPUPropsFilterData { qemuMonitor *mon; bool values; const char *cpuQOMPath; + virJSONValue *unavailableFeatures; }; =20 static int @@ -6607,8 +6608,22 @@ qemuMonitorJSONCPUPropsFilter(const char *name, { struct _qemuMonitorJSONCPUPropsFilterData *data =3D opaque; bool enabled =3D false; + const char *type =3D virJSONValueObjectGetString(propData, "type"); =20 - if (STRNEQ_NULLABLE(virJSONValueObjectGetString(propData, "type"), "bo= ol")) + if (data->values && + STREQ(name, "unavailable-features") && + STREQ_NULLABLE(type, "strList")) { + data->unavailableFeatures =3D virJSONValueObjectGetArray(propData,= "value"); + if (!data->unavailableFeatures) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("property '%1$s' in reply data was missing va= lue"), + name); + return -1; + } + return 1; + } + + if (STRNEQ_NULLABLE(type, "bool")) return 1; =20 if (data->values) { @@ -6651,6 +6666,7 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, .mon =3D mon, .values =3D qomListGet, .cpuQOMPath =3D cpuQOMPath, + .unavailableFeatures =3D NULL, }; =20 *propsEnabled =3D NULL; @@ -6704,10 +6720,16 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, &filterData, propsEnabled) < 0) return -1; =20 - if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath, - "unavailable-features", - propsDisabled) < 0) - return -1; + if (filterData.unavailableFeatures) { + *propsDisabled =3D virJSONValueArrayToStringList(filterData.unavai= lableFeatures); + if (!*propsDisabled) + return -1; + } else { + if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath, + "unavailable-features", + propsDisabled) < 0) + return -1; + } =20 return 0; } diff --git a/tests/qemumonitorjsondata/get-guest-cpu-SierraForest.json b/te= sts/qemumonitorjsondata/get-guest-cpu-SierraForest.json index d64ae84532..f5c41cf9b6 100644 --- a/tests/qemumonitorjsondata/get-guest-cpu-SierraForest.json +++ b/tests/qemumonitorjsondata/get-guest-cpu-SierraForest.json @@ -2960,26 +2960,3 @@ ], "id": "libvirt-1" } - -{ - "execute": "qom-get", - "arguments": { - "path": "/machine/unattached/device[0]", - "property": "unavailable-features" - }, - "id": "libvirt-2" -} - -{ - "return": [ - "bus-lock-detect", - "cmpccxadd", - "avx-ifma", - "wbnoinvd", - "pbrsb-no", - "avx-vnni-int8", - "avx-ne-convert", - "mcdt-no" - ], - "id": "libvirt-2" -} diff --git a/tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json b/t= ests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json index 76b66ded20..b5bea8fd61 100644 --- a/tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json +++ b/tests/qemumonitorjsondata/get-guest-cpu-SkylakeClient.json @@ -2951,17 +2951,3 @@ ], "id": "libvirt-1" } - -{ - "execute": "qom-get", - "arguments": { - "path": "/machine/unattached/device[0]", - "property": "unavailable-features" - }, - "id": "libvirt-2" -} - -{ - "return": [], - "id": "libvirt-2" -} --=20 2.51.0