From patchwork Mon Aug 14 14:23:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 110017 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4281842obb; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) X-Received: by 10.107.15.16 with SMTP id x16mr19478907ioi.288.1502720791368; Mon, 14 Aug 2017 07:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502720791; cv=none; d=google.com; s=arc-20160816; b=CJDVsUZmvPRLmKG1P0sHVqY3cu9345a65alwnJyJ9xbNxosbuggVTfCtUKrClcB8kn ZMOgs3FE0ZfkwPBPTtscTBoH/Z+vtcxWbPaKfe8+PbQUJzD3ssNxPgyx7HxBBVe6rpK7 +SZTJEURmvHWz8bDarYHK+lQVjeoXGJRnLmyK3+hZD1QlDmoj+k6ESqj4BRcDaltYkK0 kOQTfdjeEL1asPXr/rQBoyxGW03KPz8pOamv5RaPMVL0rQr7dBGnBCzEm/ioyTpqVioV leX0W1gtE2/EIleUKGpVDCS+wG7S3Ja3BWpB0UtKzuX9BLNCdvEVFmaiUPG7oXiYChIV 2F8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=o/Ne1l+/oLhNUNCkKD1NShx4bcw/KDYCfD5s0n9bzxw=; b=PVWjc5lSOlFYxWxRPVmdSQETMk+9mcVteSbe4cESBairFE7PMvP9zTMgkJMDYl2IVP uB5g3Dh+0K3k01oISPSsk9wYmWd5VO/SIg7UB/H3vnYTRKfftgyYdwTPX2+PdiCWhNzX xpbFhBYR+BIBGKiESBMHkr08UP1qK5JCPi01fDKM2GIWH4Sk7Etm5rwlYXvebTGOf9Pq pS02D2vcl29z4NFOcCOBB9WVXH4wRrgzguW3DNSUXFRWjDENa3JJbhgEeGJwpHeBl/L4 t6gER8jGhGYIKCYXDBQyvtZE6uvY0TJF3EvI8YXH5zA2CndtdTZr+6lvWtu95ovbI0vp w/vg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 129si6941025iou.316.2017.08.14.07.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2017 07:26:31 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGII-0000DE-1r; Mon, 14 Aug 2017 14:24:38 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhGIG-0000Bk-I5 for xen-devel@lists.xen.org; Mon, 14 Aug 2017 14:24:36 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id A8/88-02181-3A2B1995; Mon, 14 Aug 2017 14:24:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTXfxpom RBjtW81gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkf+zuZC05wVZw4fYetgXE+RxcjF4eQwGZG iaOX/zJCOKcZJVpWfmHrYuTkYBPQlLjz+RMTiC0iIC1x7fNlsCJmgeWMEhv2r2AHSQgLuEus/ PyCFcRmEVCVePfyAQuIzStgKXH73z2wQRIC8hK72i6C1XAKWEl03t0JViMEVHNi9Wy2CYzcCx gZVjFqFKcWlaUW6Roa6yUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBPqYAQh2MG7 b7nmIUZKDSUmUN8GnN1KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG/qxomRQoJFqempFWmZOcBg g0lLcPAoifDOAknzFhck5hZnpkOkTjHqcrya8P8bkxBLXn5eqpQ4bzlIkQBIUUZpHtwIWOBfY pSVEuZlBDpKiKcgtSg3swRV/hWjOAejkjDvkQ1AU3gy80rgNr0COoIJ6Ig+kPt5i0sSEVJSDY zHP/2RNbh71lfgEvcEhi1uHR3eH34Y/OY6aJJlbf2w8blX/re84CTDXGOPm4xPCp2+1t2eeaX m8O95r79qqWxcxcR4ZbJULfOf+9q+Me/nLl/Xz5z9Nmxeje80zolbtu/69vZj/qVFpQ83ztry QtzwsOblC/2cUW4HnwqpVSoK8et4T3TQDa9VYinOSDTUYi4qTgQAuVrgJncCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1502720674!105894450!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42837 invoked from network); 14 Aug 2017 14:24:35 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-31.messagelabs.com with SMTP; 14 Aug 2017 14:24:35 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C6F0165C; Mon, 14 Aug 2017 07:24:34 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39A713F483; Mon, 14 Aug 2017 07:24:33 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 15:23:54 +0100 Message-Id: <20170814142418.13267-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814142418.13267-1-julien.grall@arm.com> References: <20170814142418.13267-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 03/27] xen/x86: mm: Don't check alloc_boot_pages return X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The only way alloc_boot_pages will return 0 is during the error case. Although, Xen will panic in the error path. So the check in the caller is pointless. Looking at the loop, my understanding is it will try to allocate in smaller chunk if a bigger chunk fail. Given that alloc_boot_pages can never check, the loop seems unecessary. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Reviewed-by: Andre Przywara --- Cc: Jan Beulich Cc: Andrew Cooper I haven't tested this code, only build test it. I can't see how alloc_boot_pages would return 0 other than the error path. --- xen/arch/x86/mm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index f53ca43554..66e337109d 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -200,11 +200,7 @@ static void __init init_frametable_chunk(void *start, void *end) */ while ( step && s + (step << PAGE_SHIFT) > e + (4 << PAGE_SHIFT) ) step >>= PAGETABLE_ORDER; - do { - mfn = alloc_boot_pages(step, step); - } while ( !mfn && (step >>= PAGETABLE_ORDER) ); - if ( !mfn ) - panic("Not enough memory for frame table"); + mfn = alloc_boot_pages(step, step); map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR); }