From nobody Fri Apr 26 16:05:08 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 1523495091842440.65854906449283; Wed, 11 Apr 2018 18:04:51 -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 9138A30BC117; Thu, 12 Apr 2018 01:04:50 +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 52B376E70A; Thu, 12 Apr 2018 01:04:50 +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 0B583180215E; Thu, 12 Apr 2018 01:04:50 +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 w3C14Kvv018663 for ; Wed, 11 Apr 2018 21:04:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 98C63BAA7; Thu, 12 Apr 2018 01:04:20 +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 93132BA8A for ; Thu, 12 Apr 2018 01:04:20 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6958585359 for ; Thu, 12 Apr 2018 01:04:13 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9BC2E218A8; Wed, 11 Apr 2018 21:04:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:12 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 094881025A; Wed, 11 Apr 2018 21:04:11 -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=MdrUpvN8xX0zBhTEYGeQ9nETKNwtaKjatwE3CzpeC h4=; b=nWxwzdri5zBenGiyRkUGCfbwTRH5q811FaDZnmJoaFITeQI/NlUwxWQTd mrqKGGzntjEUOC3/yyFyMNwpUVRkFt6lMjKt8yRxIM9iNX1xrrtHr2DhcxqAzFbL XO39SfmmCUFQmIjk+iWYexUp5bDPgJCsU0THnTbyct2ngF+CDEbmZZp1t7q8LMzD 2i1yg1c4wYNgpYifVvY0fNbHvnQkdA1J6C6xOj+I0MUxKZe9SFNw/LdSiDhHkAdR jLYCbBT0DqK0+P9eQP2PLZa8qZnjMjzArnaqlbSrL19XpiEQn3CvvdepVHkq2igt 3SwZHURoJs6zA5/+m0PQIGHx1UWcg== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:19 +0200 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.25]); Thu, 12 Apr 2018 01:04:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Apr 2018 01:04:13 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 1/9] 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: , 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.42]); Thu, 12 Apr 2018 01:04:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 libxlDriverConfigNew() use libxlDriverConfigDispose() for cleanup in case of errors. Do not call libxlLoggerFree() on not allocated logger (NULL). Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 df1cece..ae369bc 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 Fri Apr 26 16:05:08 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 1523495067443904.4045410008004; Wed, 11 Apr 2018 18:04:27 -0700 (PDT) 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 7C0C73134C44; Thu, 12 Apr 2018 01:04: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 4E80D832AF; Thu, 12 Apr 2018 01:04: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 204704CA9D; Thu, 12 Apr 2018 01:04:20 +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 w3C14HQM018621 for ; Wed, 11 Apr 2018 21:04:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id D4645BAA7; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB0C6BA8A for ; Thu, 12 Apr 2018 01:04:14 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB30B312D130 for ; Thu, 12 Apr 2018 01:04:13 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 4870620E94; Wed, 11 Apr 2018 21:04:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:13 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id A5F831025D; Wed, 11 Apr 2018 21:04:12 -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=SIZlZGa+PlFdLVnU0RrQMzk3hocIlyJxr0Si4NUq1 XY=; b=aftOKA+o8wbpkuEyZQhwE3vg9YB6BMoTf0wnaItvPRZF2/LfJ0wK3d7Hb u4P/3fuRa5F+Tjmc9DOGAE1rgpsItgTiDF8GGKaySFBWB4ZRFt02cjj0I0Y0Az/I ZNJML1dgn1uwbQRI2gTYbn2wW4CM7JynpooKUeaaJjmRjl3Hwdq9cmZjxBWh9r9P 8nLSabUJfU6/6Mqt5KWPXljBg4GROX3w/zSLAtCQdAZqHNQbFSk0VRuMwNbRgU9n OC8kSanXSN1juZHue41HTlkrHswdBGDL4PCyQalqnA91Pl0T7+sE/jxc1dK+eqOr RnGaXrRnA3TkT7NYg2EUIp8yMBR2Q== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:20 +0200 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.48]); Thu, 12 Apr 2018 01:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 12 Apr 2018 01:04:14 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 2/9] 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: , 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.44]); Thu, 12 Apr 2018 01:04:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Preparation for global nestedhvm configuration - libxlMakeDomBuildInfo needs access to libxlDriverConfig. No functional change. Adjusting tests require slightly more mockup functions, because of libxlDriverConfigNew() call. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v6: - tests: add libxl_get_free_memory mock needed on Xen 4.5 Changes since v4: - drop now unneeded parameters Changes since v3: - new patch, preparation --- src/libxl/libxl_conf.c | 13 +++++++------ src/libxl/libxl_conf.h | 4 +--- src/libxl/libxl_domain.c | 2 +- tests/libxlxml2domconfigtest.c | 23 ++++++++++++++++------- tests/virmocklibxl.c | 31 +++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 17 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index ae369bc..2565f64 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -271,11 +271,12 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) =20 static int libxlMakeDomBuildInfo(virDomainDefPtr def, - libxl_ctx *ctx, + libxlDriverConfigPtr cfg, virCapsPtr caps, libxl_domain_config *d_config) { virDomainClockDef clock =3D def->clock; + 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; @@ -2346,17 +2347,17 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver= , virNodeInfoPtr info) int libxlBuildDomainConfig(virPortAllocatorRangePtr graphicsports, virDomainDefPtr def, - const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, - virCapsPtr caps, + libxlDriverConfigPtr cfg, libxl_domain_config *d_config) { + virCapsPtr caps =3D cfg->caps; + 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 @@ -2388,7 +2389,7 @@ libxlBuildDomainConfig(virPortAllocatorRangePtr graph= icsports, #endif =20 #ifdef LIBXL_HAVE_DEVICE_CHANNEL - if (libxlMakeChannelList(channelDir, def, d_config) < 0) + if (libxlMakeChannelList(cfg->channelDir, def, d_config) < 0) return -1; #endif =20 diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 0e85dff..633ebf5 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -215,9 +215,7 @@ libxlCreateXMLConf(void); int libxlBuildDomainConfig(virPortAllocatorRangePtr graphicsports, virDomainDefPtr def, - const char *channelDir LIBXL_ATTR_UNUSED, - libxl_ctx *ctx, - virCapsPtr caps, + libxlDriverConfigPtr cfg, libxl_domain_config *d_config); =20 static inline void diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index ef9a902..0614589 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -1261,7 +1261,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, &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 6eec4c7..9d280e9 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; virPortAllocatorRangePtr gports =3D NULL; virDomainXMLOptionPtr xmlopt =3D NULL; virDomainDefPtr vmdef =3D NULL; @@ -68,10 +68,18 @@ testCompareXMLToDomConfig(const char *xmlfile, libxl_domain_config_init(&actualconfig); libxl_domain_config_init(&expectconfig); =20 + if (!(cfg =3D libxlDriverConfigNew())) + goto cleanup; + + cfg->caps =3D caps; + 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 virPortAllocatorRangeNew("vnc", 5900, 6000))) @@ -84,22 +92,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, cfg, &actualconfig) < 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; @@ -122,10 +130,11 @@ testCompareXMLToDomConfig(const char *xmlfile, virDomainDefFree(vmdef); virPortAllocatorRangeFree(gports); virObjectUnref(xmlopt); - libxl_ctx_free(ctx); libxl_domain_config_dispose(&actualconfig); libxl_domain_config_dispose(&expectconfig); xtl_logger_destroy(log); + cfg->caps =3D NULL; + virObjectUnref(cfg); return ret; } =20 diff --git a/tests/virmocklibxl.c b/tests/virmocklibxl.c index 9735956..50ae258 100644 --- a/tests/virmocklibxl.c +++ b/tests/virmocklibxl.c @@ -27,6 +27,7 @@ # include # include # include +# include # include # include # include @@ -49,6 +50,25 @@ 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)); + + /* silence gcc warning about unused function */ + if (0) + real_libxl_get_version_info(ctx); + return &info; +} + +VIR_MOCK_STUB_RET_ARGS(libxl_get_free_memory, + int, 0, + libxl_ctx *, ctx, + uint32_t *, memkb); + VIR_MOCK_STUB_RET_ARGS(xc_interface_close, int, 0, xc_interface *, handle) @@ -75,6 +95,17 @@ VIR_MOCK_STUB_RET_ARGS(bind, const struct sockaddr *, addr, socklen_t, addrlen) =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 Fri Apr 26 16:05:08 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 1523495084893101.36819384385353; Wed, 11 Apr 2018 18:04:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EEC285A01; Thu, 12 Apr 2018 01:04:43 +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 5A9CAA0996; Thu, 12 Apr 2018 01:04:43 +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 250294CAA3; Thu, 12 Apr 2018 01:04:43 +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 w3C14Jts018627 for ; Wed, 11 Apr 2018 21:04:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3ECF4A09A0; Thu, 12 Apr 2018 01:04:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36902A0996 for ; Thu, 12 Apr 2018 01:04:15 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D67C356C3 for ; Thu, 12 Apr 2018 01:04:14 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E1FC9217D9; Wed, 11 Apr 2018 21:04:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:13 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 513BE10261; Wed, 11 Apr 2018 21:04:13 -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=9nahYcw4xldnjOmdsvf29c8tH9Xk47kfy+Rt2FhAy u0=; b=gOQx0gRyYa6pG3f+dIG/UB+rtAkV13w6BCKyF3/kgWLIzfr2zDgPzWqP/ wPJj4sEwo61VE7LL6os8rCS/T1KFa6R7RDjOEI1kOfIwBh8Kq2C8OhjUygVlLKBS 7BKZB8w/NgcyerjddZa0KBhSfZc5oah7j2wkTtLcHq6ymjgfDDU4lWHJp86aqj0V PiRflQ6aKOV22GpCNOT0Ft1/4nUwo3yQen/kNkinYUqGSr2XmT8Y7Kud6ywkbT+a L8eQJynVEjCUFiTiITigzDwIXv2mqtVdYlukdVuzsneLXA666KPjDTlajOiDw70H 8kO0V/+BSb6lPvpyqDFK6rQV1SzcQ== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:21 +0200 Message-Id: <32208cadd25e165c3f0c7cc4a571789a4c98a36a.1523494984.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.30]); Thu, 12 Apr 2018 01:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 12 Apr 2018 01:04:14 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 3/9] libxl: warn about ignored CPU mode=custom 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.26]); Thu, 12 Apr 2018 01:04:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 When support for mode=3Dcustom will be added in the future, semantics of current config will change. Reduce the surprise by emitting a warning. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v5: - new patch, instead of "libxl: error out on not supported CPU mode, instead of silently ignoring" --- src/libxl/libxl_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 2565f64..2053ed3 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -424,6 +424,12 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_defbool_set(&b_info->u.hvm.nested_hvm, hasHwVirt); } =20 + if (def->cpu && def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM) { + VIR_WARN("Ignoring CPU with mode=3Dcustom, update your config = to " + "mode=3Dhost-passthrough to avoid risk of changed gue= st " + "semantics when mode=3Dcustom is supported in the fut= ure"); + } + if (def->nsounds > 0) { /* * Use first sound device. man xl.cfg(5) describes soundhw as --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 16:05:08 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 1523781292383321.7751315575249; Sun, 15 Apr 2018 01:34:52 -0700 (PDT) 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 22A7E4E4C3; Sun, 15 Apr 2018 08:34:51 +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 D520517D67; Sun, 15 Apr 2018 08:34:50 +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 92839180596E; Sun, 15 Apr 2018 08:34:50 +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 w3C14MoX018670 for ; Wed, 11 Apr 2018 21:04:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 822A75D6A6; Thu, 12 Apr 2018 01:04:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C6C45D6A5 for ; Thu, 12 Apr 2018 01:04:22 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E2F03136300 for ; Thu, 12 Apr 2018 01:04:15 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 90845217D5; Wed, 11 Apr 2018 21:04:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:14 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id F0E0D10260; Wed, 11 Apr 2018 21:04:13 -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=TsdwWT/nrWJa0mWJQ6TK+ExJ/frwNc/dXAxJdkMeg Zc=; b=X16pB7FAXQvInlUyqaGmIhpyU8Vz77nNp9m+HwHWnr20swbBmZlBx+8ns yfIwSPWd5qsBjLWuafcl4k9ot5Us74LYypfN2YIG0xgzUe+1UKkbdGYy7nIKmlyl +Mj+OmYjXjRq2Gb6nd46evngmqiCTbTrBoQ91JOQcyQ5IjSk1FFeWTtmf5WFhYiI i+HnrE2+H6u1vUIn6JDVXDoRBjogMEJj4F+avmdSOOuC/Wp4n0ML4p0IodVBd17s vwEyrOUwzwaDp0D6hC6Nw38ZhoEU1nrQMkeLqXXKV4DgwI3lgJ76jy55feeTThPJ rYkRc7yzF06PH9l7QafFvvPDkwPeA== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:22 +0200 Message-Id: <8f6473bc3ee5e4020b56ea25fb7705a10f9747c2.1523494984.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.45]); Thu, 12 Apr 2018 01:04:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 12 Apr 2018 01:04:15 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 4/9] 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: , 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]); Sun, 15 Apr 2018 08:34:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 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. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Jim Fehlig --- Changes since v6: - really allow per-domain override - fix default value in tests Changes since v4: - add nested_hvm option to test_libvirtd_libxl.aug.in and libvirtd_libxl.a= ug - make it possible to override nested_hvm=3D0 with explicit - split xenconfig changes into separate commits 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/libvirtd_libxl.aug | 2 ++ src/libxl/libxl.conf | 8 ++++++++ src/libxl/libxl_conf.c | 12 +++++++++++- src/libxl/libxl_conf.h | 2 ++ src/libxl/test_libvirtd_libxl.aug.in | 1 + tests/libxlxml2domconfigtest.c | 3 +++ 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/libxl/libvirtd_libxl.aug b/src/libxl/libvirtd_libxl.aug index b31cc07..58b9af3 100644 --- a/src/libxl/libvirtd_libxl.aug +++ b/src/libxl/libvirtd_libxl.aug @@ -28,12 +28,14 @@ module Libvirtd_libxl =3D let lock_entry =3D str_entry "lock_manager" let keepalive_interval_entry =3D int_entry "keepalive_interval" let keepalive_count_entry =3D int_entry "keepalive_count" + let nested_hvm_entry =3D bool_entry "nested_hvm" =20 (* Each entry in the config is one of the following ... *) let entry =3D autoballoon_entry | lock_entry | keepalive_interval_entry | keepalive_count_entry + | nested_hvm_entry =20 let comment =3D [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \= t\n][^\n]*)?/ . del /\n/ "\n" ] let empty =3D [ label "#empty" . eol ] diff --git a/src/libxl/libxl.conf b/src/libxl/libxl.conf index 264af7c..72825a7 100644 --- a/src/libxl/libxl.conf +++ b/src/libxl/libxl.conf @@ -41,3 +41,11 @@ # #keepalive_interval =3D 5 #keepalive_count =3D 5 + +# Nested HVM default control. In order to use nested HVM feature, this opt= ion +# needs to be enabled, in addition to specifying +# in domain configuration. This can be overridden in domain configuration = by +# explicitly setting inside +# element. +# By default it is disabled. +#nested_hvm =3D 0 diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 2053ed3..9ea3759 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -395,10 +395,12 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, bool hasHwVirt =3D false; bool svm =3D false, vmx =3D false; =20 + /* enable nested HVM only if global nested_hvm option enable i= t and + * host support it*/ 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"); - hasHwVirt =3D vmx | svm; + hasHwVirt =3D cfg->nested_hvm && (vmx | svm); } =20 if (def->cpu->nfeatures) { @@ -415,6 +417,11 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, =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"))) + hasHwVirt =3D true; + break; + case VIR_CPU_FEATURE_OPTIONAL: case VIR_CPU_FEATURE_LAST: break; @@ -1758,6 +1765,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 633ebf5..61f586f 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/libxl/test_libvirtd_libxl.aug.in b/src/libxl/test_libvirtd= _libxl.aug.in index 63558e5..372a43f 100644 --- a/src/libxl/test_libvirtd_libxl.aug.in +++ b/src/libxl/test_libvirtd_libxl.aug.in @@ -6,3 +6,4 @@ module Test_libvirtd_libxl =3D { "lock_manager" =3D "lockd" } { "keepalive_interval" =3D "5" } { "keepalive_count" =3D "5" } +{ "nested_hvm" =3D "0" } diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 9d280e9..2210d58 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -76,6 +76,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 Fri Apr 26 16:05:08 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 1523495089331137.73522708654866; Wed, 11 Apr 2018 18:04:49 -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 A3C4D18EC6F; Thu, 12 Apr 2018 01:04:47 +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 782C65D6A6; Thu, 12 Apr 2018 01:04:47 +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 41E2D4CAA8; Thu, 12 Apr 2018 01:04:47 +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 w3C14KbE018653 for ; Wed, 11 Apr 2018 21:04:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CADB5D6A5; Thu, 12 Apr 2018 01:04:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 751E66E705 for ; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B543D3130D82 for ; Thu, 12 Apr 2018 01:04:15 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 3E0F720937; Wed, 11 Apr 2018 21:04:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:15 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 9BDCE10263; Wed, 11 Apr 2018 21:04:14 -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=+PEv8gaQlUStJlYQIn7z7J53OvLP00AjAjAysc+c8 po=; b=NvnCQZO38krquufJeD/H3sH1dEUVROgcJWW0FHwdgFIWqpfqCbgu7Vone J8lmbBFTqrt8WDjb9okoMfMFiakFMnq/ORgWRYx62mA6G384XYL7QZTo/cxkmCBR Awe7ZqrXg83WKGEUY52FiOA+jxSlnWxTkEI7InsonyFVLMs8tC3D4j0tT23PSxRG igifVOv+xdeTtBB5jOAaLug4nEiFShW/MCCRRzTP+dlhwhvfaYb1RbMTSoQ5uwon ShmbJ5seM7f3mcDRp3bVEXHAbOYOsvzdCKK9ut07dLTMIbkMvpfDurU3+bTVOLM8 SwwouX977lif25Zt0obyUY01Hf1cg== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:23 +0200 Message-Id: <34be99b08ef5d8937fa2c7d9e6becbb1f7065b76.1523494984.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.43]); Thu, 12 Apr 2018 01:04:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 12 Apr 2018 01:04:15 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 5/9] xenconfig: do not override def->cpu if already set elsewhere 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.38]); Thu, 12 Apr 2018 01:04:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 This will help with adding cpuid support. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v4: - patch separated from "libxl: do not enable nested HVM unless global nested_hvm option enabled" --- src/xenconfig/xen_xl.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index e1ec8e7..ea5cacb 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) --=20 git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 16:05:08 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 1523495085190325.2938176323004; Wed, 11 Apr 2018 18:04:45 -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 8EE1A30BC116; Thu, 12 Apr 2018 01:04:43 +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 60FB86E70D; Thu, 12 Apr 2018 01:04:43 +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 2ADE04CAA4; Thu, 12 Apr 2018 01:04:43 +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 w3C14K8v018647 for ; Wed, 11 Apr 2018 21:04:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 24C747C25E; Thu, 12 Apr 2018 01:04:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CFCF65921 for ; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6008E85A05 for ; Thu, 12 Apr 2018 01:04:16 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id DDB0521813; Wed, 11 Apr 2018 21:04:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:15 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 4AB7610261; Wed, 11 Apr 2018 21:04:15 -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=Nw6XE6MFMDn/yb84hY9WhDg4ialsH7+JjFFWyHPjJ FY=; b=UI2yq7l0HtoKW+phyD2nijVw2tPIF8fvfnHr9NYwuok56fMBmzV6tU51N THSdoDNr3/PerUy5Ar1Gc76q2DaJN79fmoDkz6bQP/NFBDjoQMSiKG1Ht7jT64Ra m8g/RaAMUyW/Sa1qc+tBIbpF0bKr8jEEWXhGV+IV7oB8LRfFOJ0pTONbM275GCot +hr6Y0kjjNIVdICWLykFJG9DKxqKaqIQb6xtC8/CiC0eFy0JqS+Imjg/ovVLjWtw b6iSr7QXG3fqxA5dFgKRJLko9euqTmbTFWJfyqtlpkuSvCDOqwMNrmvXZuwj5B7L rxp4jqcP04GOq20lzZMgsaQZflCGA== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:24 +0200 Message-Id: <67e71fef4c071a4c8471bee5d36b945610024636.1523494984.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.26]); Thu, 12 Apr 2018 01:04:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 12 Apr 2018 01:04:16 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 6/9] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 12 Apr 2018 01:04:44 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v4: - added spec-ctrl/ibrsb 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 | 36 +++++++++++++++++++++++++++++++++--- src/xenconfig/xen_xl.c | 35 +++++++++++++++++++++++++++++++++++ src/xenconfig/xen_xl.h | 2 ++ 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 9ea3759..e98fe52 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 @@ -394,6 +395,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, def->cpu && def->cpu->mode =3D=3D (VIR_CPU_MODE_HOST_PASSTHROU= GH)) { bool hasHwVirt =3D false; bool svm =3D false, vmx =3D false; + char xlCPU[32]; =20 /* enable nested HVM only if global nested_hvm option enable i= t and * host support it*/ @@ -411,17 +413,45 @@ 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"))) + (svm && STREQ(def->cpu->features[i].name, = "svm"))) { hasHwVirt =3D true; + 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 ea5cacb..f60ee08 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -218,6 +218,41 @@ 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" }, + { "spec-ctrl", "ibrsb" }, + }; + 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 Fri Apr 26 16:05:08 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 1523781281217795.5798778314388; Sun, 15 Apr 2018 01:34:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A371C0587E6; Sun, 15 Apr 2018 08:34:39 +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 B2A4917A97; Sun, 15 Apr 2018 08:34:38 +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 A243E1805972; Sun, 15 Apr 2018 08:34:37 +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 w3C14JCM018628 for ; Wed, 11 Apr 2018 21:04:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 40A2EA0996; Thu, 12 Apr 2018 01:04:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37EA167E40 for ; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FB773130658 for ; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 8CDEF217D9; Wed, 11 Apr 2018 21:04:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:16 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id EAB351025A; Wed, 11 Apr 2018 21:04:15 -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=1c7+WKnu9F5b/28+WoSxNHghQJ4qCeohAbwI+TJGG Ns=; b=FmjAFYBxjBUfQUPnRJSrkQczW9Xl1N0X6hkFPFBbqhBNgZNNZwYtW/ejP /ywp58R/4RNFz7Q7lxp5HKZAq9QACbcIlhvqR6cIqqZ7XLQC7zWt6WBgBVdrtTLX rSEVQDWc5eIIcyuXhXddfz+/tUsCKLe+DKytjagdrT8ZNHSWDG/twfBLi2wecXUV YzSp5bqY8eGxdfh5tMdwNBjgx+QfmC3GS7utEDRGNMkUamZpIaMGni0QNj6vFTEz 7OLQ6sXoIHDY7790MxuV91gpwvjYY521yZ5eKP/8k6YA9gqrK8jTxWy+63y5LT+A wLetigXRnbLajl3PN+l92Qm2gRB1g== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:25 +0200 Message-Id: <41f14c51372f528164c85b23f5339a6166dac07f.1523494984.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.47]); Thu, 12 Apr 2018 01:04:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 12 Apr 2018 01:04:17 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 7/9] 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.32]); Sun, 15 Apr 2018 08:34:40 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v6: - remove VGA, to make test works on both Xen < 4.8 and >=3D 4.8. - rebase on master 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 | 60 +++++++++++++++++- tests/libxlxml2domconfigdata/fullvirt-cpuid.xml | 34 ++++++++++- tests/libxlxml2domconfigtest.c | 1 +- 3 files changed, 95 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..cdc8b98 --- /dev/null +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json @@ -0,0 +1,60 @@ +{ + "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, + "shadow_memkb": 5656, + "cpuid": [ + { + "leaf": 1, + "ecx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0", + "edx": "xxxxxxxxxxxxxxxxxxxxxxxxxxx1xxxx" + } + ], + "sched_params": { + }, + "type.hvm": { + "pae": "True", + "apic": "True", + "acpi": "True", + "nested_hvm": "False", + "nographic": "True", + "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..4f06db0 --- /dev/null +++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.xml @@ -0,0 +1,34 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + + hvm + + + + + + + + + + + + + destroy + restart + restart + + + + + +
+ + + + + diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 2210d58..d9287b5 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -209,6 +209,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 Fri Apr 26 16:05:08 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 1523495093897968.0808982555575; Wed, 11 Apr 2018 18:04:53 -0700 (PDT) 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 14B8330BC11F; Thu, 12 Apr 2018 01:04: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 D0F6278DB6; Thu, 12 Apr 2018 01:04:50 +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 917B04CAAA; Thu, 12 Apr 2018 01:04:50 +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 w3C14K1R018654 for ; Wed, 11 Apr 2018 21:04:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F86F5D6A6; Thu, 12 Apr 2018 01:04:20 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 750BD6E6F8 for ; Thu, 12 Apr 2018 01:04:18 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA16730BC11F for ; Thu, 12 Apr 2018 01:04:17 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 42A362188E; Wed, 11 Apr 2018 21:04:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:17 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 9937E10262; Wed, 11 Apr 2018 21:04:16 -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=zl30OmW22e3priwdb0R0ujrrgQyOyCr+ilHSIK67C IU=; b=FNGqsqYFauuFo4WuqpNY+RAF7YITxM2KgK3iCJvoTGZCQopzwvFFtOCoC Fjson8hO4aTH2ZVs6QHpV0pVE1HzYjFuGVMs7xKzXZ5yJaRT+yjPLldVuziieJvo UcTuUY9nxuoDzonsowT1grfGNEcDhQ7rPy7QAA6PfbDjJd0I41bP9OaWdprG8RHB Mldmm5gaOcMtQ4RqEarMrjwj6VecC7qNWkMYUil9cBI8wNn4a2cr5cBFCfIv3NEs YpcPnaznUHUOnULLi9ycb0GT5tenfTSS6aWilH8rkgqG1YRDMfmHn5ykSSQTuOAd vRKjNbDgIfEg64gUuBMr1JPcpyTQw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:26 +0200 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.42]); Thu, 12 Apr 2018 01:04:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 12 Apr 2018 01:04:17 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 8/9] 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 12 Apr 2018 01:04:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Only "libxl" format supported for now. Special care needed around vmx/svm, because those two are translated into "nestedhvm" setting. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v5: - adjust for ignoring mode=3Dcustom instead of rejecting it 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 | 164 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 164 insertions(+) diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index f60ee08..6dcaba9 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -253,6 +253,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,79 @@ 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) { + VIR_WARN("ignoring CPU mode '%s', only host-passthrough mode " + "is supported", virCPUModeTypeToString(def->cpu->mode)); + return 0; + } + + /* "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, @@ -2001,6 +2162,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 Fri Apr 26 16:05:08 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 1523495067525277.9529342696786; Wed, 11 Apr 2018 18:04:27 -0700 (PDT) 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 7B13385359; Thu, 12 Apr 2018 01:04: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 558EEBABE; Thu, 12 Apr 2018 01:04: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 2A4864CA9E; Thu, 12 Apr 2018 01:04:21 +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 w3C14JpI018631 for ; Wed, 11 Apr 2018 21:04:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E29AA09A2; Thu, 12 Apr 2018 01:04:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5793567E40 for ; Thu, 12 Apr 2018 01:04:19 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70ECF7B126 for ; Thu, 12 Apr 2018 01:04:18 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id DF31120937; Wed, 11 Apr 2018 21:04:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 11 Apr 2018 21:04:17 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 44ED110260; Wed, 11 Apr 2018 21:04:17 -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=1pQ5h0ARbdg/VVb9YCOCQJhcq8XYTL9Y9yzv3VI/i 8g=; b=QmbBhTNqyqcfhIUF+dOgxhffuuaiCSND1PW58o1aq4xEIgUweAdMRqdkq 01JxUb9CsVpAV0JokJCuRlXgaz0p3WqCvM0orRT89Y5fMTzNs8dI3IryI7Rwi9yJ 1Khn7HO3NaWbXvuKt630wWiROOaU+ZfpBJoNkBp3d+m+9UIzhVMOOzyGQ1RsnBiQ hiUXQT/rqXGsugf560QYWrdfnGUfRQ5EEFKv8tyVmmDC21AOZM5Ss3FCqSOU/ZzY syh58J3s9yPkBfilgKPp0z51oIVj02SqJwVzEneT9fuAl/uJJBMzr8rpQxC4Ai9D hEpIzAPgb9umyK75TF1KIjkT316uQ== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 03:03:27 +0200 Message-Id: <1935b3ddbe4457024c1e0114de2b2409d90cf3de.1523494984.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.26]); Thu, 12 Apr 2018 01:04:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 12 Apr 2018 01:04:18 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v7 9/9] 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 12 Apr 2018 01:04:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 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. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jim Fehlig Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes since v6: - rebase on master 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 | 36 +++++++++++++++++++++++- tests/xlconfigtest.c | 1 +- 3 files changed, 62 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..0979b10 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-cpuid.xml @@ -0,0 +1,36 @@ + + 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