From patchwork Tue Feb 4 12:14:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 24095 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F375D20445 for ; Tue, 4 Feb 2014 12:16:17 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id w20sf21354438vbb.11 for ; Tue, 04 Feb 2014 04:16:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:subject:message-id :references:mime-version:in-reply-to:user-agent:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-disposition :content-type:content-transfer-encoding; bh=u8Ql4vlwJnN/KqVs1z2+eQNFWi9/BO2igUVXW0bl5HY=; b=QZtDopfBsYlZ8ghPgH5V+WDpvy80K0BWPx18sRD1OqgHAuyXoEL0cXZPC15Sw27pn+ oywjFPASKMrouSdsWqFFlfhsYy8+Uw+3qCBXWX7AGeD5WC17Twl0SHfcZfwWK4v1Myvh SI0rJpsSAI2so20UjFUeFVALj2COn84IR3oZcKUPsmYH5QrvUha5zdZVvMJveAx1VNXm +F1WS45JcASF/FaIdtvUnz4dLDk4iQvzFFqHsuCdvoh5qMPGSXSfy3XP2fY+aNSofYwg Nant/GJdPf8cWl4eqZv2JIgH7iIsQnaMBTWBVyw6lCivl3ZJy3Hi+WQWqzB5GNl0zZCf 6Ndw== X-Gm-Message-State: ALoCoQnX3iN1pmzgFxoNEUtptBxj7LDe7BE1+mcijF9ZXhsurO71aWo/XFwR7qNHBsyujI01HPWT X-Received: by 10.58.253.33 with SMTP id zx1mr15446566vec.10.1391516176663; Tue, 04 Feb 2014 04:16:16 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.117 with SMTP id 108ls900525qgw.77.gmail; Tue, 04 Feb 2014 04:16:16 -0800 (PST) X-Received: by 10.58.169.7 with SMTP id aa7mr6108450vec.24.1391516176587; Tue, 04 Feb 2014 04:16:16 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id gq1si8048408vec.61.2014.02.04.04.16.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 04:16:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so6083049veb.1 for ; Tue, 04 Feb 2014 04:16:16 -0800 (PST) X-Received: by 10.58.90.1 with SMTP id bs1mr832182veb.29.1391516176503; Tue, 04 Feb 2014 04:16:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp229707vcz; Tue, 4 Feb 2014 04:16:15 -0800 (PST) X-Received: by 10.180.160.206 with SMTP id xm14mr12410181wib.25.1391516175217; Tue, 04 Feb 2014 04:16:15 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id kq4si11754196wjb.0.2014.02.04.04.16.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Feb 2014 04:16:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAev2-0001Ys-PI; Tue, 04 Feb 2014 12:16:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAev0-0006AF-IF; Tue, 04 Feb 2014 12:15:58 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAeux-00069M-D9 for linux-arm-kernel@lists.infradead.org; Tue, 04 Feb 2014 12:15:55 +0000 Received: from arm.com (e102109-lin.cambridge.arm.com [10.1.203.24]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id 7629C13F61A; Tue, 4 Feb 2014 06:15:28 -0600 (CST) Date: Tue, 4 Feb 2014 12:14:52 +0000 From: Catalin Marinas To: Mark Salter Subject: Re: arm64: kernel panic in paging_init() Message-ID: <20140204121452.GI30676@arm.com> References: <1391460649.13327.51.camel@deneb.redhat.com> MIME-Version: 1.0 In-Reply-To: <1391460649.13327.51.camel@deneb.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140204_071555_510647_14798B0F X-CRM114-Status: GOOD ( 21.79 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Will Deacon , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Content-Disposition: inline On Mon, Feb 03, 2014 at 08:50:49PM +0000, Mark Salter wrote: > I'm seeing the following panic in paging init. This is on the foundation > model with a modified dtb memory node which has a non section-aligned > bank: > memory@80000000 { > device_type = "memory"; > reg = <0x00000000 0x80000000 0 0x20000000>, > <0x00000000 0xa0300000 0 0x1fd00000>; > }; > > I only see this with 64k pagesize configured. What happens is the > non section-aligned bank causes alloc_init_pte() to allocate a page > for the new pte from the end of the first bank (the failing address > 0xfffffe001fff0000 [0x9fff0000 phys]). This should be a valid page > since it was mapped during the create_mapping() call for the first > memory bank. A flush_tlb_all() added to the end of create_mapping() > makes the panic go away so I think the problem is something stale > cached before the page with the failing address was mapped. I think it goes like this: head.S maps enough memory to get started but using 64K pages rather than 512M sections with a single pgd entry and several ptes. This never gets to the end of the first block (just up to KERNEL_END). create_mapping() realises it can do a 512M section mapping, overriding the original table pgd entry with a block one. The memblock limit is set correctly PGDIR_SIZE but create_mapping, when it replaces the table pgd with a block one doesn't do any TLB invalidation. So I wouldn't do a TLB invalidation all the time but only when the old pmd was set. Please give the patch below a try, I only compiled it (I'll add some text afterwards): Thanks. diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index f557ebbe7013..f8dc7e8fce6f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -203,10 +203,18 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, do { next = pmd_addr_end(addr, end); /* try section mapping first */ - if (((addr | next | phys) & ~SECTION_MASK) == 0) + if (((addr | next | phys) & ~SECTION_MASK) == 0) { + pmd_t old_pmd =*pmd; set_pmd(pmd, __pmd(phys | prot_sect_kernel)); - else + /* + * Check for previous table entries created during + * boot (__create_page_tables) and flush them. + */ + if (!pmd_none(old_pmd)) + flush_tlb_all(); + } else { alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys)); + } phys += next - addr; } while (pmd++, addr = next, addr != end); }