From patchwork Fri Feb 6 16:14:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 5793061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5B74BF440 for ; Fri, 6 Feb 2015 16:17:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F5DF20138 for ; Fri, 6 Feb 2015 16:17:29 +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 E6F3D200E8 for ; Fri, 6 Feb 2015 16:17:27 +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 1YJlYo-0004Ud-F4; Fri, 06 Feb 2015 16:15:14 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YJlYk-0003Im-AM for linux-arm-kernel@lists.infradead.org; Fri, 06 Feb 2015 16:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=U01INxtZTvjG9yY+VyPG0Q/q7pleifqszL/12zBKzcA=; b=VeGWIRTRBTKv2yLzX0hytK07olT3z+PqyA18YI+QtHKuA6H9+mhCXKHtG12EBA4wPW/e/32PlNE7vGN9nZQXpB9F3nsfyujhUkP9xlypYqRxjYTAJy0mxoSekeya8TUSuNxtlDcLo81JW73Wyif7bqpqrBuBmPB1zJz4LhVhNEQ=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:55098) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1YJlYB-0006Sf-LR; Fri, 06 Feb 2015 16:14:35 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1YJlY5-0007dK-AQ; Fri, 06 Feb 2015 16:14:29 +0000 Date: Fri, 6 Feb 2015 16:14:28 +0000 From: Russell King - ARM Linux To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Subject: Re: Continuing kallsyms failures - large kernels, XIP kernels, and large XIP kernels Message-ID: <20150206161428.GZ8656@n2100.arm.linux.org.uk> References: <20150130145642.GK26493@n2100.arm.linux.org.uk> <20150130153414.GM26493@n2100.arm.linux.org.uk> <20150131002253.GR26493@n2100.arm.linux.org.uk> <20150204000307.GA8656@n2100.arm.linux.org.uk> <20150204094414.GC8656@n2100.arm.linux.org.uk> <20150205084323.GS10842@pengutronix.de> <20150206142033.GB10842@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150206142033.GB10842@pengutronix.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150206_081511_171448_43D8D292 X-CRM114-Status: GOOD ( 21.15 ) X-Spam-Score: -0.1 (/) Cc: Arnd Bergmann , Nicolas Pitre , Ming Lei , Rusty Russell , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Feb 06, 2015 at 03:20:33PM +0100, Uwe Kleine-König wrote: > Hello Russell, > > On Thu, Feb 05, 2015 at 09:43:23AM +0100, Uwe Kleine-König wrote: > > An unmodified 3.19.0-rc6 + efm32_defconfig boots just fine with XIP (and > > has to little RAM for holding the kernel image in it's 4 MiB RAM). > And btw next fails to build because of your patch > 51f36035999ca403d08304176bdfa288a549b50e. Maybe you can limit it to MMU > configs only to prevent false positives? I'm intending to drop that patch; I think it's far too difficult to try and modify vmlinux.lds to be able to detect these kinds of overflows, which is a real shame. I have been experimenting with MEMORY {} over the last few days, but getting that right is proving to be rather problematical - had all the LMA adjustments for the kernel already used it, that might have been a way forward (and it certainly does give us protection against any section getting too large) but as we don't, it's just too big a patch with too high a chance of breaking stuff. Part of the problem is that the linker script is already soo damn obfuscated because of all the NoMMU vs XIP vs MMU variants that we support through #ifdef hell - and don't even suggest that we can pull other preprocessor tricks to sort that - it's the fact that stuff is conditional that's the problem - that makes it much harder to verify any change, and ensure that the resulting layout is _actually_ correct and isn't going to break in some corner case. Yet again, our complexity gets the better of us, and makes stuff effectively unmaintainable. So I guess we're just going to have to put up with a kallsyms failure indicating that something isn't right. This is what I ended up with so far: diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 9351f7fbdfb1..85a26ed9bf36 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -54,6 +54,43 @@ jiffies = jiffies_64; jiffies = jiffies_64 + 4; #endif +#ifndef CONFIG_MMU +MEMORY +{ + FLASH (RXA) : ORIGIN = CONFIG_FLASH_MEM_BASE, LENGTH = CONFIG_FLASH_SIZE + RAM (!RX) : ORIGIN = CONFIG_DRAM_BASE, LENGTH = CONFIG_DRAM_SIZE +} +#define REGION_RO_VMA >FLASH +#define REGION_RW_VMA >RAM +#elif defined(CONFIG_XIP_KERNEL) +MEMORY +{ + XIP_VMA_RO (RX) : ORIGIN = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) LENGTH = 16M + XIP_VMA_RW (W) : ORIGIN = (PAGE_OFFSET + TEXT_OFFSET) LENGTH = 16M + XIP_VMA_VEC (RX) : ORIGIN = 0 LENGTH = 4K + XIP_VMA_STUB (RX) : ORIGIN = 4K LENGTH = 4K + + XIP_LMA_RO (RX) : ORIGIN = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) LENGTH = 32M +} +#define REGION_VEC_VMA >XIP_VMA_VEC +#define REGION_STUB_VMA >XIP_VMA_STUB +#define REGION_RO_VMA >XIP_VMA_RO +#define REGION_RO_LMA AT>XIP_LMA_RO +#define REGION_RW_VMA >XIP_VMA_RW +#else +MEMORY +{ + VMA (ra) : ORIGIN = (PAGE_OFFSET + TEXT_OFFSET) LENGTH = 1024M + VMA_VEC : ORIGIN = 0 LENGTH = 4K + VMA_STUB : ORIGIN = 4K LENGTH = 4K +} +#define REGION_VEC_VMA >VMA_VEC +#define REGION_STUB_VMA >VMA_STUB +#define REGION_RO_VMA >VMA +#define REGION_RO_LMA AT>VMA +#define REGION_RW_VMA >VMA +#endif + SECTIONS { /* @@ -92,7 +129,7 @@ SECTIONS .head.text : { _text = .; HEAD_TEXT - } + } REGION_RO_VMA REGION_RO_LMA #ifdef CONFIG_ARM_KERNMEM_PERMS . = ALIGN(1<= __data_loc), "Text section oversize") +/*ASSERT((_data >= __data_loc), "Text section oversize") */ #endif