From patchwork Thu Jun 12 02:51:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 4339151 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 BDB149F314 for ; Thu, 12 Jun 2014 02:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC84E2028D for ; Thu, 12 Jun 2014 02:54:32 +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 B259B2011E for ; Thu, 12 Jun 2014 02:54:31 +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 1Wuv7M-00081Y-Ck; Thu, 12 Jun 2014 02:51:56 +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 1Wuv7J-00080S-Pl for linux-arm-kernel@lists.infradead.org; Thu, 12 Jun 2014 02:51:54 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id A200E13F2B6; Thu, 12 Jun 2014 02:51:32 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 949AD13EF3A; Thu, 12 Jun 2014 02:51:32 +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=-2.5 required=5.0 tests=BAYES_00,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 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 C81A513F2B6; Thu, 12 Jun 2014 02:51:31 +0000 (UTC) Message-ID: <539915B3.9050904@codeaurora.org> Date: Wed, 11 Jun 2014 19:51:31 -0700 From: Laura Abbott User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Geert Uytterhoeven Subject: Re: BUG: Bad page state in process swapper pfn:00000 References: <539892BD.8020403@codeaurora.org> In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140611_195153_893185_91785CC8 X-CRM114-Status: GOOD ( 21.51 ) X-Spam-Score: -0.7 (/) Cc: Grant Likely , Russell King , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux-sh list 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 6/11/2014 12:19 PM, Geert Uytterhoeven wrote: > Hi Laura, > > On Wed, Jun 11, 2014 at 7:32 PM, Laura Abbott wrote: >> On 6/11/2014 4:40 AM, Geert Uytterhoeven wrote: >>> With current mainline, I get an early crash on r8a7791/koelsch: >>> >>> BUG: Bad page state in process swapper pfn:00000 >>> page:ee20b000 count:0 mapcount:0 mapping:66756200 index:0x65726566 >>> page flags: 0x74656b63(locked|error|lru|active|owner_priv_1|arch_1|private|writeback|head|swapcache >>> |reclaim|mlocked) >>> page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set >>> bad because of flags: >>> page flags: 0x212861(locked|lru|active|private|writeback|swapcache|mlocked) >>> >>> I bisected it to >>> >>> commit 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 >>> Author: Laura Abbott >>> Date: Sun Apr 13 22:54:58 2014 +0100 >>> >>> ARM: 8025/1: Get rid of meminfo > >>> -Truncating RAM at 40000000-bfffffff to -6f7fffff (vmalloc region overlap). >>> +Truncating RAM at 0x00000000-0xc0000000 to -0x6f800000 >> >> I'm guessing this is the issue right there. >> >> memory@40000000 { >> device_type = "memory"; >> reg = <0 0x40000000 0 0x40000000>; >> }; >> >> memory@200000000 { >> device_type = "memory"; >> reg = <2 0x00000000 0 0x40000000>; >> }; >> >> Those are the memory nodes from r8a7791-koelsch.dts. It looks like the memory >> outside 32-bit address range is not being dropped. It was suggested to drop >> early_init_dt_add_memory_arch which called arm_add_memory and just use the >> generic of code directly but the problem is arm_add_memory does additional >> bounds checking. It looks like early_init_dt_add_memory_arch in >> drivers/of/fdt.c checks for overflow on u64 types but not for overflow >> on phys_addr_t (32 bits) which is what memblock_add actually uses. >> >> For a quick test, can you try bringing back early_init_dt_add_memory_arch >> and see if that fixes the problem: >> >> diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c >> index e94a157..ea9ce92 100644 >> --- a/arch/arm/kernel/devtree.c >> +++ b/arch/arm/kernel/devtree.c >> @@ -27,6 +27,10 @@ >> #include >> #include >> >> +void __init early_init_dt_add_memory_arch(u64 base, u64 size) >> +{ >> + arm_add_memory(base, size); >> +} >> >> #ifdef CONFIG_SMP >> extern struct of_cpu_method __cpu_method_of_table[]; > > Thanks, my board boots again after applying this quick hack. > Great! Russell are you okay with taking the above as a fix or would you prefer I fixup drivers/of/fdt.c right now? Thanks, Laura ----8<---- From 14bda557a108ad197e7c5f040f50ca024b45cc17 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Wed, 11 Jun 2014 19:39:29 -0700 Subject: [PATCH] arm: Bring back early_init_dt_add_memory_arch Commit 1c2f87c (ARM: 8025/1: Get rid of meminfo) removed early_init_dt_add_memory_arch in favor of using the common method. The common method does not currently check for memory outside of 32-bit bounds which may lead to memory being incorrectly added to the system. Bring back early_init_dt_add_memory_arch for now until the generic function can be fixed up. Reported-by: Geert Uytterhoeven Signed-off-by: Laura Abbott Tested-by: Geert Uytterhoeven --- arch/arm/kernel/devtree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index e94a157..ea9ce92 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -27,6 +27,10 @@ #include #include +void __init early_init_dt_add_memory_arch(u64 base, u64 size) +{ + arm_add_memory(base, size); +} #ifdef CONFIG_SMP extern struct of_cpu_method __cpu_method_of_table[];