From nobody Sat Feb 7 09:16: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; 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 1728383263451717.124112336506; Tue, 8 Oct 2024 03:27:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5D3421472; Tue, 8 Oct 2024 06:27:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 572651507; Tue, 8 Oct 2024 06:26:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6A321A5C; Tue, 8 Oct 2024 06:26:54 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 CDC10A33 for ; Tue, 8 Oct 2024 06:26:53 -0400 (EDT) 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-329-nAmrxNEIPJWlkfxxYV5Hlg-1; Tue, 08 Oct 2024 06:26:52 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 87CEB1955EAA for ; Tue, 8 Oct 2024 10:26:51 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1660C19560A2 for ; Tue, 8 Oct 2024 10:26: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=1728383213; 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=BxfzUutMTeDBS//DmFCVl2ggIVtF3WcUHd0DisccA7k=; b=FfDK2/WMeny5+UiDVu9aUWWWNCM+y8YKMFkpzU0Agj2a68hBayThvBBQBFBBBznBmsDAqG +FFT0vvlpGW0iFwVn2F091Vab1nK2/o6xd9CdSDgkuEZDAyoQTtgscLs0tjN8mC9fDksqB iChqRpTSV+VG81Aee/G4bER5J2LNxlU= X-MC-Unique: nAmrxNEIPJWlkfxxYV5Hlg-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 1/7] qemu: Drop vmx-* from migratable CPU model only when origCPU is set Date: Tue, 8 Oct 2024 12:26:40 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 7JBGNMHDTULFOW7763TGYVS3CRFYIWXZ X-Message-ID-Hash: 7JBGNMHDTULFOW7763TGYVS3CRFYIWXZ 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: 1728383264792116600 Content-Type: text/plain; charset="utf-8" When qemuDomainMakeCPUMigratable is called with origCPU =3D=3D NULL the code just removed all vmx-* features marked as added in the specified CPU model just like when origCPU is not NULL, but does not list any of the vmx-* features. But this is wrong, we should not touch these features at all when no origCPU is supplied, which happens when parsing XML passed by a user (e.g., migration XML). Such XML is supposed to be generated by libvirt as migration XML and contains only vmx-* features explicitly requested by a user. https://issues.redhat.com/browse/RHEL-52314 Signed-off-by: Jiri Denemark --- src/qemu/qemu_domain.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b6762cc372..f8eac603ec 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6889,23 +6889,21 @@ qemuDomainMakeCPUMigratable(virArch arch, virCPUDefUpdateFeature(cpu, "pconfig", VIR_CPU_FEATURE_DISABLE); } =20 - if (virCPUx86GetAddedFeatures(cpu->model, &data.added) < 0) - return -1; - - /* Drop features marked as added in a cpu model, but only - * when they are not mentioned in origCPU, i.e., when they were not - * explicitly mentioned by the user. - */ - if (data.added) { - g_auto(GStrv) keep =3D NULL; + if (origCPU) { + if (virCPUx86GetAddedFeatures(cpu->model, &data.added) < 0) + return -1; =20 - if (origCPU) { - keep =3D virCPUDefListExplicitFeatures(origCPU); + /* Drop features marked as added in a cpu model, but only + * when they are not mentioned in origCPU, i.e., when they were not + * explicitly mentioned by the user. + */ + if (data.added) { + g_auto(GStrv) keep =3D virCPUDefListExplicitFeatures(origCPU); data.keep =3D keep; - } =20 - if (virCPUDefFilterFeatures(cpu, qemuDomainDropAddedCPUFeatures, &= data) < 0) - return -1; + if (virCPUDefFilterFeatures(cpu, qemuDomainDropAddedCPUFeature= s, &data) < 0) + return -1; + } } =20 return 0; --=20 2.46.2