From nobody Mon Apr 29 18:59:09 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 15216499704681021.614640966327; Wed, 21 Mar 2018 09:32:50 -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 0C79FC057FAD; Wed, 21 Mar 2018 16:32:49 +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 889A18CA23; Wed, 21 Mar 2018 16:32: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 CC461180613A; Wed, 21 Mar 2018 16:32:47 +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 w2LGWkJa018618 for ; Wed, 21 Mar 2018 12:32:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE0908273A; Wed, 21 Mar 2018 16:32:46 +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 B5AB182710 for ; Wed, 21 Mar 2018 16:32:43 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F65B550CC for ; Wed, 21 Mar 2018 16:32:42 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C4BE82113A; Wed, 21 Mar 2018 12:32:41 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:41 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 24DF124211; Wed, 21 Mar 2018 12:32:41 -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=592fAUWxBtJvtbyaqgo7STAcKi162IuMZLkom7Ias do=; b=PVCEKiECS00ku1IJRqR8LaRNlPlHiiQPikMea4Cwa3YFlBI9zXqkLnZcL yCNsp8YEXVxuuy2zDZZvytvOa0H3tSXdHSOGYsXzEMBww9E4uoBUKHoYplXvp6JP qfg0C7VQ9TEbvfXg0vHkz9T/qBC4iwVUN56LsYcYusPDfgdijg3CwANV239ODU+9 ajujzdlJHrY3uWqWw3KgFA4WHwdMbr2jsB6+Z7rupWgv+lTVFkVq/hX4DHpXXnWz Lkc1BRCFs10KFbkf+BJIoFrtop18/Upl2haq33vto/buJZtlcDDXic1s9GU7vfMe i4sqnNntC2SknLOGPLfcSPa6C/yLg== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:25 +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.29]); Wed, 21 Mar 2018 16:32:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Mar 2018 16:32:42 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.32]); Wed, 21 Mar 2018 16:32:49 +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 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 18:59:09 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 1521649975558402.6924067292466; Wed, 21 Mar 2018 09:32:55 -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 1FF2880E7B; Wed, 21 Mar 2018 16:32:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB9508CA2C; Wed, 21 Mar 2018 16:32:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9CD14181BA02; Wed, 21 Mar 2018 16:32:53 +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 w2LGWoMu018641 for ; Wed, 21 Mar 2018 12:32:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06BC25DD84; Wed, 21 Mar 2018 16:32:50 +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 EBA693780 for ; Wed, 21 Mar 2018 16:32:44 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0202413AAE for ; Wed, 21 Mar 2018 16:32:43 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 7A0A320BB1; Wed, 21 Mar 2018 12:32:42 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:42 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id CFE8424217; Wed, 21 Mar 2018 12:32:41 -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=+GtaaXL1Q4kOZXQfQakl8Ex6nfQoA3Og8Xj6uO+Ke ls=; b=J3o/uDFRW8i8vFd3UInFuNT//yxhMljGLvVyfTG+tmeNWMLxsxvBr0991 RRCglirh/EHvu4XxYw5KR4E34vZRVixE2T3D7CYLYs6LYnRcpHoRIyEzIhTglkep eu2i/yFGJeK2zrxu+r54adBxNWxCr7WColUcURsIcSxp3BGqerDnUqz56AZic0gM BXx9x6DUFaaRjh7Jk5+0s5LmUL8xMYV99xWue9BSIHm0G6RwMWthCcBUrGK8xa+g j0nsKlzt77BiFS8gTotThaGH0mmcDXuYqN6kedbm6W9+VwbRYHidrQwx6ZXIBuz6 WqL19hi42n1gPdKppKVHesEK5JdRw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:26 +0100 Message-Id: <15ab9ce758fa968eafef432577aefb73e9d287d4.1521649909.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.29]); Wed, 21 Mar 2018 16:32:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Mar 2018 16:32:43 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 21 Mar 2018 16:32:54 +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 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 | 25 +++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 2d2a707..e7727a1 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; @@ -2287,17 +2288,17 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver= , virNodeInfoPtr info) int libxlBuildDomainConfig(virPortAllocatorPtr 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 @@ -2329,7 +2330,7 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicspo= rts, #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 264df11..ce9db26 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -215,9 +215,7 @@ libxlCreateXMLConf(void); int libxlBuildDomainConfig(virPortAllocatorPtr 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 395c8a9..8879481 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, &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..cfbc37c 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,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 virPortAllocatorNew("vnc", 5900, 6000, @@ -85,22 +93,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; @@ -118,10 +126,11 @@ 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); + cfg->caps =3D NULL; + 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 18:59:09 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 1521649976243351.06879577852703; Wed, 21 Mar 2018 09:32:56 -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 9A70F7FEA9; Wed, 21 Mar 2018 16:32:54 +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 6F2425DD84; Wed, 21 Mar 2018 16:32:54 +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 365F84CA9C; Wed, 21 Mar 2018 16:32:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2LGWn72018636 for ; Wed, 21 Mar 2018 12:32:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id E599F813E6; Wed, 21 Mar 2018 16:32:49 +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 DBFD4813E3 for ; Wed, 21 Mar 2018 16:32:45 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEAD3356E9 for ; Wed, 21 Mar 2018 16:32:43 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 293B8212F4; Wed, 21 Mar 2018 12:32:43 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:43 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 89466241A9; Wed, 21 Mar 2018 12:32:42 -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=U5lXggdkZDptqg0ePHprtNLCZ97r7NMpaywCJj8ss 2k=; b=hWO2KEytO1uLg2Wa+y+JAbuqUbZfbU6bT39kyd5sAPb/An/76akaH3FlP uIwyXZ824PBGFMTp4GRLymvExHk3bMCQX9PpNMBrwX8AhVFyy8Y5cpYaSHwnzL3P iwGKBTJSJ6LZVqGM4/t8s6Hrv2HaVf5fVGzR2l3Pj6xAi0qOotAeGUcBo7fslEui dEZQ0ehyUQJVRh7DE2gRZVVDqjdnCvs/KJpMrxoyFPNDd/Ib+uOV5DTz7DbFjQRU rX8PyEZvoasRfRVs87QvLeBO8cww6y5hv4lQYfVidbw5dPChgpOKdYNUwEMOYfx7 yFn+pIwf+tVq44KzWO/g9483JpCFw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:27 +0100 Message-Id: <871949e5c2f7bdebfce055636b8d249eba0c4b51.1521649909.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]); Wed, 21 Mar 2018 16:32:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 21 Mar 2018 16:32:43 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 21 Mar 2018 16:32:55 +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 e7727a1..dcfdd67 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -389,6 +389,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 Mon Apr 29 18:59:09 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 1521649983069317.57431926798324; Wed, 21 Mar 2018 09:33:03 -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 BA81F7FEA1; Wed, 21 Mar 2018 16:33:01 +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 91F138CA28; Wed, 21 Mar 2018 16:33:01 +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 52441181B9FF; Wed, 21 Mar 2018 16:33:01 +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 w2LGWshe018693 for ; Wed, 21 Mar 2018 12:32:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEA7584748; Wed, 21 Mar 2018 16:32: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 A7EA584742 for ; Wed, 21 Mar 2018 16:32:52 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98CAEC036771 for ; Wed, 21 Mar 2018 16:32:44 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EDF8E21174; Wed, 21 Mar 2018 12:32:43 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:43 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 4379A24251; Wed, 21 Mar 2018 12:32:43 -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=jEg/P2Dz0hiGixebQcuvjvK1xi915bYRUJXGvRwdO pk=; b=ic4/4PrQU6KLSX5kZIT7OKpWzdZWetMuF2hQDCE4DnSgAHmdyJvCqbPwd lbDcQOk6X3OXA3Qu7JZ9WaR2926l1EkRhWOdG/lBtxDPz32uDry3RPfZDReuNzfW Dp8N1UU6MmfEdijvTw5j4ysXXTh8eWLufPGUa2wp5BXhvfSN5b4gbyqVONm2TSYm W+HKj+sS/TTAg6zWqZkRG5cl9qewUkOJFr7wYjb7zjuU5yqwZQR+06Sr31mNo5pq 6v3WbDyegOluOqpwm+JsYZzI6jJ0G1m5u1p1NXwmGuUz8yfZ8/paqLcK3k4HJVMM w0iInJvDiz0EXKWiJHdgic6YVtFHA== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:28 +0100 Message-Id: <18212a10a62c3b5fdf6a56b1a419be16c7b9045f.1521649909.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.31]); Wed, 21 Mar 2018 16:32:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 21 Mar 2018 16:32:44 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-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 v6 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 21 Mar 2018 16:33:02 +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 --- 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 dcfdd67..3b9e828 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -360,7 +360,9 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, bool hasHwVirt =3D false; bool svm =3D false, vmx =3D false; =20 - if (ARCH_IS_X86(def->os.arch)) { + /* enable nested HVM only if global nested_hvm option enable i= t and + * host support 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; @@ -380,6 +382,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; @@ -1699,6 +1706,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 ce9db26..27cfc1a 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..9106abe 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 "1" } diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index cfbc37c..8819032 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 Mon Apr 29 18:59:09 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 152164997288176.49608594486631; Wed, 21 Mar 2018 09:32:52 -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 7DB1728209; Wed, 21 Mar 2018 16:32: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 4BB2C8CA21; Wed, 21 Mar 2018 16:32: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 190284CA9B; Wed, 21 Mar 2018 16:32:51 +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 w2LGWnro018631 for ; Wed, 21 Mar 2018 12:32:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8658A8CA28; Wed, 21 Mar 2018 16:32:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F4E18CA2F for ; Wed, 21 Mar 2018 16:32:46 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29E13804E3 for ; Wed, 21 Mar 2018 16:32:45 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A0A9B20A62; Wed, 21 Mar 2018 12:32:44 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:44 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 00D3E241A9; Wed, 21 Mar 2018 12:32:43 -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=G9l5ugQvr/P75CtvM7ziwlDRq62nMBHM+1V5ehjMw K4=; b=D1LEhdjhnTcUKA4uVsUYUBrU2l5SojBHOkMV4MykUMmcsitH+v9MpZijZ Az3VdNxf0zeH09G4M84fxNJYE4q9ejF6QQQG24F13TXJ/eDY52sf3VbY2O6shRVO Db9nbQv6IG66oFR/vEtcZ71USELa6xb5pbeQGUj5XsJoKZSGUNmYfNbWZksaBSiY N0TgMWmUlQYNQLFJcqj6IEyFtTaOFAepYiReBJzrxRba3OOpkI5A1HQYQvxjpmx4 irjLXN5j+D2KePuvvzb/RT/+u97ZiUhLYQDjA6XDQamkqUVrbaWmkb/S4cVBv5l/ RLafQ9imBBtX+VeCmK6rBYH0fQB4g== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:29 +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.27]); Wed, 21 Mar 2018 16:32:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 21 Mar 2018 16:32:45 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.30]); Wed, 21 Mar 2018 16:32:52 +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 2ef80eb..93eba51 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 Mon Apr 29 18:59:09 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 1521649989514960.0159767370062; Wed, 21 Mar 2018 09:33:09 -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 340FBC058EA8; Wed, 21 Mar 2018 16:33:08 +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 04EB0611A2; Wed, 21 Mar 2018 16:33:08 +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 B7E204CAA0; Wed, 21 Mar 2018 16:33:07 +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 w2LGWsXZ018692 for ; Wed, 21 Mar 2018 12:32:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id AD9C384747; Wed, 21 Mar 2018 16:32:54 +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 A710C84751 for ; Wed, 21 Mar 2018 16:32:49 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B89053A9E3 for ; Wed, 21 Mar 2018 16:32:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 70CE621447; Wed, 21 Mar 2018 12:32:45 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:45 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id C342824251; Wed, 21 Mar 2018 12:32:44 -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=QQmcHJu+vATE7CHoYMk75lXi/bVtLrVBIpyGr1lks jg=; b=J0Cx94RexOD7sQyDNDov1MZj/YaDRkbm5KzvuP3B0+hhxX9a3utU7cpIi YLkEutbkaK/vMd1KiVCOe3PrGQJUx8I/c7wHXwfwYsqfPGaCrv1WhCXD0YngeGAz ei89rrGJpsXpFgLlU3tfED2OixN/4XkQ4jsvitGT4rca4lOCVF4lBOPycKKprBEa WSAk05VpZHw41xKjy3TOSuIeLG69DQOYxlG6aIbYW9S2uu7Mn9w5iQxAGU9sJvjq zBV41Ez8cc9b4U6CRFksS0fo460qV5PDWXVGrGZ+wK5s9phxZUb63UJhy0eDUCV5 N2gvawTHFISP9udy3XoakMmWIQJJw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:30 +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]); Wed, 21 Mar 2018 16:32:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 21 Mar 2018 16:32:48 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 21 Mar 2018 16:33:08 +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 3b9e828..235b982 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 @@ -359,6 +360,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*/ @@ -376,17 +378,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 93eba51..94d91cd 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 Mon Apr 29 18:59:09 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 15216499765971003.9466282483378; Wed, 21 Mar 2018 09:32:56 -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 5E427C0587E3; Wed, 21 Mar 2018 16:32:55 +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 2739B5D9C9; Wed, 21 Mar 2018 16:32:55 +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 D9B2C180BAD7; Wed, 21 Mar 2018 16:32:54 +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 w2LGWo3W018650 for ; Wed, 21 Mar 2018 12:32:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FDB74143; Wed, 21 Mar 2018 16:32:50 +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 695CF5DD84 for ; Wed, 21 Mar 2018 16:32:50 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8B4A46267 for ; Wed, 21 Mar 2018 16:32:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 4E5AD212DF; Wed, 21 Mar 2018 12:32:46 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:46 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 7E2C1241A9; Wed, 21 Mar 2018 12:32:45 -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=Y0YRMerxRts8o7Y/m5sFhktiN/y9pqyFD5IagJOuU 4Y=; b=RIN6KCjmjcmnrxb7mGM+OgQWkSO2cmyMN+tD+bc7Moetx44DbkMxOFaIu srNaDuhzo8SgT+8yYmJ2i/G98Ha8JsFvBG5E+gGPIZzDn2whPs19NCxNA4tQHKkg 1h2KYglxnMxXAmfxM501s6m+plVPKVLU3QNKuj8QfpPK6Z12pnoVp62H5wgaq6ZG XGea0BdYZXPPwe1FWAlVNcQBLVFtUquTJf4EMNlyp6FRLsGJ3XNM2dBhMforxMK7 9qgEaz9k3XRtCTCezFkObTVtfmJ5rTJ9U8uhvsaRdDDCEvJ8p22zPwoOPdhgnDfv obj5wPFS7TtPRKigGCIWL0MKufqcw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:31 +0100 Message-Id: <5540c63c44fa06b2d71da5f54b119a5a255e8d94.1521649909.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.29]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 21 Mar 2018 16:32:55 +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 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 8819032..10e1bb2 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -203,6 +203,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 18:59:09 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 1521649985754910.6204534162385; Wed, 21 Mar 2018 09:33:05 -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 779E280469; Wed, 21 Mar 2018 16:33:04 +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 443F4813E7; Wed, 21 Mar 2018 16:33:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CB7F5181BA03; Wed, 21 Mar 2018 16:33:03 +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 w2LGWqjo018675 for ; Wed, 21 Mar 2018 12:32:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5D9AE6CE80; Wed, 21 Mar 2018 16:32:52 +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 540038CA27 for ; Wed, 21 Mar 2018 16:32:52 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07E5612EB for ; Wed, 21 Mar 2018 16:32:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id DE9B420BB1; Wed, 21 Mar 2018 12:32:46 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:46 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 3C49F24281; Wed, 21 Mar 2018 12:32:46 -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=PX5XV89QeCFZ2gV2Sm4mZp/sOYSMxnVxkzzjQZZU+ ls=; b=bQ6z7X4qUWJge/2IwZWa/r4wtTjFWw9iMBoxLTHFS7BotqLrFgZHmADpY Zxq2AGZwTXZe0IDg1n+LzhRP9BZxLZSDLnFF+GdkAc/CcSQkR0aWFvoqaNyoZiXp Ar758w6wAOgx59IsDoYdJeoC2WjgZcyveZVF/j0M71lQ4hR2F4pX5L4D7RGQM6jD Q2YBKMx1fZFbEtSOzQcBYJ/+45ybDh0DRXJ1Ha1fXkdxpa5XtAr71qIqNa6h9kKq Nj7hoOYA0jD/pOAMLXcgfJUTGXlyA/XgY+o2qsh4jivbXY1T8VIh3ZCQ1hYtLT+/ fH2KgOSgjKxNOeISzZKUKmLjD4d6g== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:32 +0100 Message-Id: <667699a6b4544cbfb81df5594c9ef4d6d29dbe23.1521649909.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]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v6 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.28]); Wed, 21 Mar 2018 16:33:04 +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 94d91cd..52ec7e4 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, @@ -1996,6 +2157,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 18:59:09 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 1521649978935559.0725114366076; Wed, 21 Mar 2018 09:32:58 -0700 (PDT) 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 9D71A38D5FD; Wed, 21 Mar 2018 16:32:57 +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 74B3B84751; Wed, 21 Mar 2018 16:32:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3A4694CA9E; Wed, 21 Mar 2018 16:32:57 +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 w2LGWoER018655 for ; Wed, 21 Mar 2018 12:32:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id CE0F58CA23; Wed, 21 Mar 2018 16:32:50 +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 C14148CA34 for ; Wed, 21 Mar 2018 16:32:50 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC67046279 for ; Wed, 21 Mar 2018 16:32:48 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9CB8D21477; Wed, 21 Mar 2018 12:32:47 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Wed, 21 Mar 2018 12:32:47 -0400 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id EC1CD24285; Wed, 21 Mar 2018 12:32:46 -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=pw4JZem0dGNiPm1Ghv0t3eOHbKaa6kY1xoEC4EFIs 1I=; b=PJgy0YuISkn1wojss6grTD0fnZHTcLq0xhgn7Vc/8DqEC9VQU+z0Cmf3m xn4bEoD8ZibNzsc42Z79KZmn70l0GtBf47iIR82mJsO5buoH3n+Bbsh2AppRZfJh A4TeUa6dcgkqIm8ID/Or0xUn18h2z6BbdduUTqaaMCB7C3hUAbae/nWm6z+oW0LK aylsXJktqybkvsmF3oVrDbQw/0+S8nXQT0ICfNqhC9saJnlCuSQQTzw/+9de0oxh 9J1kyXGrHsmCGikj72+cVyysyphwRBmfkRbd09zWvODooSWBc7NAeiqUWEbpqCZq Kykh+9gKnqjlEfJbrQOnzQCHr+30Q== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 21 Mar 2018 17:32:33 +0100 Message-Id: <18a9ab32de53d0dc5a656906c4bce1bf9a626951.1521649909.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.29]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 21 Mar 2018 16:32:49 +0000 (UTC) for IP:'66.111.4.29' DOMAIN:'out5-smtp.messagingengine.com' HELO:'out5-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.29 out5-smtp.messagingengine.com 66.111.4.29 out5-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 v6 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 21 Mar 2018 16:32:58 +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 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