From patchwork Tue Oct 25 16:40:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Goel, Sameer" X-Patchwork-Id: 9395079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B34E60762 for ; Tue, 25 Oct 2016 16:43:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E11928E41 for ; Tue, 25 Oct 2016 16:43:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61212292C1; Tue, 25 Oct 2016 16:43:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D95428E41 for ; Tue, 25 Oct 2016 16:43:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bz4mC-0004zj-O4; Tue, 25 Oct 2016 16:40:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bz4mB-0004zd-Ed for xen-devel@lists.xensource.com; Tue, 25 Oct 2016 16:40:35 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id AF/53-02110-20B8F085; Tue, 25 Oct 2016 16:40:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVybKJsgi5TN3+ EwfIWFot7U96zOzB6bO/bxR7AGMWamZeUX5HAmrFp1lzWgr3iFS3PT7M3ME4R7mLk5BASKJI4 eXUFUxcjFweLwEsmieVff7KCJCQEoiXWbTjGDmHzSVx88YMJwp7FKLHqfRhE8yEmia9PGDE0s wi4SLR3bwKzGQXiJO6uP8oEYadInJo4DWwom4CGRP+Jw8wgtoiAu8SE5lUsIIOYBdYxSmzsXA fWICwQIHH61CsmiKGqEqeW3GYDsXkFnCVW7dsBdamCxPHt2xgnMAouYGRYxahRnFpUllqka2S gl1SUmZ5RkpuYmaNraGCsl5taXJyYnpqTmFSsl5yfu4kRGHL1DAyMOxibT/gdYpTkYFIS5b1R xR8hxJeUn1KZkVicEV9UmpNafIhRhoNDSYLXowsoJ1iUmp5akZaZAwx+mLQEB4+SCO/yTqA0b 3FBYm5xZjpE6hSjLsexl7fXMgmx5OXnpUqJ894AKRIAKcoozYMbAYvES4yyUsK8jAwMDEI8Ba lFuZklqPKvGMU5GJWEeX+ATOHJzCuB2/QK6AgmoCME43lAjihJREhJNTA6zJ3lk82yTuLz0q0 ZjWaL3nkc8DRJ+3zGWHAGs7Wj9qTsBOtjOjs29X8z7L1RleurzRLwT1Lqbnw/V01E0tlXrz9+ WRjrXCHR0BnIe5P33nw+7pTSVV5tCycEiDtpv2UQXrnspMXnI5Nsb2qs1ztodPJyzb5pL01CV DN6Yo+8emHnWtNjLaHEUpyRaKjFXFScCAAr0WcYvwIAAA== X-Env-Sender: sgoel@codeaurora.org X-Msg-Ref: server-5.tower-31.messagelabs.com!1477413632!64103667!1 X-Originating-IP: [198.145.29.96] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32553 invoked from network); 25 Oct 2016 16:40:33 -0000 Received: from smtp.codeaurora.org (HELO smtp.codeaurora.org) (198.145.29.96) by server-5.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 25 Oct 2016 16:40:33 -0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D54C261B12; Tue, 25 Oct 2016 16:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1477413631; bh=XU8+xdUkKcNiXJmO4hD3gj/q0YjMZUFEoislwxZ2x2o=; h=From:To:Cc:Subject:Date:From; b=ae78RoWL1rAZzG3PG+Lc6YqYye9HJOL/wSK9us+Jyu3jaJZ4rxxQ6xLZYuO5X1bXZ UqEPNzNxNN+iZwesLk8d3Lr4RRwehELEDPZQjGaR7VWLlctKv4prYSNqsDotsgrTAs 3GcDexn6qZsbt4Yc9DxsgvmpgDs+isDnc3Hqp/ak= Received: from sgoel-lnx.qualcomm.com (unknown [129.46.14.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sgoel@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EAE4161AF0; Tue, 25 Oct 2016 16:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1477413631; bh=XU8+xdUkKcNiXJmO4hD3gj/q0YjMZUFEoislwxZ2x2o=; h=From:To:Cc:Subject:Date:From; b=ae78RoWL1rAZzG3PG+Lc6YqYye9HJOL/wSK9us+Jyu3jaJZ4rxxQ6xLZYuO5X1bXZ UqEPNzNxNN+iZwesLk8d3Lr4RRwehELEDPZQjGaR7VWLlctKv4prYSNqsDotsgrTAs 3GcDexn6qZsbt4Yc9DxsgvmpgDs+isDnc3Hqp/ak= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org EAE4161AF0 From: Sameer Goel To: xen-devel , ian.campbell@citrix.com Date: Tue, 25 Oct 2016 10:40:28 -0600 Message-Id: <1477413628-1502-1-git-send-email-sgoel@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 Cc: Sameer Goel , Julien Grall , Stefano Stabellini , shankerd@codeaurora.org Subject: [Xen-devel] [PATCH V2] Revert "xen/arm: do not relocate Xen outside of visible RAM" 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" X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit db92b1ac55cd5e193ae22b0b6f01fb47bc9e5d2f. The restriction on non contiguous memory was resolved by commit 2d02b05c77fc5e7c76bf6f112db84bbaa44fdcb5: "xen: arm: improve handling of system with non-contiguous RAM regions" So, reverting this change,to enable Xen image placement at the end of the useable system RAM. Signed-off-by: Sameer Goel Acked-by: Stefano Stabellini --- The load restriction placed in the above reverted patch resulted in a crash when booting DOM0 on a Qualcomm platform with non contiguous system RAM. (XEN) DOM0: [ 0.000000] bootmem alloc of 64 bytes failed! (XEN) DOM0: [ 0.000000] Kernel panic - not syncing: Out of memory (XEN) DOM0: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.7.0-rc7+ #19 (XEN) DOM0: [ 0.000000] Hardware name: (null) (DT) (XEN) DOM0: [ 0.000000] Call trace: (XEN) DOM0: [ 0.000000] [] dump_backtrace+0x0/0x1e4 (XEN) DOM0: [ 0.000000] [] show_stack+0x24/0x2c (XEN) DOM0: [ 0.000000] [] dump_stack+0x8c/0xb0 (XEN) DOM0: [ 0.000000] [] panic+0x128/0x268 (XEN) DOM0: [ 0.000000] [] __alloc_bootmem_low+0x40/0x4c (XEN) DOM0: [ 0.000000] [] setup_arch+0x2d8/0x560 (XEN) DOM0: [ 0.000000] [] start_kernel+0x60/0x3b4 (XEN) DOM0: [ 0.000000] [] __primary_switched+0x30/0x74 (XEN) DOM0: [ 0.000000] ---[ end Kernel panic - not syncing: Out of memory The root cause for the crash was >4GB difference between the arm grant table (lower address) and the kernel start address. The kernel sees the grant table region as the start of system RAM. Since, the grant table is a reuse of the text region of Xen image this issue would not be seen if Xen is loaded high enough in memory. xen/arch/arm/setup.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 38eb888..1678871 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -392,25 +392,17 @@ static paddr_t __init get_xen_paddr(void) { struct meminfo *mi = &bootinfo.mem; paddr_t min_size; - paddr_t paddr = 0, last_end; + paddr_t paddr = 0; int i; min_size = (_end - _start + (XEN_PADDR_ALIGN-1)) & ~(XEN_PADDR_ALIGN-1); - last_end = mi->bank[0].start; - /* Find the highest bank with enough space. */ for ( i = 0; i < mi->nr_banks; i++ ) { const struct membank *bank = &mi->bank[i]; paddr_t s, e; - /* We can only deal with contiguous memory at the moment */ - if ( last_end != bank->start ) - break; - - last_end = bank->start + bank->size; - if ( bank->size >= min_size ) { e = consider_modules(bank->start, bank->start + bank->size,