From patchwork Sat Jan 26 00:31:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2048671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EA576DF23E for ; Sat, 26 Jan 2013 00:35:08 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tytgq-0007nD-56; Sat, 26 Jan 2013 00:32:12 +0000 Received: from mail-vc0-f177.google.com ([209.85.220.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tytgl-0007mj-Jk for linux-arm-kernel@lists.infradead.org; Sat, 26 Jan 2013 00:32:09 +0000 Received: by mail-vc0-f177.google.com with SMTP id m18so714555vcm.8 for ; Fri, 25 Jan 2013 16:32:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=aFHYG8jSjH2TUYq0JQCed8qcu66MGOebcxlva48DArM=; b=bW28GHufXRUTokHZ6XBCsFWAaLcsyfkPKzRDUJ53+p5NRy2FwOPWwKpJGShQEEAlBh oldggT/rEfVcKfMq6WNVP5h3/09d51vAg2GmssQxgebYTr/oxwloSLcCX91Tg8zPmHFm 4utLN17vCVu5UvjAy/r2fKRyj2XBK85cQy3WQNspZwCZFomG/ly1ozq4GPZdj4j7kTR1 MzIdCGYnrsgatD0ls+rsQlpdRnN+lF7KldyT7nzQLj2W4wblmpNsVw7rLQB4eG56HkvV a4RQZjrzzP3wUszf5IZrp/KnGiKe1s2i1Cg7hHi0ij6WF1Lb+pSOohg7a+vxZORa3kQV Y7Pw== X-Received: by 10.52.177.103 with SMTP id cp7mr7066732vdc.113.1359160325097; Fri, 25 Jan 2013 16:32:05 -0800 (PST) Received: from localhost.localdomain (pool-72-80-83-148.nycmny.fios.verizon.net. [72.80.83.148]) by mx.google.com with ESMTPS id di16sm1476046vdb.11.2013.01.25.16.32.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Jan 2013 16:32:03 -0800 (PST) From: Christoffer Dall To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Subject: [RFC PATCH] ARM: mm: Fix alloc_init_section bug on LPAE Date: Fri, 25 Jan 2013 19:31:58 -0500 Message-Id: <1359160318-27068-1-git-send-email-chris@cloudcar.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkeJZuLlNmJgj8o42O2da3/bkBmAuwFQbU7mYslAoT/fGRjSCNsQeMjqipxqrEBD1Fu2b6N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130125_193207_727587_2580B222 X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tony Lindgren , Christoffer Dall , "Jeremy C. Andrus" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When using LPAE the call to alloc_init_pte is passed then end address for the entire 1st level page table region, and the code unluckily ends up going over the bounds of the single allocated PTE, which is sad. This caused LPAE boot on omap5 to crash. There may be some hidden mystery in the boot code that I'm unaware of or it may be assumed that all mappings are always mappable as sections on LPAE and therefore omap5 just does something bad, in which case this patch isn't the right fix, but I'd be happy to be told the reason. Cc: Tony Lindgren Cc: Jeremy C. Andrus Signed-off-by: Christoffer Dall --- arch/arm/mm/mmu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index ce328c7..1cecc99 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -603,11 +603,13 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr, flush_pmd_entry(p); } else { - /* - * No need to loop; pte's aren't interested in the - * individual L1 entries. - */ - alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type); + unsigned long next; + + do { + next = pmd_addr_end(addr, end); + alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys), type); + phys += next - addr; + } while (pmd++, addr = next, addr != end); } }