From nobody Mon Apr 29 00:23:39 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 15181311536321017.3380973147084; Thu, 8 Feb 2018 15:05:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D517F80463; Thu, 8 Feb 2018 23:05:51 +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 AE3C95C54A; Thu, 8 Feb 2018 23:05:51 +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 7294D4A46D; Thu, 8 Feb 2018 23:05:51 +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 w18N1tNf023562 for ; Thu, 8 Feb 2018 18:01:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2E2C25D995; Thu, 8 Feb 2018 23:01:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25C0B5D991 for ; Thu, 8 Feb 2018 23:01:51 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDC6D8B100 for ; Thu, 8 Feb 2018 23:01:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C5BD520C37; Thu, 8 Feb 2018 18:01:47 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:47 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 27AEE7E3DF; Thu, 8 Feb 2018 18:01:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=G6X54NIcoU7M3iV7UF0QfXk3EO6Rm igmmrFC/XZA2is=; b=MyqCjQjNnra4rDA334Ai4FjLNwIS26ZPlYjLppdiDFUac DCZK3IHevrI0Ki5ZNQCsDmpjSMZ/ATEogHcwNn6GInzzXm/n4baNZAAi5Y6jWyrc DTgTmNaqOCxIamoXQu2sO6DXS5Neg/P+Lv94KgJj4l9vlS7mxkGAADdtEW7VrHGL SGqRBsEFu9OA2sWnmvdsGmtbJKOICRkknHhyerVDPmN6v3PYsjvx664hp9dLQ/f0 H4oS7RMGbTx0Gqx5JuIWDdgoblbobwixdI4kvXcE4jRofxhR4UWBH2dQuu/+nDNc q10jSroKr1OCP1a5OOedz8NJ5LIpju0HLrekqPGww== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:54 +0100 Message-Id: <1be6d3dccb3a8171b86ae8d4341566eb8130a13a.1518130692.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: 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.28]); Thu, 08 Feb 2018 23:01:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 23:01:48 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 1/8] libxl: fix libxlDriverConfigDispose for partially constructed object 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 23:05:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" libxlDriverConfigNew() use libxlDriverConfigDispose() for cleanup in case of errors. Do not call libxlLoggerFree() on not allocated logger (NULL). Reviewed-by: Jim Fehlig --- Changes since v3: - new patch, mostly unrelated, but found while adjusting tests --- src/libxl/libxl_conf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 970cff2..2d2a707 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -80,7 +80,8 @@ libxlDriverConfigDispose(void *obj) =20 virObjectUnref(cfg->caps); libxl_ctx_free(cfg->ctx); - libxlLoggerFree(cfg->logger); + if (cfg->logger) + libxlLoggerFree(cfg->logger); =20 VIR_FREE(cfg->configDir); VIR_FREE(cfg->autostartDir); --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 1518130950948744.1722515506389; Thu, 8 Feb 2018 15:02:30 -0800 (PST) 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 D0C02C0568F9; Thu, 8 Feb 2018 23:02:28 +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 584845EDE4; Thu, 8 Feb 2018 23:02:27 +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 6DBA04A46D; Thu, 8 Feb 2018 23:02:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1qUE023507 for ; Thu, 8 Feb 2018 18:01:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id C5F9E5D756; Thu, 8 Feb 2018 23:01:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2BC5D793 for ; Thu, 8 Feb 2018 23:01:50 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 063892CE911 for ; Thu, 8 Feb 2018 23:01:49 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 8399E20FAD; Thu, 8 Feb 2018 18:01:48 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:48 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id D88AD7E3DF; Thu, 8 Feb 2018 18:01:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=fXJx9l4uT/sTpyOHd5kR5U7VZGY59 9IlrA6OS1dfxi0=; b=Dx4m5vT24UWRVGEm5L5fBDKub5Dnw+TW0VtRJNuYw8gec ZZoJ/00BYVCYp6KPPx78dESiJ77M6ElhwDmVOklpl1llV45O024dEZixuFc+F60h 2e4sJ9w1D+YgSbdaLMjBHFL9VW9LSJvMzc9Wj466G4vrWPQj+m4wy4/Cq1wNldcn IpmtrAflmyYq4rvktNzBG5JRTy2ia1TtBuP9pKNiupN80DeXAasdgquondO7ua3U wwAbJAFzirbIXkrVfBGjm6R4hHm+DS8NuIA8KAEedx7Dfjxf8i/dExC92Xn8Kzq+ ZZbFEerKG3cAeZVaknzDK+LQ0M1uze1I0hVLNtdKQ== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:55 +0100 Message-Id: <3ad97061cc13677cd4121aaacc5d17b24d04f287.1518130692.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: 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.29]); Thu, 08 Feb 2018 23:01:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 08 Feb 2018 23:01:49 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 2/8] libxl: pass driver config to libxlMakeDomBuildInfo 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Feb 2018 23:02:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Preparation for global nestedhvm configuration - libxlMakeDomBuildInfo needs access to libxlDriverConfig. No functional change. Adjusting tests require slightly more mockup functions, because of libxlDriverConfigNew() call. --- Changes since v3: - new patch, preparation --- src/libxl/libxl_conf.c | 8 +++++--- src/libxl/libxl_conf.h | 2 +- src/libxl/libxl_domain.c | 2 +- tests/libxlxml2domconfigtest.c | 20 +++++++++++++------- tests/virmocklibxl.c | 25 +++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 2d2a707..8cced29 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -271,10 +271,11 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) =20 static int libxlMakeDomBuildInfo(virDomainDefPtr def, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, virCapsPtr caps, libxl_domain_config *d_config) { + libxl_ctx *ctx =3D cfg->ctx; libxl_domain_build_info *b_info =3D &d_config->b_info; int hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; size_t i; @@ -2288,16 +2289,17 @@ int libxlBuildDomainConfig(virPortAllocatorPtr graphicsports, virDomainDefPtr def, const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, virCapsPtr caps, libxl_domain_config *d_config) { + libxl_ctx *ctx =3D cfg->ctx; libxl_domain_config_init(d_config); =20 if (libxlMakeDomCreateInfo(ctx, def, &d_config->c_info) < 0) return -1; =20 - if (libxlMakeDomBuildInfo(def, ctx, caps, d_config) < 0) + if (libxlMakeDomBuildInfo(def, cfg, caps, d_config) < 0) return -1; =20 #ifdef LIBXL_HAVE_VNUMA diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 264df11..8eefe06 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -216,7 +216,7 @@ int libxlBuildDomainConfig(virPortAllocatorPtr graphicsports, virDomainDefPtr def, const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, virCapsPtr caps, libxl_domain_config *d_config); =20 diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 395c8a9..0a60444 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -1253,7 +1253,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, goto cleanup_dom; =20 if (libxlBuildDomainConfig(driver->reservedGraphicsPorts, vm->def, - cfg->channelDir, cfg->ctx, cfg->caps, &d_co= nfig) < 0) + cfg->channelDir, cfg, cfg->caps, &d_config)= < 0) goto cleanup_dom; =20 if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0) diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index bd4c3af..0105550 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -56,8 +56,8 @@ testCompareXMLToDomConfig(const char *xmlfile, int ret =3D -1; libxl_domain_config actualconfig; libxl_domain_config expectconfig; + libxlDriverConfigPtr cfg; xentoollog_logger *log =3D NULL; - libxl_ctx *ctx =3D NULL; virPortAllocatorPtr gports =3D NULL; virDomainXMLOptionPtr xmlopt =3D NULL; virDomainDefPtr vmdef =3D NULL; @@ -68,10 +68,16 @@ testCompareXMLToDomConfig(const char *xmlfile, libxl_domain_config_init(&actualconfig); libxl_domain_config_init(&expectconfig); =20 + if (!(cfg =3D libxlDriverConfigNew())) + goto cleanup; + if (!(log =3D (xentoollog_logger *)xtl_createlogger_stdiostream(stderr= , XTL_DEBUG, 0))) goto cleanup; =20 - if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, log) < 0) + /* replace logger with stderr one */ + libxl_ctx_free(cfg->ctx); + + if (libxl_ctx_alloc(&cfg->ctx, LIBXL_VERSION, 0, log) < 0) goto cleanup; =20 if (!(gports =3D virPortAllocatorNew("vnc", 5900, 6000, @@ -85,22 +91,22 @@ testCompareXMLToDomConfig(const char *xmlfile, NULL, VIR_DOMAIN_XML_INACTIVE))) goto cleanup; =20 - if (libxlBuildDomainConfig(gports, vmdef, NULL, ctx, caps, &actualconf= ig) < 0) + if (libxlBuildDomainConfig(gports, vmdef, NULL, cfg, caps, &actualconf= ig) < 0) goto cleanup; =20 - if (!(actualjson =3D libxl_domain_config_to_json(ctx, &actualconfig)))= { + if (!(actualjson =3D libxl_domain_config_to_json(cfg->ctx, &actualconf= ig))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Failed to retrieve JSON doc for libxl_domain_confi= g"); goto cleanup; } =20 virTestLoadFile(jsonfile, &tempjson); - if (libxl_domain_config_from_json(ctx, &expectconfig, tempjson) !=3D 0= ) { + if (libxl_domain_config_from_json(cfg->ctx, &expectconfig, tempjson) != =3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Failed to create libxl_domain_config from JSON doc= "); goto cleanup; } - if (!(expectjson =3D libxl_domain_config_to_json(ctx, &expectconfig)))= { + if (!(expectjson =3D libxl_domain_config_to_json(cfg->ctx, &expectconf= ig))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Failed to retrieve JSON doc for libxl_domain_confi= g"); goto cleanup; @@ -118,10 +124,10 @@ testCompareXMLToDomConfig(const char *xmlfile, virDomainDefFree(vmdef); virObjectUnref(gports); virObjectUnref(xmlopt); - libxl_ctx_free(ctx); libxl_domain_config_dispose(&actualconfig); libxl_domain_config_dispose(&expectconfig); xtl_logger_destroy(log); + virObjectUnref(cfg); return ret; } =20 diff --git a/tests/virmocklibxl.c b/tests/virmocklibxl.c index 747f9f8..133064b 100644 --- a/tests/virmocklibxl.c +++ b/tests/virmocklibxl.c @@ -27,6 +27,7 @@ # include # include # include +# include # include # include =20 @@ -48,6 +49,19 @@ VIR_MOCK_IMPL_RET_ARGS(xc_interface_open, } =20 =20 +VIR_MOCK_IMPL_RET_ARGS(libxl_get_version_info, + const libxl_version_info*, + libxl_ctx *, ctx) +{ + static libxl_version_info info; + + memset(&info, 0, sizeof(info)); + + return &info; + /* silence gcc warning */ + return real_libxl_get_version_info(ctx); +} + VIR_MOCK_STUB_RET_ARGS(xc_interface_close, int, 0, xc_interface *, handle) @@ -68,6 +82,17 @@ VIR_MOCK_STUB_RET_ARGS(xc_sharing_used_frames, VIR_MOCK_STUB_VOID_ARGS(xs_daemon_close, struct xs_handle *, handle) =20 +VIR_MOCK_IMPL_RET_ARGS(virFileMakePath, int, + const char *, path) +{ + /* replace log path with a writable directory */ + if (strstr(path, "/log/")) { + snprintf((char*)path, strlen(path), "."); + return 0; + } + return real_virFileMakePath(path); +} + VIR_MOCK_IMPL_RET_ARGS(__xstat, int, int, ver, const char *, path, --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 151813125097571.13336090183543; Thu, 8 Feb 2018 15:07:30 -0800 (PST) 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 B02D68B101; Thu, 8 Feb 2018 23:07:28 +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 461A0608F7; Thu, 8 Feb 2018 23:07:28 +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 ABFBC18033DC; Thu, 8 Feb 2018 23:07:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1sWv023549 for ; Thu, 8 Feb 2018 18:01:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id ACC4F60C9C; Thu, 8 Feb 2018 23:01:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A432760CA2 for ; Thu, 8 Feb 2018 23:01:51 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B7608553C for ; Thu, 8 Feb 2018 23:01:50 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 3A3AB20FBD; Thu, 8 Feb 2018 18:01:49 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:49 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 942AD7E3DF; Thu, 8 Feb 2018 18:01:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=8MmDrz2v1fcw3gD7g2uHiohLOSo1D ht1z8OAPCaFqxY=; b=ET/7odi1wbfMGhYLwlhXmh8JVwlqoC6i8IwYySzuUXmry LNjisa6Hr8deRgVGymRa+iS3Hd+8rm4ZE3DGXcENM+afZrJOs7wMplsAGzVxE1Nw rosCE0FxRBRuMchCDh4gjm/IRoLWMDM6hT/TGSL70cgSavJtcwRSZMlRx5exDzg1 dgNr13IZE69U375PZd/NmB/9sB9TYi60vDPh8tNsLb9uzfbNeMcptBtTetAWPn9k 7rOQXGwE+L3dszuBut7QMxfbzad8536kaMXsrxffdj2uUK5zQPYxUToZ+dNmHmtq 8Tc/7wIQN67TIckzqPdjKuLl/wuPRUe4GoNWzjrSg== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:56 +0100 Message-Id: In-Reply-To: References: 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.28]); Thu, 08 Feb 2018 23:01:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 23:01:50 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 3/8] 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: , 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.28]); Thu, 08 Feb 2018 23:07:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. But nevertheless this commit break some configurations that were working before. --- 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/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 +- 10 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 8cced29..66956a7 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/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 From nobody Mon Apr 29 00:23:39 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 1518131246522743.7702251684685; Thu, 8 Feb 2018 15:07:26 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 150208B103; Thu, 8 Feb 2018 23:07:25 +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 D09905D9CD; Thu, 8 Feb 2018 23:07:24 +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 8D01A4A470; Thu, 8 Feb 2018 23:07:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1rnW023518 for ; Thu, 8 Feb 2018 18:01:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E5BB60BB6; Thu, 8 Feb 2018 23:01:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87B06620B8 for ; Thu, 8 Feb 2018 23:01:51 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63A1BC059726 for ; Thu, 8 Feb 2018 23:01:50 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E488820FDA; Thu, 8 Feb 2018 18:01:49 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:49 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 476777E3DF; Thu, 8 Feb 2018 18:01:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=enBnYO7VjIkJ56k1Gn3cVePYsv6yA DGHmNKjjoYZSCY=; b=jCZCMKIRqWiDtrbvYDLZwmm9PGSkPgb4L3iXWCvBECCKt kZt7MzUQAmeKKPdsPLe+MrBkdWOoL9JSAVJu8aUTfItN1r2aEi8rnohFuUGtP+ne UVeFJ3sKl8euQYztKh+NCDXcQwZfkIhbWfpAjfjlFzBNMXWnjAeV5E+J8wylGuTz Yn0PzlZfhewptgee0hBzr/O8lDLmTTOjU1P/iwOAjepVLzMRHBdYx7GamPwgMRFy cCZafhKbEDFUHlBwa6uSDI3hl3pXJK/5pR8szdvYpZ2LVE5vfnzmzHLl/xk8SINj LK9W3CXfLiJdmRYLA0Jh5ZMHWMEGC0hHq4b4IMSEQ== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:57 +0100 Message-Id: In-Reply-To: References: 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.32]); Thu, 08 Feb 2018 23:01:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Feb 2018 23:01:50 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 4/8] libxl: do not enable nested HVM unless global nested_hvm option enabled 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 23:07:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce global libxl option for enabling nested HVM feature, similar to kvm module parameter. This will prevent enabling experimental feature by mere presence of element in domain config, unless explicitly enabled. element may be used to configure other features, like NUMA, or CPUID. Also, adjust xenconfig driver to appropriately translate to/from nestedhvm=3D1. While at it, adjust xenconfig driver to not override def->cpu if already set elsewhere. This will help with adding cpuid support. --- As for xenconfig part, I'm not sure if missing "nestedhvm" option in xl config shouldn't produce element too, to disable nested HVM (as it would be on plain xl). Any preference? Changes since v3: - use config option nested_hvm, instead of requiring explicit entries - title changed from "libxl: do not enable nested HVM by mere presence of element" - xenconfig: don't add since it is implied by presence of element - xenconfig: produce element even when converting on host not supporting vmx/svm, to not lose setting value Changes since v2: - new patch --- src/libxl/libxl.conf | 6 ++++++- src/libxl/libxl_conf.c | 7 ++++++- src/libxl/libxl_conf.h | 2 ++- src/xenconfig/xen_xl.c | 37 +++++++++++------------------------ tests/libxlxml2domconfigtest.c | 3 +++- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/libxl/libxl.conf b/src/libxl/libxl.conf index 264af7c..0e842c9 100644 --- a/src/libxl/libxl.conf +++ b/src/libxl/libxl.conf @@ -41,3 +41,9 @@ # #keepalive_interval =3D 5 #keepalive_count =3D 5 + +# Nested HVM global control. In order to use nested HVM feature, this opti= on +# needs to be enabled, in addition to specifying +# in domain configuration. +# By default it is disabled. +#nested_hvm =3D 0 diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 66956a7..417ce7c 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -366,7 +366,9 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, return -1; } =20 - if (ARCH_IS_X86(def->os.arch)) { + /* consider host support for nested HVM only if global nested_= hvm + * option enable it */ + if (cfg->nested_hvm && 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"); hasHwVirt =3D vmx | svm; @@ -1699,6 +1701,9 @@ int libxlDriverConfigLoadFile(libxlDriverConfigPtr cf= g, if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) goto cleanup; =20 + if (virConfGetValueBool(conf, "nested_hvm", &cfg->nested_hvm) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 8eefe06..e32a5e7 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -88,6 +88,8 @@ struct _libxlDriverConfig { int keepAliveInterval; unsigned int keepAliveCount; =20 + bool nested_hvm; + /* Once created, caps are immutable */ virCapsPtr caps; =20 diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 6cda305..394cc0d 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -170,17 +170,8 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vir= CapsPtr caps) if (xenConfigGetBool(conf, "nestedhvm", &val, -1) < 0) return -1; =20 - if (val =3D=3D 1) { - virCPUDefPtr cpu; - - if (VIR_ALLOC(cpu) < 0) - return -1; - - cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; - cpu->type =3D VIR_CPU_TYPE_GUEST; - def->cpu =3D cpu; - } else if (val =3D=3D 0) { - const char *vtfeature =3D NULL; + if (val !=3D -1) { + const char *vtfeature =3D "vmx"; =20 if (caps && caps->host.cpu && ARCH_IS_X86(def->os.arch)) { if (virCPUCheckFeature(caps->host.arch, caps->host.cpu, "v= mx")) @@ -189,28 +180,24 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vi= rCapsPtr caps) vtfeature =3D "svm"; } =20 - if (vtfeature) { + if (!def->cpu) { virCPUDefPtr cpu; - if (VIR_ALLOC(cpu) < 0) return -1; =20 - if (VIR_ALLOC(cpu->features) < 0) { - VIR_FREE(cpu); - return -1; - } - - if (VIR_STRDUP(cpu->features->name, vtfeature) < 0) { - VIR_FREE(cpu->features); - VIR_FREE(cpu); - return -1; - } - cpu->features->policy =3D VIR_CPU_FEATURE_DISABLE; - cpu->nfeatures =3D cpu->nfeatures_max =3D 1; cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; cpu->type =3D VIR_CPU_TYPE_GUEST; + cpu->nfeatures =3D 0; + cpu->nfeatures_max =3D 0; def->cpu =3D cpu; } + + if (val =3D=3D 0) { + if (virCPUDefAddFeature(def->cpu, + vtfeature, + VIR_CPU_FEATURE_DISABLE) < 0) + return -1; + } } } else { if (xenConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader= ) < 0) diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 0105550..f2af286 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -74,6 +74,9 @@ testCompareXMLToDomConfig(const char *xmlfile, if (!(log =3D (xentoollog_logger *)xtl_createlogger_stdiostream(stderr= , XTL_DEBUG, 0))) goto cleanup; =20 + /* for testing nested HVM */ + cfg->nested_hvm =3D true; + /* replace logger with stderr one */ libxl_ctx_free(cfg->ctx); =20 --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 15181312429046.281503631476539; Thu, 8 Feb 2018 15:07:22 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5F2B4900E; Thu, 8 Feb 2018 23:07:21 +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 7E36B5D9C6; Thu, 8 Feb 2018 23:07:21 +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 44B2F4A46E; Thu, 8 Feb 2018 23:07:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1qlC023508 for ; Thu, 8 Feb 2018 18:01:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8DE55D793; Thu, 8 Feb 2018 23:01:52 +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 BFF9E5EDE4 for ; Thu, 8 Feb 2018 23:01:52 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37F8F4E907 for ; Thu, 8 Feb 2018 23:01:51 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9AD7F20F6C; Thu, 8 Feb 2018 18:01:50 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:50 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id F04AA7E3FA; Thu, 8 Feb 2018 18:01:49 -0500 (EST) 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=fm1; bh=NvGGm+zxWNh3MVcwSTAZmtLGQocsfeHnlvtKLA8qA 5U=; b=PQ/oyKHCYYMgdwSOBTcjkWmVe6M3PPvsSl0JENUqayOQnUEHTVPSJ59sE cbTQ4vY4JXcJ5PX7+iK6XYzWFT1KJOHl2kMWQwBNYDkmz8B7erqG6p2v1CuxJlbW i+4lUhTykO6iVTDxZ2wKFyYfls1Ar6w059Qjg1rwFGagDxNMcrqf1HEyR2Mqjn3q +TJN5nPcC2ygq3BnoQnA9Xy2WB0Cu6sGovnzQkh2k/kz3KcRAcnKa1i71LckpZjQ 6/E6f1cYES/54FpP5TdlH1THMoEu+e0yqme3yBZfh74AggYvE1aTmK270coKVMoU DEg0excvEusZ7dkMN21bWxallOZBw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:58 +0100 Message-Id: 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]); Thu, 08 Feb 2018 23:01:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Feb 2018 23:01:51 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 5/8] libxl: add support for CPUID features policy 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Feb 2018 23:07:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Convert CPU features policy into libxl cpuid policy settings. Use new ("libxl") syntax, which allow to enable/disable specific bits, using host CPU as a base. For this reason, only "host-passthrough" mode is accepted. Libxl do not have distinction between "force" and "required" policy (there is only "force") and also between "forbid" and "disable" (there is only "disable"). So, merge them appropriately. If anything, "require" and "forbid" should be enforced outside of specific driver. Nested HVM (vmx and svm features) is handled separately, so exclude it from translation. Signed-off-by: Marek Marczykowski-G=C3=B3recki --- Changes since v2: - drop spurious changes - move libxlTranslateCPUFeature function to xen_xl.c, to be reused by xenconfig driver Changes since v1: - use new ("libxl") syntax to set only bits explicitly mentioned in domain XML --- src/libxl/libxl_conf.c | 35 ++++++++++++++++++++++++++++++++++- src/xenconfig/xen_xl.c | 34 ++++++++++++++++++++++++++++++++++ src/xenconfig/xen_xl.h | 2 ++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 417ce7c..d0afc1f 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -50,6 +50,7 @@ #include "secret_util.h" #include "cpu/cpu.h" #include "xen_common.h" +#include "xen_xl.h" =20 =20 #define VIR_FROM_THIS VIR_FROM_LIBXL @@ -358,6 +359,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, if (caps && def->cpu) { bool hasHwVirt =3D false; bool svm =3D false, vmx =3D false; + char xlCPU[32]; =20 if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -382,12 +384,43 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, case VIR_CPU_FEATURE_DISABLE: case VIR_CPU_FEATURE_FORBID: if ((vmx && STREQ(def->cpu->features[i].name, = "vmx")) || - (svm && STREQ(def->cpu->features[i].name, = "svm"))) + (svm && STREQ(def->cpu->features[i].name, = "svm"))) { hasHwVirt =3D false; + continue; + } + + snprintf(xlCPU, + sizeof(xlCPU), + "%s=3D0", + xenTranslateCPUFeature( + def->cpu->features[i].name, + false)); + if (libxl_cpuid_parse_config(&b_info->cpuid, x= lCPU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported cpu feature '%s'"), + def->cpu->features[i].name); + return -1; + } break; =20 case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: + if ((vmx && STREQ(def->cpu->features[i].name, = "vmx")) || + (svm && STREQ(def->cpu->features[i].name, = "svm"))) + continue; + + snprintf(xlCPU, + sizeof(xlCPU), + "%s=3D1", + xenTranslateCPUFeature( + def->cpu->features[i].name, false)= ); + if (libxl_cpuid_parse_config(&b_info->cpuid, x= lCPU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported cpu feature '%s'"), + def->cpu->features[i].name); + return -1; + } + break; case VIR_CPU_FEATURE_OPTIONAL: case VIR_CPU_FEATURE_LAST: break; diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 394cc0d..d5dff59 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -218,6 +218,40 @@ xenParseXLOS(virConfPtr conf, virDomainDefPtr def, vir= CapsPtr caps) return 0; } =20 +/* + * Translate CPU feature name from libvirt to libxl (from_libxl=3Dfalse) o= r from + * libxl to libvirt (from_libxl=3Dtrue). + */ +const char * +xenTranslateCPUFeature(const char *feature_name, bool from_libxl) +{ + static const char *translation_table[][2] =3D { + /* libvirt name, libxl name */ + { "cx16", "cmpxchg16" }, + { "cid", "cntxid" }, + { "ds_cpl", "dscpl" }, + { "pclmuldq", "pclmulqdq" }, + { "pni", "sse3" }, + { "ht", "htt" }, + { "pn", "psn" }, + { "clflush", "clfsh" }, + { "sep", "sysenter" }, + { "cx8", "cmpxchg8" }, + { "nodeid_msr", "nodeid" }, + { "cr8legacy", "altmovcr8" }, + { "lahf_lm", "lahfsahf" }, + { "cmp_legacy", "cmplegacy" }, + { "fxsr_opt", "ffxsr" }, + { "pdpe1gb", "page1gb" }, + }; + size_t i; + + for (i =3D 0; i < ARRAY_CARDINALITY(translation_table); i++) + if (STREQ(translation_table[i][from_libxl], feature_name)) + return translation_table[i][!from_libxl]; + return feature_name; +} + =20 static int xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h index dd96326..68f332a 100644 --- a/src/xenconfig/xen_xl.h +++ b/src/xenconfig/xen_xl.h @@ -33,4 +33,6 @@ virDomainDefPtr xenParseXL(virConfPtr conn, =20 virConfPtr xenFormatXL(virDomainDefPtr def, virConnectPtr); =20 +const char *xenTranslateCPUFeature(const char *feature_name, bool from_lib= xl); + #endif /* __VIR_XEN_XL_H__ */ --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 1518131149933957.1807468245338; Thu, 8 Feb 2018 15:05:49 -0800 (PST) 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 8B98D356D4; Thu, 8 Feb 2018 23:05:48 +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 5861F608F4; Thu, 8 Feb 2018 23:05:48 +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 1584418033E1; Thu, 8 Feb 2018 23:05:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1sIX023540 for ; Thu, 8 Feb 2018 18:01:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9AA295EE03; Thu, 8 Feb 2018 23:01:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 923AE5EDE5 for ; Thu, 8 Feb 2018 23:01:53 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2ED410F3C6 for ; Thu, 8 Feb 2018 23:01:51 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 508A720FE9; Thu, 8 Feb 2018 18:01:51 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:51 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id A8D997E3DF; Thu, 8 Feb 2018 18:01:50 -0500 (EST) 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=fm1; bh=uDjm4nChR1DgXtkIsFBgtdMGOAmrH30PWfgODDA7N +o=; b=JUR3yOzsnHXm+NcSvsK0umdt+ovDmpPuvar/1KMOaLeRlG+u+GdRYiXgP KOyl62ojIPjeavZxjfcvDcO06m11BA9IbBpM5n242WPv9v+u6C5qgoeuFX3QCmpI RV1UELZldKonDiuhr1Ic9ermDf9IGyE0se6GyZiiBX11sPX1zQKFtD4XH6yYgibn qduGqQUIg5YPRKUwyqo1Mxxj9f9u06cyAWg3NljYOCsLc7ltCnD1Qdg/EFkLp2rn Umzi3WhDdtDcHvaPP2+LMa/mDxBV+sDXDs2A5W6y/XgeTU3BNzILCp78yl64OPbK /QCcRXWdq/vpwsSJTlt28KKvUW3uw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:58:59 +0100 Message-Id: <3b9f38a162c7f6d859399f5f958b4c549194e38c.1518130692.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.39]); Thu, 08 Feb 2018 23:01:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 08 Feb 2018 23:01:52 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 6/8] tests: check CPU features handling in libxl driver 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 23:05:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Test enabling/disabling individual CPU features and also setting nested HVM support, which is also controlled by CPU features node. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig --- Changes since v3: - adjust for modified nested HVM handling Changes since v1: - rewritten to Jim's test suite for libxl_domain_config generator --- tests/libxlxml2domconfigdata/fullvirt-cpuid.json | 64 +++++++++++++++++- tests/libxlxml2domconfigdata/fullvirt-cpuid.xml | 37 ++++++++++- tests/libxlxml2domconfigtest.c | 1 +- 3 files changed, 102 insertions(+) create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.json create mode 100644 tests/libxlxml2domconfigdata/fullvirt-cpuid.xml diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxl= xml2domconfigdata/fullvirt-cpuid.json new file mode 100644 index 0000000..28037be --- /dev/null +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json @@ -0,0 +1,64 @@ +{ + "c_info": { + "type": "hvm", + "name": "XenGuest2", + "uuid": "c7a5fdb2-cdaf-9455-926a-d65c16db1809" + }, + "b_info": { + "max_vcpus": 1, + "avail_vcpus": [ + 0 + ], + "max_memkb": 592896, + "target_memkb": 403456, + "video_memkb": 8192, + "shadow_memkb": 5656, + "cpuid": [ + { + "leaf": 1, + "ecx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0", + "edx": "xxxxxxxxxxxxxxxxxxxxxxxxxxx1xxxx" + } + ], + "sched_params": { + "weight": 1000 + }, + "type.hvm": { + "pae": "True", + "apic": "True", + "acpi": "True", + "vga": { + + }, + "nested_hvm": "False", + "vnc": { + "enable": "False" + }, + "sdl": { + "enable": "False" + }, + "spice": { + + }, + "boot": "c", + "rdm": { + + } + }, + "arch_arm": { + + } + }, + "disks": [ + { + "pdev_path": "/dev/HostVG/XenGuest2", + "vdev": "hda", + "backend": "phy", + "format": "raw", + "removable": 1, + "readwrite": 1 + } + ], + "on_reboot": "restart", + "on_crash": "restart" +} diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml b/tests/libxlx= ml2domconfigdata/fullvirt-cpuid.xml new file mode 100644 index 0000000..e9eba2e --- /dev/null +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml @@ -0,0 +1,37 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + hvm + + + + + + + + + + + + + destroy + restart + restart + + + + + +
+ + + + + + diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index f2af286..fbac010 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -200,6 +200,7 @@ mymain(void) DO_TEST("moredevs-hvm"); DO_TEST("vnuma-hvm"); DO_TEST("multiple-ip"); + DO_TEST("fullvirt-cpuid"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 1518130970187743.1432519139522; Thu, 8 Feb 2018 15:02:50 -0800 (PST) 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 91B098553C; Thu, 8 Feb 2018 23:02:48 +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 58032608EF; Thu, 8 Feb 2018 23:02:48 +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 1D9904A472; Thu, 8 Feb 2018 23:02:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1spm023523 for ; Thu, 8 Feb 2018 18:01:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0940E17C47; Thu, 8 Feb 2018 23:01:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0418D17C3E for ; Thu, 8 Feb 2018 23:01:53 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBFE18B10C for ; Thu, 8 Feb 2018 23:01:52 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 1CEB220FAD; Thu, 8 Feb 2018 18:01:52 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:52 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 67C547E537; Thu, 8 Feb 2018 18:01:51 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=I/EvJVrRkkU+DPvnDDXr3sw4tOaEe hNIpwRse2kK/d4=; b=RhyCEhq5SY3vwRdyZ+cFo9CR/hKYy4J5152IdQD/iSrUt FD0HzZeDQ9nIHzMEDLZ/QOWqBJ7pUS/uMmn/Zx4XxNCiJiP61E3tLAySozyyXB8s oSAjp4zQIK/8xWNhXm5VHYV/0GFFM9Mw+wqe2heCUVf7UJ8pHD5VpuVkqjl4Qbn/ wCPWJFW4ugigUm+twuq++FrrbYGO8kNzwmDRPAnyzWPi5VXC7+GjbcppCMHj1md6 jmEsGbC5Eh6DksEVwLI+DQHNhBUETrQXINLyEL7kb+guU00A23R7OmTp3PO45c0s Z/WAw2vgHy7zae53z7/fDhUY+1wxV5U5/f33U5bog== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:59:00 +0100 Message-Id: <25ae2e20faf3f76173e17897b3e171841ced247a.1518130692.git-series.marmarek@invisiblethingslab.com> In-Reply-To: References: 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.28]); Thu, 08 Feb 2018 23:01:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Feb 2018 23:01:53 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 7/8] xenconfig: add CPUID handling to domXML <-> xl.cfg conversion 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.28]); Thu, 08 Feb 2018 23:02:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Only "libxl" format supported for now. Special care needed around vmx/svm, because those two are translated into "nestedhvm" setting. Reviewed-by: Jim Fehlig --- Changes since v3: - improve error reporting (VIR_ERR_CONF_SYNTAX) - ignore empty cpuid option - same as libxl - fix cleanup on error Changes since v2: - new patch --- src/xenconfig/xen_xl.c | 165 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 165 insertions(+) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index d5dff59..ffec0ba 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -252,6 +252,91 @@ xenTranslateCPUFeature(const char *feature_name, bool = from_libxl) return feature_name; } =20 +static int +xenParseXLCPUID(virConfPtr conf, virDomainDefPtr def) +{ + const char *cpuid_str =3D NULL; + char **cpuid_pairs =3D NULL; + char **name_and_value =3D NULL; + size_t i; + int ret =3D -1; + int policy; + + if (xenConfigGetString(conf, "cpuid", &cpuid_str, NULL) < 0) + return -1; + + if (!cpuid_str) + return 0; + + if (!def->cpu) { + if (VIR_ALLOC(def->cpu) < 0) + goto cleanup; + def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + def->cpu->type =3D VIR_CPU_TYPE_GUEST; + def->cpu->nfeatures =3D 0; + def->cpu->nfeatures_max =3D 0; + } + + cpuid_pairs =3D virStringSplit(cpuid_str, ",", 0); + if (!cpuid_pairs) + goto cleanup; + + if (!cpuid_pairs[0]) { + ret =3D 0; + goto cleanup; + } + + if (STRNEQ(cpuid_pairs[0], "host")) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("cpuid starting with %s is not supported, only li= bxl format is"), + cpuid_pairs[0]); + goto cleanup; + } + + for (i =3D 1; cpuid_pairs[i]; i++) { + name_and_value =3D virStringSplit(cpuid_pairs[i], "=3D", 2); + if (!name_and_value) + goto cleanup; + if (!name_and_value[0] || !name_and_value[1]) { + virReportError(VIR_ERR_CONF_SYNTAX, + _("Invalid libxl cpuid key=3Dvalue element: %s"= ), + cpuid_pairs[i]); + goto cleanup; + } + if (STREQ(name_and_value[1], "1")) { + policy =3D VIR_CPU_FEATURE_FORCE; + } else if (STREQ(name_and_value[1], "0")) { + policy =3D VIR_CPU_FEATURE_DISABLE; + } else if (STREQ(name_and_value[1], "x")) { + policy =3D VIR_CPU_FEATURE_OPTIONAL; + } else if (STREQ(name_and_value[1], "k")) { + policy =3D VIR_CPU_FEATURE_OPTIONAL; + } else if (STREQ(name_and_value[1], "s")) { + policy =3D VIR_CPU_FEATURE_OPTIONAL; + } else { + virReportError(VIR_ERR_CONF_SYNTAX, + _("Invalid libxl cpuid value: %s"), + cpuid_pairs[i]); + goto cleanup; + } + + if (virCPUDefAddFeature(def->cpu, + xenTranslateCPUFeature(name_and_value[0], = true), + policy) < 0) + goto cleanup; + + virStringListFree(name_and_value); + name_and_value =3D NULL; + } + + ret =3D 0; + + cleanup: + virStringListFree(name_and_value); + virStringListFree(cpuid_pairs); + return ret; +} + =20 static int xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) @@ -1089,6 +1174,9 @@ xenParseXL(virConfPtr conf, goto cleanup; #endif =20 + if (xenParseXLCPUID(conf, def) < 0) + goto cleanup; + if (xenParseXLDisk(conf, def) < 0) goto cleanup; =20 @@ -1231,6 +1319,80 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def) return 0; } =20 +static int +xenFormatXLCPUID(virConfPtr conf, virDomainDefPtr def) +{ + char **cpuid_pairs =3D NULL; + char *cpuid_string =3D NULL; + size_t i, j; + int ret =3D -1; + + if (!def->cpu) + return 0; + + if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("'%s' CPU mode not supported, only host-passthrou= gh is"), + virCPUModeTypeToString(def->cpu->mode)); + return -1; + } + + /* "host" + all features + NULL */ + if (VIR_ALLOC_N(cpuid_pairs, def->cpu->nfeatures + 2) < 0) + return -1; + + if (VIR_STRDUP(cpuid_pairs[0], "host") < 0) + goto cleanup; + + j =3D 1; + for (i =3D 0; i < def->cpu->nfeatures; i++) { + const char *feature_name =3D xenTranslateCPUFeature( + def->cpu->features[i].name, + false); + const char *policy =3D NULL; + + if (STREQ(feature_name, "vmx") || STREQ(feature_name, "svm")) + /* ignore vmx/svm in cpuid option, translated into nestedhvm + * elsewhere */ + continue; + + switch (def->cpu->features[i].policy) { + case VIR_CPU_FEATURE_FORCE: + case VIR_CPU_FEATURE_REQUIRE: + policy =3D "1"; + break; + case VIR_CPU_FEATURE_OPTIONAL: + policy =3D "x"; + break; + case VIR_CPU_FEATURE_DISABLE: + case VIR_CPU_FEATURE_FORBID: + policy =3D "0"; + break; + } + if (virAsprintf(&cpuid_pairs[j++], "%s=3D%s", + feature_name, + policy) < 0) + goto cleanup; + } + cpuid_pairs[j] =3D NULL; + + if (j > 1) { + cpuid_string =3D virStringListJoin((const char **)cpuid_pairs, ","= ); + if (!cpuid_string) + goto cleanup; + + if (xenConfigSetString(conf, "cpuid", cpuid_string) < 0) + goto cleanup; + } + + ret =3D 0; + + cleanup: + virStringListFree(cpuid_pairs); + VIR_FREE(cpuid_string); + return ret; +} + #ifdef LIBXL_HAVE_VNUMA static int xenFormatXLVnode(virConfValuePtr list, @@ -1996,6 +2158,9 @@ xenFormatXL(virDomainDefPtr def, virConnectPtr conn) if (xenFormatXLOS(conf, def) < 0) goto cleanup; =20 + if (xenFormatXLCPUID(conf, def) < 0) + goto cleanup; + #ifdef LIBXL_HAVE_VNUMA if (xenFormatXLDomainVnuma(conf, def) < 0) goto cleanup; --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 00:23:39 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 1518131146086802.135129947918; Thu, 8 Feb 2018 15:05:46 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD68D883B1; Thu, 8 Feb 2018 23:05:44 +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 78C72620A3; Thu, 8 Feb 2018 23:05:44 +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 397EB18033DD; Thu, 8 Feb 2018 23:05:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18N1s55023531 for ; Thu, 8 Feb 2018 18:01:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4BC3617C3E; Thu, 8 Feb 2018 23:01:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 456C660170 for ; Thu, 8 Feb 2018 23:01:54 +0000 (UTC) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 781EBC070159 for ; Thu, 8 Feb 2018 23:01:53 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C75C720FDD; Thu, 8 Feb 2018 18:01:52 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Thu, 08 Feb 2018 18:01:52 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 26F797E3DF; Thu, 8 Feb 2018 18:01:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Xtzv9hC5CcBAyMhQ3Ifu7SaZHeCoP 9+3G/b6bc205c4=; b=rQPaNHZIHGp26AEoo4Hkx3T52bNixzmtdvVoCxXc9EXvr RFOUrHPSTraqlnd1DNdAlQgtu9IBwwALK/0NucHCLRAw8iv9UN0ygeWCU0TAE1Er YebJxSywNDW8oqm6p7WWnw65yCDTFSXXwkwOXRbo4Nj8K+dWF6fq3/7bHDMs4Vo6 +uX0vUo/cHY+RpC6ZmlzebvYnX5k3lo86e0aI15d0RYGFauG5Mhx0T2QoMY5IgGH q84NUmEqw0AEDcvAobYtHeuyEJIwVsAaTH1iaUO1IuJdEk2qzbgUDcpO2u2b+cuX Kpx9ZnIiQTZtRzLntoWZf7fGPKkS3vpxNoPjtoCOA== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 8 Feb 2018 23:59:01 +0100 Message-Id: In-Reply-To: References: 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.31]); Thu, 08 Feb 2018 23:01:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 08 Feb 2018 23:01:53 +0000 (UTC) for IP:'66.111.4.26' DOMAIN:'out2-smtp.messagingengine.com' HELO:'out2-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.72 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 66.111.4.26 out2-smtp.messagingengine.com 66.111.4.26 out2-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 8/8] tests: add test case for CPUID in xenconfig driver 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 08 Feb 2018 23:05:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Check conversion of "cpuid" setting, check all supported policy settings ("1", "0", "x"). Also, check interaction with "nestedhvm" - should not be included as "vmx=3D1" in "cpuid" setting. Reviewed-by: Jim Fehlig --- Changes since v3: - adjust for nested HVM enabled by just element Changes since v2: - new patch --- tests/xlconfigdata/test-fullvirt-cpuid.cfg | 25 ++++++++++++++++- tests/xlconfigdata/test-fullvirt-cpuid.xml | 35 +++++++++++++++++++++++- tests/xlconfigtest.c | 1 +- 3 files changed, 61 insertions(+) create mode 100644 tests/xlconfigdata/test-fullvirt-cpuid.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-cpuid.xml diff --git a/tests/xlconfigdata/test-fullvirt-cpuid.cfg b/tests/xlconfigdat= a/test-fullvirt-cpuid.cfg new file mode 100644 index 0000000..bb7b9c7 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-cpuid.cfg @@ -0,0 +1,25 @@ +name =3D "XenGuest2" +uuid =3D "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem =3D 579 +memory =3D 394 +vcpus =3D 1 +pae =3D 1 +acpi =3D 0 +apic =3D 0 +viridian =3D 0 +rtc_timeoffset =3D 0 +localtime =3D 0 +on_poweroff =3D "destroy" +on_reboot =3D "restart" +on_crash =3D "restart" +device_model =3D "/usr/lib/xen/bin/qemu-system-i386" +sdl =3D 0 +vnc =3D 1 +vncunused =3D 1 +vnclisten =3D "127.0.0.1" +parallel =3D "none" +serial =3D "none" +builder =3D "hvm" +boot =3D "d" +nestedhvm =3D 1 +cpuid =3D "host,tm=3D0,sse3=3D1,page1gb=3Dx" diff --git a/tests/xlconfigdata/test-fullvirt-cpuid.xml b/tests/xlconfigdat= a/test-fullvirt-cpuid.xml new file mode 100644 index 0000000..adc55d2 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-cpuid.xml @@ -0,0 +1,35 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + hvm + /usr/lib/xen/boot/hvmloader + + + + + + + + + + + + destroy + restart + restart + + /usr/lib/xen/bin/qemu-system-i386 + + + + + + + + diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 57a0a67..39f51e2 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -270,6 +270,7 @@ mymain(void) DO_TEST("fullvirt-multi-timer"); DO_TEST("fullvirt-nestedhvm"); DO_TEST("fullvirt-nestedhvm-disabled"); + DO_TEST("fullvirt-cpuid"); #ifdef LIBXL_HAVE_VNUMA DO_TEST("fullvirt-vnuma"); DO_TEST_PARSE("fullvirt-vnuma-autocomplete", false); --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list