From nobody Thu May 15 00:24:53 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 1521099667441963.41052019359; Thu, 15 Mar 2018 00:41:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C74197FDE0; Thu, 15 Mar 2018 07:41:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DB235D6B2; Thu, 15 Mar 2018 07:41:04 +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 6538E69E3F; Thu, 15 Mar 2018 07:41:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2E2R2xN008516 for ; Tue, 13 Mar 2018 22:27:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1AE5D5D9CC; Wed, 14 Mar 2018 02:27:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 130D15D9CD for ; Wed, 14 Mar 2018 02:26:59 +0000 (UTC) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD9833AA02 for ; Wed, 14 Mar 2018 02:26:58 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 35AD521234; Tue, 13 Mar 2018 22:26:58 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Tue, 13 Mar 2018 22:26:58 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 8C13524038; Tue, 13 Mar 2018 22:26:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=JoC8aEDyYobu6XsUtMDNsxgkOI+Ci2vp0pB7CABdC oc=; b=AEfwLaTfKZbsEMBzes3nNCggVQKdj6FbqwQaADMOhz76hs0Rb/E6DProx xb2dOZ8IAdHioaftKf8QtLk/ihFtJ8nLGeepdrIbZ+L4K04eUiIMKIi5GM9apmta tai59fa7oehgNMA8rVrgTVsaI/3D0xkGFcHRtQ6Xm3Jqy12ABQBmJ0uHQrKgrV+x EJlCOlU9Cr+MksMBRljmkKjoAChs9E9EDRdasL0QGXk8lyo+AegucYF/2lpsY3xu +Gwy+wAAqPS5VrlRUkwed7HESxvEzI5KdQv9899gPHPMSF/V8teSNusZmd+HhWNh Kin5T8hOuAiOgZ6IdFq6MkzyzCKjA== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 14 Mar 2018 03:26:10 +0100 Message-Id: <5f367d902db1e044624a00c153486642e0fbb505.1520994153.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 14 Mar 2018 02:26:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 14 Mar 2018 02:26:58 +0000 (UTC) for IP:'66.111.4.25' DOMAIN:'out1-smtp.messagingengine.com' HELO:'out1-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.721 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS) 66.111.4.25 out1-smtp.messagingengine.com 66.111.4.25 out1-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 3/9] libxl: error out on not supported CPU mode, instead of silently ignoring 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: , Content-Type: text/plain; charset="utf-8" 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 15 Mar 2018 07:41:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 This change make libvirt XML with plain element invalid for libxl, which affect not only upcoming CPUID support, but also NUMA. In fact, default mode 'custom' does not match what the driver actually does, so it was a bug. Adjust xenconfig driver accordingly. To not break existing configuration, add PostParse hook to update (previously ignored) default mode 'custom' to 'host-passthrough'. Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes since v4: - add PostParse hook to automatically set host-passthrough mode, if was the default one before (custom) Changes since v3: - fix vnuma tests (nested HVM implicitly enabled there) Changes since v2: - change separated from 'libxl: add support for CPUID features policy' --- src/libxl/libxl_conf.c | 10 ++++++++-- src/libxl/libxl_domain.c | 5 +++++- src/xenconfig/xen_xl.c | 1 +- tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg | 1 +- tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml | 2 +- tests/xlconfigdata/test-fullvirt-vnuma-nodistances.cfg | 1 +- tests/xlconfigdata/test-fullvirt-vnuma-nodistances.xml | 2 +- tests/xlconfigdata/test-fullvirt-vnuma-partialdist.cfg | 1 +- tests/xlconfigdata/test-fullvirt-vnuma-partialdist.xml | 2 +- tests/xlconfigdata/test-fullvirt-vnuma.cfg | 1 +- tests/xlconfigdata/test-fullvirt-vnuma.xml | 2 +- 11 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index e7727a1..9301731 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -355,11 +355,17 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D VIR_TRISTATE_SWITCH_ON); =20 - if (caps && - def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { + if (caps && def->cpu) { bool hasHwVirt =3D false; bool svm =3D false, vmx =3D false; =20 + if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported cpu mode '%s'"), + virCPUModeTypeToString(def->cpu->mode)); + return -1; + } + if (ARCH_IS_X86(def->os.arch)) { vmx =3D virCPUCheckFeature(caps->host.arch, caps->host.cpu= , "vmx"); svm =3D virCPUCheckFeature(caps->host.arch, caps->host.cpu= , "svm"); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 8879481..98da68d 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -414,6 +414,11 @@ libxlDomainDefPostParse(virDomainDefPtr def, def->features[VIR_DOMAIN_FEATURE_ACPI] =3D VIR_TRISTATE_SWITCH= _ON; } =20 + /* set default CPU mode to host-passthrough, as the only one supported= by + * the driver */ + if (def->cpu && def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM) + def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + return 0; } =20 diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 2ef80eb..6cda305 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -494,6 +494,7 @@ xenParseXLVnuma(virConfPtr conf, goto cleanup; } =20 + cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; cpu->type =3D VIR_CPU_TYPE_GUEST; def->cpu =3D cpu; =20 diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg b/test= s/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg index edba69a..2c9de44 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg +++ b/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.cfg @@ -22,5 +22,6 @@ parallel =3D "none" serial =3D "none" builder =3D "hvm" boot =3D "d" +nestedhvm =3D 1 vnuma =3D [ [ "pnode=3D0", "size=3D2048", "vcpus=3D0,11", "vdistances=3D10= ,21,31,41,51,61" ], [ "pnode=3D1", "size=3D2048", "vcpus=3D1,10", "vdistanc= es=3D21,10,21,31,41,51" ], [ "pnode=3D2", "size=3D2048", "vcpus=3D2,9", "vd= istances=3D31,21,10,21,31,41" ], [ "pnode=3D3", "size=3D2048", "vcpus=3D3,8= ", "vdistances=3D41,31,21,10,21,31" ], [ "pnode=3D4", "size=3D2048", "vcpus= =3D4,7", "vdistances=3D51,41,31,21,10,21" ], [ "pnode=3D5", "size=3D2048", = "vcpus=3D5-6", "vdistances=3D61,51,41,31,21,10" ] ] disk =3D [ "format=3Draw,vdev=3Dhda,access=3Drw,backendtype=3Dphy,target= =3D/dev/HostVG/XenGuest2" ] diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml b/test= s/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml index e3639eb..3c486ad 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml +++ b/tests/xlconfigdata/test-fullvirt-vnuma-autocomplete.xml @@ -14,7 +14,7 @@ - + diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.cfg b/tests= /xlconfigdata/test-fullvirt-vnuma-nodistances.cfg index 8186edf..ca8e5b0 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.cfg +++ b/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.cfg @@ -22,5 +22,6 @@ parallel =3D "none" serial =3D "none" builder =3D "hvm" boot =3D "d" +nestedhvm =3D 1 vnuma =3D [ [ "pnode=3D0", "size=3D2048", "vcpus=3D0-1", "vdistances=3D10,= 20,20,20" ], [ "pnode=3D1", "size=3D2048", "vcpus=3D2-3", "vdistances=3D20,= 10,20,20" ], [ "pnode=3D2", "size=3D2048", "vcpus=3D4-5", "vdistances=3D20,= 20,10,20" ], [ "pnode=3D3", "size=3D2048", "vcpus=3D6-7", "vdistances=3D20,= 20,20,10" ] ] disk =3D [ "format=3Draw,vdev=3Dhda,access=3Drw,backendtype=3Dphy,target= =3D/dev/HostVG/XenGuest2" ] diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.xml b/tests= /xlconfigdata/test-fullvirt-vnuma-nodistances.xml index 9cab3ca..17c9ca5 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.xml +++ b/tests/xlconfigdata/test-fullvirt-vnuma-nodistances.xml @@ -14,7 +14,7 @@ - + diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.cfg b/tests= /xlconfigdata/test-fullvirt-vnuma-partialdist.cfg index 861a50e..46d5f90 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.cfg +++ b/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.cfg @@ -22,5 +22,6 @@ parallel =3D "none" serial =3D "none" builder =3D "hvm" boot =3D "d" +nestedhvm =3D 1 vnuma =3D [ [ "pnode=3D0", "size=3D2048", "vcpus=3D0-1", "vdistances=3D10,= 21,31,41" ], [ "pnode=3D1", "size=3D2048", "vcpus=3D2-3", "vdistances=3D21,= 10,20,20" ], [ "pnode=3D2", "size=3D2048", "vcpus=3D4-5", "vdistances=3D31,= 20,10,20" ], [ "pnode=3D3", "size=3D2048", "vcpus=3D6-7", "vdistances=3D41,= 20,20,10" ] ] disk =3D [ "format=3Draw,vdev=3Dhda,access=3Drw,backendtype=3Dphy,target= =3D/dev/HostVG/XenGuest2" ] diff --git a/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.xml b/tests= /xlconfigdata/test-fullvirt-vnuma-partialdist.xml index 084b889..291fc37 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.xml +++ b/tests/xlconfigdata/test-fullvirt-vnuma-partialdist.xml @@ -14,7 +14,7 @@ - + diff --git a/tests/xlconfigdata/test-fullvirt-vnuma.cfg b/tests/xlconfigdat= a/test-fullvirt-vnuma.cfg index 91e233a..813ad7f 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma.cfg +++ b/tests/xlconfigdata/test-fullvirt-vnuma.cfg @@ -22,5 +22,6 @@ parallel =3D "none" serial =3D "none" builder =3D "hvm" boot =3D "d" +nestedhvm =3D 1 vnuma =3D [ [ "pnode=3D0", "size=3D2048", "vcpus=3D0-1", "vdistances=3D10,= 21,31,41" ], [ "pnode=3D1", "size=3D2048", "vcpus=3D2-3", "vdistances=3D21,= 10,21,31" ], [ "pnode=3D2", "size=3D2048", "vcpus=3D4-5", "vdistances=3D31,= 21,10,21" ], [ "pnode=3D3", "size=3D2048", "vcpus=3D6-7", "vdistances=3D41,= 31,21,10" ] ] disk =3D [ "format=3Draw,vdev=3Dhda,access=3Drw,backendtype=3Dphy,target= =3D/dev/HostVG/XenGuest2" ] diff --git a/tests/xlconfigdata/test-fullvirt-vnuma.xml b/tests/xlconfigdat= a/test-fullvirt-vnuma.xml index 5368b0d..9a9f495 100644 --- a/tests/xlconfigdata/test-fullvirt-vnuma.xml +++ b/tests/xlconfigdata/test-fullvirt-vnuma.xml @@ -14,7 +14,7 @@ - + --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list