From nobody Sat Apr 27 05:34:21 2024 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 1511182556187552.8137708031674; Mon, 20 Nov 2017 04:55:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE09DC0587CA; Mon, 20 Nov 2017 12:55:54 +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 DE7B960BE3; Mon, 20 Nov 2017 12:55:53 +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 438711800BDA; Mon, 20 Nov 2017 12:55:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAKCtpce014718 for ; Mon, 20 Nov 2017 07:55:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 07A006E509; Mon, 20 Nov 2017 12:55:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01A116A04B for ; Mon, 20 Nov 2017 12:55:48 +0000 (UTC) Received: from relay.sw.ru (mailhub.sw.ru [195.214.232.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB78481E1A for ; Mon, 20 Nov 2017 12:55:45 +0000 (UTC) Received: from dim-vz7.qa.sw.ru (msk-vpn.virtuozzo.com [195.214.232.6]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id vAKCthhh007978 for ; Mon, 20 Nov 2017 15:55:43 +0300 (MSK) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Mon, 20 Nov 2017 15:55:41 +0300 Message-Id: <1511182541-570000-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Delayed for 93:50:49 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 20 Nov 2017 12:55:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 20 Nov 2017 12:55:46 +0000 (UTC) for IP:'195.214.232.25' DOMAIN:'mailhub.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 195.214.232.25 mailhub.sw.ru 195.214.232.25 mailhub.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: cpu: fix fullCPU to include all emulatable qemu features 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 20 Nov 2017 12:55:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" On Core i5 650 guest fail to start with error [1] if guest cpu config is ta= ken from domcapabilities and check is set to partial. The problem is in qemu caps fullCPU calculation in virQEMUCapsInitHostCPUMo= del. It is supposed to include features emulated by qemu and missed on host. Som= e of such features may be not included however. For mentioned cpu host cpu is detected as Westmere and guest cpu as SandyBridge. x2apic is missed on host and provided by installed qemu. The feature is not mentioned in guest cpu features explicitly because SandyBrid= ge model include it. As a result fullCPU does not include x2apic too. Solution is to expand guest cpu features before updating fullCPU features. [1] error: the CPU is incompatible with host CPU: Host CPU does not provide required features: x2apic, tsc-deadline --- src/qemu/qemu_capabilities.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9c1eeac..edba716 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3475,6 +3475,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, virDomainVirtType type) { virCPUDefPtr cpu =3D NULL; + virCPUDefPtr cpuExpanded =3D NULL; virCPUDefPtr migCPU =3D NULL; virCPUDefPtr hostCPU =3D NULL; virCPUDefPtr fullCPU =3D NULL; @@ -3504,9 +3505,13 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, NULL, NULL))) goto error; =20 - for (i =3D 0; i < cpu->nfeatures; i++) { - if (cpu->features[i].policy =3D=3D VIR_CPU_FEATURE_REQUIRE && - virCPUDefUpdateFeature(fullCPU, cpu->features[i].name, + if (!(cpuExpanded =3D virCPUDefCopy(cpu)) || + virCPUExpandFeatures(qemuCaps->arch, cpuExpanded) < 0) + goto error; + + for (i =3D 0; i < cpuExpanded->nfeatures; i++) { + if (cpuExpanded->features[i].policy =3D=3D VIR_CPU_FEATURE_REQ= UIRE && + virCPUDefUpdateFeature(fullCPU, cpuExpanded->features[i].n= ame, VIR_CPU_FEATURE_REQUIRE) < 0) goto error; } @@ -3528,6 +3533,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU); =20 cleanup: + virCPUDefFree(cpuExpanded); virCPUDefFree(hostCPU); return; =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list