From nobody Thu Sep 18 03:29:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507717679334718.4279664243616; Wed, 11 Oct 2017 03:27:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEAA2C04B31B; Wed, 11 Oct 2017 10:27:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D077E5279C; Wed, 11 Oct 2017 10:27:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9B0E11806103; Wed, 11 Oct 2017 10:27:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9BABMvw029584 for ; Wed, 11 Oct 2017 06:11:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 43FA94DC; Wed, 11 Oct 2017 10:11:22 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18A1E5C552 for ; Wed, 11 Oct 2017 10:11:19 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 54F17104218; Wed, 11 Oct 2017 12:11:18 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EEAA2C04B31B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 11 Oct 2017 12:11:16 +0200 Message-Id: <2458a0a225419711da23fa1b8db507dce9361432.1507710167.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] qemu: Filter CPU features when using host CPU X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 11 Oct 2017 10:27:58 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The host CPU definition from host capabilities may contain features unknown to QEMU. Thus whenever we want to use this CPU definition, we have to filter the unknown features. https://bugzilla.redhat.com/show_bug.cgi?id=3D1495171 Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/qemu/qemu_process.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5ed6b68eb8..8553c5126f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6882,6 +6882,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, { virCapsPtr caps =3D virQEMUDriverGetCapabilities(driver, false); virCPUDefPtr host =3D NULL; + virCPUDefPtr cpu =3D NULL; int ret =3D -1; =20 if (!virQEMUCapsGuestIsNative(caps->host.arch, vm->def->os.arch) || @@ -6901,7 +6902,13 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, if (!(host =3D virCPUCopyMigratable(caps->host.cpu->arch, caps->ho= st.cpu))) goto cleanup; =20 - if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, host) < 0) + if (!(cpu =3D virCPUDefCopyWithoutModel(host)) || + virCPUDefCopyModelFilter(cpu, host, false, + virQEMUCapsCPUFilterFeatures, + &caps->host.cpu->arch) < 0) + goto cleanup; + + if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, cpu) < 0) goto cleanup; =20 if (qemuProcessUpdateCPU(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) @@ -6911,6 +6918,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: + virCPUDefFree(cpu); virCPUDefFree(host); virObjectUnref(caps); return ret; --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list