From patchwork Mon Oct 20 20:48:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 5107811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB7599F374 for ; Mon, 20 Oct 2014 20:52:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6D6E20179 for ; Mon, 20 Oct 2014 20:52:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 858C620176 for ; Mon, 20 Oct 2014 20:52:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XgJtG-0004kD-NQ; Mon, 20 Oct 2014 20:49:18 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XgJtC-0004iZ-NC for linux-arm-kernel@lists.infradead.org; Mon, 20 Oct 2014 20:49:15 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 636CD13F8BE; Mon, 20 Oct 2014 20:48:53 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 544EB13F8FA; Mon, 20 Oct 2014 20:48:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from [10.42.111.116] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: lauraa@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B7C6313F8BE; Mon, 20 Oct 2014 20:48:52 +0000 (UTC) Message-ID: <54457534.5050607@codeaurora.org> Date: Mon, 20 Oct 2014 13:48:52 -0700 From: Laura Abbott User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Grygorii Strashko , Russell King - ARM Linux Subject: Re: ARM: issue with memory reservation from DT References: <543EAC5A.6050209@ti.com> <20141015175025.GJ27405@n2100.arm.linux.org.uk> <54400123.7040806@ti.com> <5440DD02.9020103@codeaurora.org> <5440EDC6.70300@ti.com> <544149CF.5080809@codeaurora.org> In-Reply-To: <544149CF.5080809@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141020_134914_850265_907D2D45 X-CRM114-Status: GOOD ( 21.56 ) X-Spam-Score: -1.4 (-) Cc: Grant Likely , Rob Herring , "Karicheri, Muralidharan" , linux-arm , ssantosh@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 10/17/2014 9:54 AM, Laura Abbott wrote: > On 10/17/2014 3:21 AM, Grygorii Strashko wrote: >> Hi Laura, >> >> As I mentioned in first e-mail I've 1G Mem node initially: >> reg = <0x8 0x00000000 0x0 0x40000000>; >> >> and have memory reservation of 512M in the upper part of memory: >> reserved-memory { >> reg = <0x8 0x20000000 0x0 0x20000000>; >> >> then in sanity_check_meminfo() initial mem configuration calculated as >> following: >> >> [ 0.000000] ======= memblock_limit=0x000000082f800000 >> arm_lowmem_limit=0x000000082f800000 vmalloc_limit=ef800000 >> high_memory=0x000000082f800000 >> and memblock.current_limit == arm_lowmem_limit=0x000000082f800000 >> >> then in arm_memblock_init()->early_init_fdt_scan_reserved_mem() 512M >> of memory removed >> (not reserved!, because "no-map;" is defined). >> >> After that Kernel will have only 512M of accessible memory >> memory[0x0] [0x00000800000000-0x0000081fffffff] >> >> I've checked of_reserved_mem.c and saw no issues there :( >> > > Yes, I suspect the issue is not with of_reserved_mem.c and instead with > sanity_check_meminfo in mmu.c . I'm still traveling so I'll probably > take a look on Monday unless I find some time sooner. > I was able to reproduce a crash on my device by removing all highmem as well. It looks like the logic assumes that lowmem limit will only ever increase and not need to decrease. This seems like a limitation of running with CONFIG_HIGHMEM on a system which doesn't actually need highmem. This seems to have been the case even before the meminfo removal as well. The following worked for me: I'll turn this into an official patch for review if it fixes your problem as well. Thanks, Laura diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9f98cec..6696016 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1140,6 +1140,9 @@ void __init sanity_check_meminfo(void) } } + if (arm_lowmem_limit > memblock_end_of_DRAM()) + arm_lowmem_limit = memblock_end_of_DRAM(); + high_memory = __va(arm_lowmem_limit - 1) + 1; /*