From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202299; cv=none; d=zoho.com; s=zohoarc; b=hXF3r/JJr4C0Kk29c7ArxOz9bL3XaG7fagdmmGaCMj8MD93nUuhJt+drTHGpr2An8OkKyXig8YaHe0qHVL/udS0clnUPjLLugp8XhqMJoV6OIoDU0P3ZAsX7SHWVlQWTEHxULc4HFdTHZ1l+SVBTSc6kc2eA9dllMiZ8wi3K2CQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202299; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KQ3eYURmh+hRJIWMlLC7v4qWlVn9IqRshWCtz/z/HpQ=; b=FjPIVNImp8rGVyr3uk1FZbXDnUk/IzYMgOBG1deX0CGU0DndzWWHBBfSUmflPPsrTyWROT/mj40SWoeP2LEHsDQoUTRk6gKuPAd5zeBRQPHF1Tfzk+6BkvvqDUAfTVf/47rF451G7V3ivgpeE4ipCCaghETJ/f82iSWictXmacQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570202299833583.3088856044386; Fri, 4 Oct 2019 08:18:19 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKW-0001PO-Qs; Fri, 04 Oct 2019 15:17:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKU-0001P9-VR for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:15 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0b1329ea-e6ba-11e9-975c-12813bfff9fa; Fri, 04 Oct 2019 15:17:14 +0000 (UTC) X-Inumbo-ID: 0b1329ea-e6ba-11e9-975c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=HHjvVa0hXjDUJXHOkFJUifA2m5S0BM39eHlsW+65hwM=; b=MsFR4N5X7XywAtFt32KnrDv50eghJQfaxL2bBx4RGgw+4h/ARJK8f/GV HpCfpRrELop7/Kk85015+Mtab5ZVT1MHNbwpoAftaItJDG0Q4qz6iKBXs AiLVG0Qn5nyjbYiehFwptO1rhhG8zOeA8WPCffEHHCE5+GSbGsyuP4XSo c=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: UEQo/Gwz4NDYcIsDhZrkYoVTIgIAVvwenJrkIeuXp8470ohZabAgWTWzGGC81ocAlBUtfdhJp3 Osj4zhX/RfrWasuH5BW9SmOxnuM3i+LUCFqrRWUtgkQsr93HehW2ZMG4inX9ov4DV0aHPKazNP 3+g2yCymMtZjUYJBKEv3X3Xsh1y0PMA2vOYjj29p5hkEqnBrYz5ulz8gcQCAroj6siyFb1hnX+ 9sMzaQ4lFo3k0BI2PV4BjC3k87H3EwPuivaSDGU4tzgdBzYASbjE1O9SCnbb+Uy9wzYbWkRSmQ 6HU= X-SBRS: 2.7 X-MesageID: 6779127 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6779127" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:02 +0100 Message-ID: <20191004151707.24844-2-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 1/6] libxl: Offer API versions 0x040700 and 0x040800 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) According to git log -G: 0x040700 was introduced in 304400459ef0 (aka 4.7.0-rc1~481) "tools/libxl: rename remus device to checkpoint device" 0x040800 was introduced in 57f8b13c7240 (aka 4.8.0-rc1~437) "libxl: memory size in kb requires 64 bit variable" It is surprising that no-one noticed this. I wonder if anyone is using our LIBXL_API_VERSION facility. If not maybe we should take a different approach. Anyway, in the meantime, we should fix this. Backporting this is probably a good idea: it won't change the behaviour for existing callers but it will avoid errors for some older correct uses. Signed-off-by: Ian Jackson Acked-by: Anthony PERARD --- tools/libxl/libxl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 2555e9cd3b..518fc9e47f 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -655,6 +655,7 @@ typedef struct libxl__ctx libxl_ctx; #ifdef LIBXL_API_VERSION #if LIBXL_API_VERSION !=3D 0x040200 && LIBXL_API_VERSION !=3D 0x040300 && \ LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 && \ + LIBXL_API_VERSION !=3D 0x040700 && LIBXL_API_VERSION !=3D 0x040800 && \ LIBXL_API_VERSION !=3D 0x041300 #error Unknown LIBXL_API_VERSION #endif --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202301; cv=none; d=zoho.com; s=zohoarc; b=a2dOcu7595UJ/MKsRzdJ1H4AUgGY30L3fJWZFgA4TDc8KE/y7Ml+eWKTGqmTs+wF7ejjI1pzQUv9naOuY+rvivdn4l+geg3dPKaSu/C8lLF1z9MeGAz+ijgv3kd52wSKJBs/+iZjZ0HwSvsuVZ3jC7gIHfqxW7/DShO6wTfQZIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202301; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HjiuZgLL2y2Z3y5o+n03Vs9CkPEh6g6yCKW5T84xhqE=; b=nx8ITCTMg4n8o1igeCZmt5/JO7MU/jhIVdCGXwHW143+EhwHFcSy5RxopucgeiTcCHWsrIa8RgSXhllpYTdM0KwLXp5yZJXNUbXEgAHtjod6wdne8dtAaLmVyWrFsQP93b92EyqSODaMS37MjGEQ77KzaojIR0WHC1lJWmmgMy4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 15702023011231003.8282085957677; Fri, 4 Oct 2019 08:18:21 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKg-0001SS-BB; Fri, 04 Oct 2019 15:17:26 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKe-0001Rd-Vo for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:25 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0b1329eb-e6ba-11e9-975c-12813bfff9fa; Fri, 04 Oct 2019 15:17:14 +0000 (UTC) X-Inumbo-ID: 0b1329eb-e6ba-11e9-975c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=HRB5b7geXl0cLryQ01TGg4wgRxl1O1KItPxzaHTS6Ls=; b=Qo7PykfTjyDVM6mEX0oK0BS+hvhpzcA2Y8IrnLq2Xj6G96upRba96gsn 8LEsg7IFhUHTbQDAT78ojf3jpyEoaFdoxhZCBw8RHkY2hGYkFk3PHdhUm VjjhZACaJWUBkmbUROse3Go5XacCa0jmQl/VEwkxt6PU7I8DfRy4GQwdX E=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 3kOk2xwCB4FGemIvcnINEKaDg8/UWtPMXLOPrHtmuKrTkJygbe5oBiHzK+Q0rM5K+ciyqxjcui nXqcssJTpf3VCWYONox512KX8kNMjo3RQBufcG+AoPCM+OwxQ7oRbI6xvjpJpqyhlo7gEmdhF2 1caUD9cQwBpt73VR8WACgCoISAZRN+pNMy/Lszoxkg4sIT/Iuv6uwe02sdKwwpf0oUgAt5NUAI JHJcVpZ/xxfsoLSh91qN3/pTfPbVd/x+ogRjUsmyEYaXaRCaSgENC0DgD4Bj+uAWKigk6nVsIW gf0= X-SBRS: 2.7 X-MesageID: 6779129 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6779129" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:03 +0100 Message-ID: <20191004151707.24844-3-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 2/6] xl: Pass libxl_domain_config to freemem(), instead of b_info X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We are going to change the libxl API in a moment and this change will make it simpler. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- tools/xl/xl_vmcontrol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index b20582e15b..d33c6b38c9 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -314,7 +314,7 @@ static int domain_wait_event(uint32_t domid, libxl_even= t **event_r) * Returns true in case there is already, or we manage to free it, enough * memory, but also if autoballoon is false. */ -static bool freemem(uint32_t domid, libxl_domain_build_info *b_info) +static bool freemem(uint32_t domid, libxl_domain_config *d_config) { int rc, retries =3D 3; uint64_t need_memkb, free_memkb; @@ -322,7 +322,7 @@ static bool freemem(uint32_t domid, libxl_domain_build_= info *b_info) if (!autoballoon) return true; =20 - rc =3D libxl_domain_need_memory(ctx, b_info, &need_memkb); + rc =3D libxl_domain_need_memory(ctx, &d_config->b_info, &need_memkb); if (rc < 0) return false; =20 @@ -879,7 +879,7 @@ start: goto error_out; =20 if (domid_soft_reset =3D=3D INVALID_DOMID) { - if (!freemem(domid, &d_config.b_info)) { + if (!freemem(domid, &d_config)) { fprintf(stderr, "failed to free memory for the domain\n"); ret =3D ERROR_FAIL; goto error_out; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202297; cv=none; d=zoho.com; s=zohoarc; b=GsgaoRiRT25d2EBAl7J0fOhicYiYcz4B52AWrPmD6/ZimcXQ45JdxHDimjjzpsep+Q4yyVn4TWrTSJrrakrX3H8GU/yvVzK3/nXoOxv48D3iepfmO2Q539nn7y5iSod4lACBmF+0XSploeUEZFiSqOdVq907V7dtnD4FnwpQAMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QCypVWYHGcvvc3ZDQhvsqPjFHFVB3qVRAp8mSpaQfr0=; b=LJGP/Wj05igWCJUIOaTAb/MqqusbZk9Y6IEINFNd61e683ZOWYGwC58GVVkxwaPXrVRxBKaKxtaPBYKB2CCbtzKMP7XETCEnXzxMfMY4ednK6VyyUYsXoNWajd5FXadDwXeWvze3ehiCaTTtZmqeMzeBZCT6StjtlxE6T+am39w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570202297433577.4072231384233; Fri, 4 Oct 2019 08:18:17 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKb-0001Po-4Q; Fri, 04 Oct 2019 15:17:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKZ-0001Pb-QP for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:19 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0bbb1c7c-e6ba-11e9-80e3-bc764e2007e4; Fri, 04 Oct 2019 15:17:14 +0000 (UTC) X-Inumbo-ID: 0bbb1c7c-e6ba-11e9-80e3-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=DUhsCLEf0OcfIFOrzr5l33KzsS/q3Q913x3m3fxnA1k=; b=OGixZ3D18hqiLHA/q+VB44R4md6kzAnvRhVD6ScwxpWcV2qI6RIlj92z 4I0pzOHcyqpGfe+D3GZtOc9G+Oz4LXvJXQc0Zw27DdjUplC+heqnMTPW8 NCH8i6ModoQMX7Tv/YQGiL5pOIeFngifv957w5jY5729RpquaSuBC4YJF 0=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: rdB4IcHyQ7iYJNdlwyI1pIOopXlv2x0lZ6UpKVre0KFgXJh4ijQSv8sZWMto5CfmVmp2W0fTEY 9qRYwHCT0mPhnGN0Qpi0zclaivcgkO5Itc80VmIHDspevppO2ep9BNlsGryeVt3eUoNK5kp8qo 97Q8GP+E5HGXqipWp3nh4NUEjDjyMkJ5C3BBkjc5ZvdATBHtFhCmG2COrqlOyifFavfKSrVbZy 1T8g37Tygj65N+xlSw+skTeqqF2bTV3/X061IE0TfQLlNmeOrFdCUf1QL8TOIonz+hZTJXczVD 9Hw= X-SBRS: 2.7 X-MesageID: 6480726 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6480726" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:04 +0100 Message-ID: <20191004151707.24844-4-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 3/6] libxl: libxl__domain_config_setdefault: New function X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Break out this into a new function. We are going to want to call it from a new call site. Unfortunately not all of the defaults can be moved into the new function without changing the order in which things are done. That does not seem wise at this stage of the release. The effect is that additional calls to libxl__domain_config_setdefault (which are going to be introduced) do not quite set everything. But they will do what is needed. After Xen 4.13 is done, we should move those settings into the right order. No functional change. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- tools/libxl/libxl_create.c | 40 ++++++++++++++++++++++++++++------------ tools/libxl/libxl_internal.h | 3 +++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 099761a2d7..457beb6462 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -862,22 +862,14 @@ static void domcreate_destruction_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, int rc); =20 -static void initiate_domain_create(libxl__egc *egc, - libxl__domain_create_state *dcs) +int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid) { - STATE_AO_GC(dcs->ao); libxl_ctx *ctx =3D libxl__gc_owner(gc); - uint32_t domid; - int i, ret; + int ret; bool pod_enabled =3D false; =20 - /* convenience aliases */ - libxl_domain_config *const d_config =3D dcs->guest_config; - const int restore_fd =3D dcs->restore_fd; - - domid =3D dcs->domid_soft_reset; - libxl__domain_build_state_init(&dcs->build_state); - if (d_config->c_info.ssid_label) { char *s =3D d_config->c_info.ssid_label; ret =3D libxl_flask_context_to_sid(ctx, s, strlen(s), @@ -1008,6 +1000,27 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } =20 + ret =3D 0; + error_out: + return ret; +} + +static void initiate_domain_create(libxl__egc *egc, + libxl__domain_create_state *dcs) +{ + STATE_AO_GC(dcs->ao); + uint32_t domid; + int i, ret; + + /* convenience aliases */ + libxl_domain_config *const d_config =3D dcs->guest_config; + const int restore_fd =3D dcs->restore_fd; + + domid =3D dcs->domid_soft_reset; + libxl__domain_build_state_init(&dcs->build_state); + + libxl__domain_config_setdefault(gc,d_config,domid); + ret =3D libxl__domain_make(gc, d_config, &dcs->build_state, &domid); if (ret) { LOGD(ERROR, domid, "cannot make domain: %d", ret); @@ -1019,6 +1032,9 @@ static void initiate_domain_create(libxl__egc *egc, dcs->guest_domid =3D domid; dcs->sdss.dm.guest_domid =3D 0; /* means we haven't spawned */ =20 + /* post-4.13 todo: move these next bits of defaulting to + * libxl__domain_config_setdefault */ + /* * Set the dm version quite early so that libxl doesn't have to pass t= he * build info around just to know if the domain has a device model or = not. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index d2d5af746b..50ac7b64ed 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1440,6 +1440,9 @@ _hidden int libxl__resolve_domid(libxl__gc *gc, const= char *name, * All libxl API functions are expected to have arranged for this * to be called before using any values within these structures. */ +_hidden int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid /* logging only= */); _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl_domain_create_info *c_info); _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202301; cv=none; d=zoho.com; s=zohoarc; b=mg6CqrZ9/RIW2LcJQGFbt+ilWsHDGpgZ9zoHEyga9eTnpabNTvi8Gadx3paCgAYhPkvER9SFkABoMBNAu+7QeptzXPB3Se9707fVSGh8oz6AtiS4StpBnpWxTNV79DkiJh/SZ061BkcYQ0dvGf8JqX3nKuCKFt0kouhNOaZz8L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202301; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qIcqkDhbMqlR4unv/EpgYn1H6JLyCcbVvURfSLhny1A=; b=io8CWogaL/c3yW/nLwRISqpL6gfPmpzxuE8KjzzkoYQtch89A+RPUZmtE8setFUMcGK0n01se5ALiBgSg1VhqgWo68wFWehf7trHxxHqIPbueuF828GFO1nMP7vp7qQtQ0g3946Z0KcTrk1sGTOn5sou1We26POMKNn7/YECIdE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570202301924488.14183665166206; Fri, 4 Oct 2019 08:18:21 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKf-0001S7-VI; Fri, 04 Oct 2019 15:17:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKe-0001Ra-PW for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:24 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0b78340c-e6ba-11e9-80e3-bc764e2007e4; Fri, 04 Oct 2019 15:17:14 +0000 (UTC) X-Inumbo-ID: 0b78340c-e6ba-11e9-80e3-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=n04XRiSvXziPb9+RtzZ0qoAOizvQ8aZaXdofQ3HMIfk=; b=H0PR3g86cLmnBUCLxUL6cpIQ/of2XnARlmWipEEzNql8fvDBai4Q0IKO J8j9e7G16P2n/lDXm4+L7XxSARyf8EUsZUSio2yBdKp2/WowugB3CFW21 xEasHU9b3Ujg2SOWweJ5+uyH5iJuoUwlZdXsBaVBWtEu8lkjmVW9wNDRg k=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: OwTMRUimaDWCXSlj6yEF2esv4U1nIOZ7zAdHkgR/3/r2RChv5/aMIRB6CkZiCzrMFO3YKg+BMI Gf0eCofiO9eckrnArLcZFnTHHN8PLZ6+Cok6ZCec7TECl7QsgaShN7U1IcRQw/AhkWtmk0rCde NskLY9byyACXFl0r7R8sXemlv6fvGGHpls4Ht+tPjWuy8rgbSG4uHbKY0xUONyRnau99X752aB Zk8cN6WyBsZal7gQvqu0hv33lsm1xIZeaCKpaVXIvS4zv4s8xk+74/8iWGQ1E8w7G9wo5PWXv4 Wgw= X-SBRS: 2.7 X-MesageID: 6552752 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6552752" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:05 +0100 Message-ID: <20191004151707.24844-5-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 4/6] libxl: libxl_domain_need_memory: Make it take a domain_config X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This should calculate the extra memory needed for shadow and iommu, the defaults for which depend on values in c_info. So we need this to have the complete domain config available. And the defaults should actually be updated and stored. So make it non-const. We provide the usual kind of compatibility function for callers expecting 4.12 and earlier. This function becomes responsible for the clone-and-modify of the b_info. No overall functional change for external libxl callers which use the API version system to request a particular API version. Other external libxl callers will need to update their calling code, and will then find that the new version of this function fills in most of the defaults in d_config. Because libxl__domain_config_setdefault doesn't quite do all of the defaults, that's only partial. For present purposes that doesn't matter because none of the missing settings are used by the memory calculations. It does mean we need to document in the API spec that the defaulting is only partial. This lack of functional change is despite the fact that numa_place_domain now no longer calls libxl__domain_build_info_setdefault (via libxl_domain_need_memory). That is OK because it's idempotent and numa_place_domain's one call site is libxl__build_pre which is called from libxl__domain_build which is called from domcreate_bootloader_done, well after the defaults are set by initiate_domain_create. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- tools/libxl/libxl.h | 23 ++++++++++++++- tools/libxl/libxl_dom.c | 7 +++-- tools/libxl/libxl_internal.h | 4 +++ tools/libxl/libxl_mem.c | 66 +++++++++++++++++++++++++++++++++++-----= ---- tools/xl/xl_vmcontrol.c | 2 +- 5 files changed, 84 insertions(+), 18 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 518fc9e47f..49b56fa1a3 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1245,6 +1245,20 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, = const libxl_mac *src); */ #define LIBXL_HAVE_FN_USING_QMP_ASYNC 1 =20 +/* + * LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG + * + * If this is set, libxl_domain_need_memory takes a + * libxl_domain_config* (non-const) and uint32_t domid_for_logging + * (instead of a const libxl_domain_build_info*). + * + * If this is set, there is no need to call + * libxl_get_required_shadow_memory and instead the caller should + * simply leave shadow_memkb set to LIBXL_MEMKB_DEFAULT and allow + * libxl to fill in a suitable default in the usual way. + */ +#define LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG + typedef char **libxl_string_list; void libxl_string_list_dispose(libxl_string_list *sl); int libxl_string_list_length(const libxl_string_list *sl); @@ -1723,8 +1737,13 @@ int libxl_get_memory_target_0x040700(libxl_ctx *ctx,= uint32_t domid, */ /* how much free memory in the system a domain needs to be built */ int libxl_domain_need_memory(libxl_ctx *ctx, - const libxl_domain_build_info *b_info_in, + libxl_domain_config *config + /* ^ will be partially defaulted */, + uint32_t domid_for_logging /* INVALID_DOMID o= k */, uint64_t *need_memkb); +int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, + const libxl_domain_build_info *b_inf= o_in, + uint64_t *need_memkb); int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, const libxl_domain_build_info *b_inf= o_in, uint32_t *need_memkb) @@ -1754,6 +1773,8 @@ int libxl_wait_for_memory_target(libxl_ctx *ctx, uint= 32_t domid, int wait_secs); #define libxl_get_memory_target libxl_get_memory_target_0x040700 #define libxl_domain_need_memory libxl_domain_need_memory_0x040700 #define libxl_get_free_memory libxl_get_free_memory_0x040700 +#elif defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300 +#define libxl_domain_need_memory libxl_domain_need_memory_0x041200 #endif =20 int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c5685b061c..cdb294ab8d 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -140,8 +140,9 @@ static int numa_cmpf(const libxl__numa_candidate *c1, =20 /* The actual automatic NUMA placement routine */ static int numa_place_domain(libxl__gc *gc, uint32_t domid, - libxl_domain_build_info *info) + libxl_domain_config *d_config) { + libxl_domain_build_info *info =3D &d_config->b_info; int found; libxl__numa_candidate candidate; libxl_bitmap cpumap, cpupool_nodemap, *map; @@ -195,7 +196,7 @@ static int numa_place_domain(libxl__gc *gc, uint32_t do= mid, } } =20 - rc =3D libxl_domain_need_memory(CTX, info, &memkb); + rc =3D libxl__domain_need_memory_calculate(gc, info, &memkb); if (rc) goto out; if (libxl_node_bitmap_alloc(CTX, &cpupool_nodemap, 0)) { @@ -432,7 +433,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, if (rc) return rc; =20 - rc =3D numa_place_domain(gc, domid, info); + rc =3D numa_place_domain(gc, domid, d_config); if (rc) { libxl_bitmap_dispose(&cpumap_soft); return rc; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 50ac7b64ed..01de5576d9 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1450,6 +1450,10 @@ _hidden int libxl__domain_build_info_setdefault(libx= l__gc *gc, _hidden void libxl__rdm_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info); =20 +_hidden int libxl__domain_need_memory_calculate(libxl__gc *gc, + libxl_domain_build_info *b_info, + uint64_t *need_memkb); + _hidden const char *libxl__device_nic_devname(libxl__gc *gc, uint32_t domid, uint32_t devid, diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index fd6f33312e..26cf136ac2 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -446,20 +446,12 @@ int libxl_get_memory_target_0x040700( return libxl__memkb_64to32(ctx, rc, my_out_target, out_target); } =20 -int libxl_domain_need_memory(libxl_ctx *ctx, - const libxl_domain_build_info *b_info_in, - uint64_t *need_memkb) +int libxl__domain_need_memory_calculate(libxl__gc *gc, + libxl_domain_build_info *b_info, + uint64_t *need_memkb) { - GC_INIT(ctx); - libxl_domain_build_info b_info[1]; int rc; =20 - libxl_domain_build_info_init(b_info); - libxl_domain_build_info_copy(ctx, b_info, b_info_in); - - rc =3D libxl__domain_build_info_setdefault(gc, b_info); - if (rc) goto out; - *need_memkb =3D b_info->target_memkb; *need_memkb +=3D b_info->shadow_memkb + b_info->iommu_memkb; =20 @@ -482,9 +474,57 @@ int libxl_domain_need_memory(libxl_ctx *ctx, rc =3D 0; out: GC_FREE; - libxl_domain_build_info_dispose(b_info); return rc; +} =20 +int libxl_domain_need_memory(libxl_ctx *ctx, + libxl_domain_config *d_config, + uint32_t domid_for_logging, + uint64_t *need_memkb) +{ + GC_INIT(ctx); + int rc; + + rc =3D libxl__domain_config_setdefault(gc, + d_config, + domid_for_logging); + if (rc) goto out; + + rc =3D libxl__domain_need_memory_calculate(gc, + &d_config->b_info, + need_memkb); + if (rc) goto out; + + rc =3D 0; + out: + GC_FREE; + return rc; +} + +int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, + const libxl_domain_build_info *b_inf= o_in, + uint64_t *need_memkb) +{ + GC_INIT(ctx); + int rc; + + libxl_domain_build_info b_info[1]; + libxl_domain_build_info_init(b_info); + libxl_domain_build_info_copy(ctx, b_info, b_info_in); + + rc =3D libxl__domain_build_info_setdefault(gc, b_info); + if (rc) goto out; + + rc =3D libxl__domain_need_memory_calculate(gc, + b_info, + need_memkb); + if (rc) goto out; + + rc =3D 0; + out: + libxl_domain_build_info_dispose(b_info); + GC_FREE; + return rc; } =20 int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, @@ -494,7 +534,7 @@ int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, uint64_t my_need_memkb; int rc; =20 - rc =3D libxl_domain_need_memory(ctx, b_info_in, &my_need_memkb); + rc =3D libxl_domain_need_memory_0x041200(ctx, b_info_in, &my_need_memk= b); return libxl__memkb_64to32(ctx, rc, my_need_memkb, need_memkb); } =20 diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index d33c6b38c9..e520b1da79 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -322,7 +322,7 @@ static bool freemem(uint32_t domid, libxl_domain_config= *d_config) if (!autoballoon) return true; =20 - rc =3D libxl_domain_need_memory(ctx, &d_config->b_info, &need_memkb); + rc =3D libxl_domain_need_memory(ctx, d_config, domid, &need_memkb); if (rc < 0) return false; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202300; cv=none; d=zoho.com; s=zohoarc; b=WwtcLrHizm5h+hay9SDLSjCZBXXDhy2AT3T74vFGsgNad8xMJjnV5RgCHjdqVjqZBbbNXchSiFwRUvt09JRiCdb+5JOcLb+2exDblkN3DJxpeM1WTLO6lXdrPQje7WhB8OzaLJYpLuR1P5qLfa2aptZbpuVDo3auuPF8lluAJ28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202300; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wyO9BcC8E3vNIBPnV4mbk4/HNlSo/VND5+7CXgJfPvw=; b=EGIPTCyl2Ny22wr57ypp2HJaRs2pMi05MyAaEThGX7w+63jwOzgqaLmXjiCefLfmarfEPGrfv2muHRA8J+3UyuOn5nAu/y/7hd6BC0A4XbK8xQe71/ruh22cDzetpvTTqmudvk4whx24SozjlFu2U3P+aL5XV3SreXr1FGzF4+w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570202300255726.4902043356503; Fri, 4 Oct 2019 08:18:20 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKb-0001QN-Ey; Fri, 04 Oct 2019 15:17:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKZ-0001Pd-RD for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:19 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0ba540d2-e6ba-11e9-975c-12813bfff9fa; Fri, 04 Oct 2019 15:17:15 +0000 (UTC) X-Inumbo-ID: 0ba540d2-e6ba-11e9-975c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ejtxueo//d1vv4O4jSC/uAB6+fKy3X+6YBFUa2DC4tk=; b=BoayMenFok4e/E0kr/NMDq/zuClNQI/vdXnRpFlWc//kEXl68vvjagY7 D+Z+yw4WH0RM8rbeL4P/CQOxlz4kHQGwJxkPD9DZ0IvcmNmCZDxIis+l4 bNubbdsLlMTnKcJGPQpBpLcUWMMlT+0pTof/Ub6f7YQUPzy+uSvaybKWR w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 0Q45YtNN4Xto5qfZ+zEEvdHEYwXNaKSf0tuUj1nWS18miJ4ILP/ZTEslZTHc//NRJEG/FTxKjw Mus4fWMpytgakHdrH1pyM+spBhUFybQWx5vubv+KyJdEnCMRdU1mTHdPCWm+MyX3r1zykoN+SM tJiyaQBB7oagNw+z40nZEmu1hFvbDwPXvldauh116SuHnAtSxCriq27eSSwye1+7wAN8HmQuCl eF5FIugxGV02AyHfT1VdWAAv6zPUKW7zrNEhIPMD+Eo/Q0MFePSY4q99PpPYXuhsnak5vHNByk q50= X-SBRS: 2.7 X-MesageID: 6846604 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6846604" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:06 +0100 Message-ID: <20191004151707.24844-6-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 5/6] libxl: Move shadow_memkb and iommu_memkb defaulting into libxl X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Defaulting is supposed to be done by libxl. So these calculations should be here in libxl. libxl__domain_config_setdefault has all the necessary information including the values of max_memkb and max_vcpus. The overall functional effect depends on the caller: For xl, no change. The code moves from xl to libxl. For callers who set one or both shadow_memkb and iommu_memkb (whether from libxl_get_required_shadow_memory or otherwise) before calling libxl_domain_need_memory (any version): the new code will leave their setting(s) unchanged. For callers who do not call libxl_domain_need_memory at all, and who fail to set one of these memory values: now they are both are properly set. The shadow and iommu memory to be properly accounted for as intended. For callers which call libxl_domain_need_memory and request the current API (4.13) or which track libxl, the default values are also now right and everything works as intended. For callers which call libxl_domain_need_memory, and request an old pre-4.13 libxl API, and which leave one of these memkb settings unset, we take special measures to preserve the old behaviour. This means that they don't get the additional iommu memory and are at risk of the domain running out of memory as a result of f89f555827a6 "remove late (on-demand) construction of IOMMU page tables". But this is no worse than the state just after f89f555827a6, which already broke such callers in that way. This is perhaps justifiable because of the API stability warning next to libxl_domain_need_memory. An alternative would be to drop the special-casing of these callers. That would cause a discrepancy between libxl_domain_need_memory and libxl_domain_create: the former would not include the iommu memory and the latter would. That seems worse, but it's debateable. Signed-off-by: Ian Jackson --- tools/libxl/libxl_create.c | 40 ++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_mem.c | 4 ++++ tools/xl/xl_parse.c | 15 ++------------- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 457beb6462..3c5033b05b 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -250,6 +250,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: if (b_info->shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT) + /* Normally defaulted in libxl__domain_create_info_setdefault = */ b_info->shadow_memkb =3D 0; if (b_info->u.hvm.mmio_hole_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->u.hvm.mmio_hole_memkb =3D 0; @@ -395,6 +396,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (b_info->video_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->video_memkb =3D 0; if (b_info->shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT) + /* Normally defaulted in libxl__domain_create_info_setdefault = */ b_info->shadow_memkb =3D 0; if (b_info->u.pv.slack_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->u.pv.slack_memkb =3D 0; @@ -862,6 +864,30 @@ static void domcreate_destruction_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, int rc); =20 +static _Bool ok_to_default_memkb_in_create(libxl__gc *gc) +{ + /* + * This is a fudge. We are trying to find whether the caller + * calls the old version of libxl_domain_need_memory. If they do + * then, because it only gets the b_info, and because it can't + * update the b_info (because it's const), it will base its + * calculations on defaulting shadow_memkb and iommu_memkb to 0 + * In that case we probably shouldn't default them differently + * during libxl_domain_create. + * + * The result is that the behaviour with old callers is the same + * as in 4.13: no additional memory is allocated for shadow and + * iommu (unless the caller set shadow_memkb, eg from a call to + * libxl_get_required_shadow_memory). + */ + return CTX->libxl_domain_need_memory_0x041200_called && + !CTX->libxl_domain_need_memory_called; + /* + * Treat mixed callers as new callers. Presumably they know what + * they are doing. + */ +} + int libxl__domain_config_setdefault(libxl__gc *gc, libxl_domain_config *d_config, uint32_t domid) @@ -974,6 +1000,20 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 + if (d_config->b_info.shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT + && ok_to_default_memkb_in_create(gc)) + d_config->b_info.shadow_memkb =3D + libxl_get_required_shadow_memory(d_config->b_info.max_memkb, + d_config->b_info.max_vcpus); + + /* No IOMMU reservation is needed if passthrough mode is not 'sync_pt'= */ + if (d_config->b_info.iommu_memkb =3D=3D LIBXL_MEMKB_DEFAULT + && ok_to_default_memkb_in_create(gc)) + d_config->b_info.iommu_memkb =3D + (d_config->c_info.passthrough =3D=3D LIBXL_PASSTHROUGH_SYNC_PT) + ? libxl_get_required_iommu_memory(d_config->b_info.max_memkb) + : 0; + ret =3D libxl__domain_build_info_setdefault(gc, &d_config->b_info); if (ret) { LOGD(ERROR, domid, "Unable to set domain build info defaults"); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 01de5576d9..3e306ad4f6 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -637,6 +637,9 @@ struct libxl__ctx { LIBXL_LIST_ENTRY(libxl_ctx) sigchld_users_entry; =20 libxl_version_info version_info; + + _Bool libxl_domain_need_memory_0x041200_called, + libxl_domain_need_memory_called; }; =20 /* diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index 26cf136ac2..0537846ee2 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -485,6 +485,8 @@ int libxl_domain_need_memory(libxl_ctx *ctx, GC_INIT(ctx); int rc; =20 + ctx->libxl_domain_need_memory_called =3D 1; + rc =3D libxl__domain_config_setdefault(gc, d_config, domid_for_logging); @@ -508,6 +510,8 @@ int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, GC_INIT(ctx); int rc; =20 + ctx->libxl_domain_need_memory_0x041200_called =3D 1; + libxl_domain_build_info b_info[1]; libxl_domain_build_info_init(b_info); libxl_domain_build_info_copy(ctx, b_info, b_info_in); diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 03a2c54dd2..79871c22d0 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1572,19 +1572,8 @@ void parse_config_data(const char *config_source, exit(-ERROR_FAIL); } =20 - /* libxl_get_required_shadow_memory() and - * libxl_get_required_iommu_memory() must be called after final values - * (default or specified) for vcpus and memory are set, because the - * calculations depend on those values. */ - b_info->shadow_memkb =3D !xlu_cfg_get_long(config, "shadow_memory", &l= , 0) - ? l * 1024 - : libxl_get_required_shadow_memory(b_info->max_memkb, - b_info->max_vcpus); - - /* No IOMMU reservation is needed if passthrough mode is not 'sync_pt'= */ - b_info->iommu_memkb =3D (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_= SYNC_PT) - ? libxl_get_required_iommu_memory(b_info->max_memkb) - : 0; + if (!xlu_cfg_get_long(config, "shadow_memory", &l, 0)) + b_info->shadow_memkb =3D l * 1024; =20 xlu_cfg_get_defbool(config, "nomigrate", &b_info->disable_migrate, 0); =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Fri Mar 29 15:30:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570202313; cv=none; d=zoho.com; s=zohoarc; b=P0RYzYT4ur9Y1k4FrjiuTUMOy0ZHxMmvdVG1Z9k4OmCc6FyIRhYe1BE93SjfcPoNfvMtaLr4wZxVTbdXoFYt2t11eVZDo3A35nKTJ3JLJ9PZRsbyGV7ITYqczbCjfhgK1pD2CVhMErapRebG97w/GpunNehzJ4EHSMFw2oKno+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570202313; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zdwQS1T4hNTFsKkvZxkIp0bPK8mX0Np05hRRDw8DQiQ=; b=V3tyGPrNdJ6H86HDjm51AhANLfXAfT6qFUe1je9rliyI4wrcJdp4Mpi/3oLFyPA2OIpMZf9qFmzRFap6sWiPZDmMcXi82moYIJ0zi2i6OK12xNknsvV2qRwV+YUWUeLeRBIvq8jk3jgIGte/L5mHrIDtjA9XB6ZOT9d4X+vAS5I= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570202313646400.7090787187075; Fri, 4 Oct 2019 08:18:33 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKk-0001V7-Mp; Fri, 04 Oct 2019 15:17:30 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iGPKj-0001Ue-RX for xen-devel@lists.xenproject.org; Fri, 04 Oct 2019 15:17:29 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0ba540d3-e6ba-11e9-975c-12813bfff9fa; Fri, 04 Oct 2019 15:17:15 +0000 (UTC) X-Inumbo-ID: 0ba540d3-e6ba-11e9-975c-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570202235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Wloc/ADazxebQ6zdg+jzOuNdy0A5DXAfjbJS/xjy88k=; b=Dzu70L8Bi6sdKupRc8qyEKlzJIb/W7/4YX16VAh3UDTHLKEZtEwrbI+I hqW3Ni2UbTr8dN0gPe1rPK5Q2ufYdiDFwn+sMPhKgoYw+tjH5WAHfbJnj lTsyG9OZqWI/rqiF3Vy93eHpD4/M2JaQ+1ZkQdU9wHZ3IWvVMxuNWPkmE U=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 8NeuyaetzKZCi3x/R0KzBSDdrkXEltJcN7XoAkQOr9jjv8e/SuCaUvKblWoZwuPc7PcKyBy4fy 7nVOQ+D5aTb5LAzk2pn3u8nbLMOjLXAYZ0iV25g4wxbpuEkmBAo6ihB7cVwV4jethUk1f7njMi maUSWjbt0nOddYDp0s3OD2jRnjRt/jl3KBW6yk7khK78kUEQKgNQa9B8bsno7lyl0ysEidGv3F fRIQrKhOVjs1aHO/kxvljXgXWhFqd1pEH69lf5u9jT5IMaOAPfLgWPuum6Mk9tquMre3pn25aY d4w= X-SBRS: 2.7 X-MesageID: 6846605 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,256,1566878400"; d="scan'208";a="6846605" From: Ian Jackson To: Date: Fri, 4 Oct 2019 16:17:07 +0100 Message-ID: <20191004151707.24844-7-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191004151707.24844-1-ian.jackson@eu.citrix.com> References: <20191004151707.24844-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 6/6] libxl: Remove/deprecate libxl_get_required_*_memory from the API X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , =?UTF-8?q?J=C3=BCrgen=20Gro=C3=9F?= , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These are now redundant because shadow_memkb and iommu_memkb are now defaulted automatically by libxl_domain_need_memory and libxl_domain_create etc. Callers should not now call these; instead, they should just let libxl take care of it. libxl_get_required_shadow_memory was introduced in f89f555827a6 "remove late (on-demand) construction of IOMMU page tables" We can freely remove it because it was never in any release. libxl_get_required_shadow_memory has been in libxl approximately forever. It should probably not have survived the creation of libxl_domain_create, but it seems the API awkwardnesses we see in recent commits prevented this. So we have to keep it. It remains functional but we can deprecate it. Hopefully we can get rid of it completely before we find the need to change the calculation to use additional information which its arguments do not currently supply. Signed-off-by: Ian Jackson Acked-by: Anthony PERARD --- tools/libxl/libxl_create.c | 17 ++++++++++++++++- tools/libxl/libxl_utils.c | 15 --------------- tools/libxl/libxl_utils.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 3c5033b05b..653b07646e 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -888,6 +888,21 @@ static _Bool ok_to_default_memkb_in_create(libxl__gc *= gc) */ } =20 +static unsigned long libxl__get_required_iommu_memory(unsigned long maxmem= _kb) +{ + unsigned long iommu_pages =3D 0, mem_pages =3D maxmem_kb / 4; + unsigned int level; + + /* Assume a 4 level page table with 512 entries per level */ + for (level =3D 0; level < 4; level++) + { + mem_pages =3D DIV_ROUNDUP(mem_pages, 512); + iommu_pages +=3D mem_pages; + } + + return iommu_pages * 4; +} + int libxl__domain_config_setdefault(libxl__gc *gc, libxl_domain_config *d_config, uint32_t domid) @@ -1011,7 +1026,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc, && ok_to_default_memkb_in_create(gc)) d_config->b_info.iommu_memkb =3D (d_config->c_info.passthrough =3D=3D LIBXL_PASSTHROUGH_SYNC_PT) - ? libxl_get_required_iommu_memory(d_config->b_info.max_memkb) + ? libxl__get_required_iommu_memory(d_config->b_info.max_memkb) : 0; =20 ret =3D libxl__domain_build_info_setdefault(gc, &d_config->b_info); diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 405733b7e1..f360f5e228 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -48,21 +48,6 @@ unsigned long libxl_get_required_shadow_memory(unsigned = long maxmem_kb, unsigned return 4 * (256 * smp_cpus + 2 * (maxmem_kb / 1024)); } =20 -unsigned long libxl_get_required_iommu_memory(unsigned long maxmem_kb) -{ - unsigned long iommu_pages =3D 0, mem_pages =3D maxmem_kb / 4; - unsigned int level; - - /* Assume a 4 level page table with 512 entries per level */ - for (level =3D 0; level < 4; level++) - { - mem_pages =3D DIV_ROUNDUP(mem_pages, 512); - iommu_pages +=3D mem_pages; - } - - return iommu_pages * 4; -} - char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid) { unsigned int len; diff --git a/tools/libxl/libxl_utils.h b/tools/libxl/libxl_utils.h index 630ccbe28a..46918aea84 100644 --- a/tools/libxl/libxl_utils.h +++ b/tools/libxl/libxl_utils.h @@ -24,7 +24,7 @@ const char *libxl_basename(const char *name); /* returns string from strdup */ =20 unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, un= signed int smp_cpus); -unsigned long libxl_get_required_iommu_memory(unsigned long maxmem_kb); + /* deprecated; see LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG in libxl.h */ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid); int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, uint= 32_t *domid); char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel