From nobody Thu Dec 5 01:55:49 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 1732311345786279.8669528888282; Fri, 22 Nov 2024 13:35:45 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 027401526; Fri, 22 Nov 2024 16:35:44 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8B6981645; Fri, 22 Nov 2024 16:33:31 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C8705139B; Fri, 22 Nov 2024 16:33:26 -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 40938139B for ; Fri, 22 Nov 2024 16:33:26 -0500 (EST) Received: from mx-prod-mc-04.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-546-gggnMniXN-GdBg-fKLLKmA-1; Fri, 22 Nov 2024 16:33:24 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1A511955DC1 for ; Fri, 22 Nov 2024 21:33:23 +0000 (UTC) Received: from orkuz (unknown [10.45.224.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 563D930000DF for ; Fri, 22 Nov 2024 21:33:23 +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=1732311206; 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=OtTYuguWimZFFhB8MnZUVeZNck/2ik1bVUUb8O6NnXY=; b=hmfqdPBP+hbQ+w5jyIPruao6EsaAaPYO4Cm087M9oSeI6eOe3IjeSd+lVbbdmjq0wsL94h tbLyzNJr6JzXAPely8un2yntx9pXwrZJ0rdE4osf2/Whs5o12TWyZYuuNV5i2G72W+di9H 9Z00loLhWDzlPytRgYKSpMFHEPBJz7U= X-MC-Unique: gggnMniXN-GdBg-fKLLKmA-1 X-Mimecast-MFC-AGG-ID: gggnMniXN-GdBg-fKLLKmA From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 02/36] cpu_x86: Promote added/removed from ancestor Date: Fri, 22 Nov 2024 22:32:42 +0100 Message-ID: <5a6e6b39e384f0d394583cc3365e68af4d464723.1732311125.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EZdLbWASm73MXjN-_ymlfqkc6UdT5b1WheAw1dP1R90_1732311203 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4MJHN2XTAEDYYRJPXP7F6LXVT6YMACYK X-Message-ID-Hash: 4MJHN2XTAEDYYRJPXP7F6LXVT6YMACYK 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: 1732311347558116600 Content-Type: text/plain; charset="utf-8" When a CPU model is defined based on another model, we were completely ignoring features marked as added to or removed from the original model after it was released. For added features this is the right thing to do as it will promote them to become normal features included in the new model. But features marked as removed would become included in the new model as well. We need to explicitly remove them as if they were never included in the model. Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: Version 2: - new patch - replaces "cpu_x86: Copy added and removed features from ancestor" src/cpu/cpu_x86.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 37f3b6e3ce..285b272ce8 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -161,7 +161,10 @@ struct _virCPUx86Model { virCPUx86Signatures *signatures; /* Inherited from ancestor */ virCPUx86Data data; - /* Not inherited from ancestor */ + + /* Not inherited from ancestor. + * The corresponding features are removed from the new model data. + */ GStrv removedFeatures; =20 /* Features added to the CPU model after its original version was rele= ased. @@ -172,7 +175,9 @@ struct _virCPUx86Model { * included in the CPU model by the hypervisor, but libvirt didn't sup= port * them when introducing the CPU model. In other words, they were enab= led, * but we ignored them. + * * Not inherited from ancestor. + * The corresponding features are a genuine part of the new model. */ GStrv addedFeatures; }; @@ -1542,6 +1547,7 @@ x86ModelParseAncestor(virCPUx86Model *model, g_autofree char *name =3D NULL; virCPUx86Model *ancestor; int rc; + char **removed; =20 if ((rc =3D virXPathBoolean("boolean(./model)", ctxt)) <=3D 0) return rc; @@ -1565,6 +1571,13 @@ x86ModelParseAncestor(virCPUx86Model *model, model->signatures =3D virCPUx86SignaturesCopy(ancestor->signatures); x86DataCopy(&model->data, &ancestor->data); =20 + for (removed =3D ancestor->removedFeatures; removed && *removed; remov= ed++) { + virCPUx86Feature *feat; + + if ((feat =3D x86FeatureFind(map, *removed))) + x86DataSubtract(&model->data, &feat->data); + } + return 0; } =20 --=20 2.47.0