From nobody Thu Dec 5 02:00:05 2024 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17323117628441019.4812406843371; Fri, 22 Nov 2024 13:42:42 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 472621536; Fri, 22 Nov 2024 16:42:42 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8080F156B; Fri, 22 Nov 2024 16:34:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id AC8DB14BD; Fri, 22 Nov 2024 16:34:31 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 1835E161C for ; Fri, 22 Nov 2024 16:33:54 -0500 (EST) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-498-klvEBBUrOyOiOGtgutxInA-1; Fri, 22 Nov 2024 16:33:52 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A1F8E19541A1 for ; Fri, 22 Nov 2024 21:33:51 +0000 (UTC) Received: from orkuz (unknown [10.45.224.26]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 251D41955D44 for ; Fri, 22 Nov 2024 21:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732311233; 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=QfeEdhUKYI1btXahgIi7iObxAtutXzY0Y8J59S7Qvog=; b=IlRwGaBNS7nBH81gZM+BqdDP5LWUPQ0Qkzn4NkP+t2FkrVrlxMq2w/ruKKhwFP1IyjAqMC hyvrF07k/cILll22tZa3l16kBMRJvUElApmHVRW+DqCiy7VUScB1Zqeu8TPB576GYhzsGK wKLdx3XFHZb2aiNLIgsLtATZhUZ/9g0= X-MC-Unique: klvEBBUrOyOiOGtgutxInA-1 X-Mimecast-MFC-AGG-ID: klvEBBUrOyOiOGtgutxInA From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 15/36] domain_capabilities: Report canonical names of CPU models Date: Fri, 22 Nov 2024 22:32:55 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vQlwDx0QMWFDChTQZozahOHqvE-PIT8-Wqtdid1RW8s_1732311231 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: P6HI5W2ZRRW6FKTX3C7WY7HMSSMANWBB X-Message-ID-Hash: P6HI5W2ZRRW6FKTX3C7WY7HMSSMANWBB X-MailFrom: jdenemar@redhat.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: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732311765340116600 Content-Type: text/plain; charset="utf-8" Some models are just aliases to other models. Make this relation available to users via domain capabilities. Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: Version 2: - new patch docs/formatdomaincaps.rst | 8 +++++--- src/conf/domain_capabilities.c | 11 +++++++++-- src/conf/domain_capabilities.h | 4 +++- src/qemu/qemu_capabilities.c | 10 +++++++--- tests/cputest.c | 5 +++-- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst index 886a9f71e1..ed95af4fee 100644 --- a/docs/formatdomaincaps.rst +++ b/docs/formatdomaincaps.rst @@ -193,12 +193,12 @@ CPUs `__. - Broadwell= + Broadwell - Broadwel= l-noTSX + Broadwell-noTSX EPYC-Milan<= /model> @@ -265,7 +265,9 @@ more details about it: the hypervisor's policy on usage of this model :since:`(since 7.1.0)`. = The ``vendor`` attribute :since:`(since 8.9.0)` contains the vendor of the = CPU model for users who want to use CPU models with specific vendors only. = CPU - models with undefined vendor will be listed with ``vendor=3D'unkwnown'`= `. + models with undefined vendor will be listed with ``vendor=3D'unkwnown'`= `. The + ``canonical`` attribute :since:`(since 10.10.0)` contains a canonical n= ame of + the CPU model if the model is actually an alias to another one. =20 I/O Threads ~~~~~~~~~~~ diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 5f70a48cec..ab715b19d8 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -122,6 +122,7 @@ virDomainCapsCPUModelsDispose(void *obj) g_free(cpuModels->models[i].name); g_strfreev(cpuModels->models[i].blockers); g_free(cpuModels->models[i].vendor); + g_free(cpuModels->models[i].canonical); } =20 g_free(cpuModels->models); @@ -184,7 +185,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old) old->models[i].usable, old->models[i].blockers, old->models[i].deprecated, - old->models[i].vendor); + old->models[i].vendor, + old->models[i].canonical); } =20 return cpuModels; @@ -197,7 +199,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, virDomainCapsCPUUsable usable, char **blockers, bool deprecated, - const char *vendor) + const char *vendor, + const char *canonical) { virDomainCapsCPUModel *cpu; =20 @@ -212,6 +215,7 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, cpu->blockers =3D g_strdupv(blockers); cpu->deprecated =3D deprecated; cpu->vendor =3D g_strdup(vendor); + cpu->canonical =3D g_strdup(canonical); } =20 =20 @@ -430,6 +434,9 @@ virDomainCapsCPUCustomFormat(virBuffer *buf, else virBufferAddLit(buf, " vendor=3D'unknown'"); =20 + if (model->canonical) + virBufferAsprintf(buf, " canonical=3D'%s'", model->canonical); + virBufferAsprintf(buf, ">%s\n", model->name); =20 if (model->blockers) { diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index ef08046860..69dd1a15c1 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -189,6 +189,7 @@ struct _virDomainCapsCPUModel { char **blockers; /* NULL-terminated list of usability blockers */ bool deprecated; char *vendor; + char *canonical; }; =20 typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels; @@ -331,7 +332,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuMo= dels, virDomainCapsCPUUsable usable, char **blockers, bool deprecated, - const char *vendor); + const char *vendor, + const char *canonical); virDomainCapsCPUModel * virDomainCapsCPUModelsGet(virDomainCapsCPUModels *cpuModels, const char *name); diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5ac9f306f5..dec3199fce 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2144,7 +2144,7 @@ virQEMUCapsCPUDefsToModels(virArch arch, qemuMonitorCPUDefs *defs, const char **modelAllowed, const char **modelForbidden, - bool vendors) + bool extraInfo) { virDomainCapsCPUModels *cpuModels =3D NULL; size_t i; @@ -2155,6 +2155,7 @@ virQEMUCapsCPUDefsToModels(virArch arch, for (i =3D 0; i < defs->ncpus; i++) { qemuMonitorCPUDefInfo *cpu =3D defs->cpus + i; const char *vendor =3D NULL; + const char *canonical =3D NULL; =20 if (modelAllowed && !g_strv_contains(modelAllowed, cpu->name)) continue; @@ -2162,11 +2163,14 @@ virQEMUCapsCPUDefsToModels(virArch arch, if (modelForbidden && g_strv_contains(modelForbidden, cpu->name)) continue; =20 - if (vendors) + if (extraInfo) { vendor =3D virCPUGetVendorForModel(arch, cpu->name); + canonical =3D virCPUGetCanonicalModel(arch, cpu->name); + } =20 virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, - cpu->blockers, cpu->deprecated, vendor); + cpu->blockers, cpu->deprecated, + vendor, canonical); } =20 virDomainCapsCPUModelsSort(cpuModels); diff --git a/tests/cputest.c b/tests/cputest.c index 32bf86997a..326ffebd09 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -823,7 +823,8 @@ cpuTestUpdateLive(const void *arg) } =20 virDomainCapsCPUModelsAdd(models, expected->model, - usable, blockers, false, expected->vendo= r); + usable, blockers, false, + expected->vendor, NULL); =20 cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; ignore_value(virCPUTranslate(data->arch, cpu, models)); @@ -902,7 +903,7 @@ cpuTestInitModels(const char **list) for (model =3D list; *model; model++) { virDomainCapsCPUModelsAdd(cpus, *model, VIR_DOMCAPS_CPU_USABLE_UNKNOWN, - NULL, false, NULL); + NULL, false, NULL, NULL); } =20 return cpus; --=20 2.47.0