From patchwork Wed Mar 30 15:43:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 64716 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2671678lbc; Wed, 30 Mar 2016 08:49:32 -0700 (PDT) X-Received: by 10.66.139.199 with SMTP id ra7mr14400409pab.74.1459352971111; Wed, 30 Mar 2016 08:49:31 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id t1si7334050pas.16.2016.03.30.08.49.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 08:49:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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 1alILv-0002YP-H8; Wed, 30 Mar 2016 15:48:15 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1alIHW-0005ZN-GJ for linux-arm-kernel@lists.infradead.org; Wed, 30 Mar 2016 15:44:02 +0000 Received: by mail-wm0-x22d.google.com with SMTP id 191so94725687wmq.0 for ; Wed, 30 Mar 2016 08:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XDytqye9yW0LCquA2OMMSdCTr1v64/R2jJBdMb9IrJ0=; b=bo7Gyv67hhk537c2nuH9je/tuCqjQqCC630qTxlqU1a0pNbodTmNT2R/6K6yQ/QwHS cg+2I0RqF1S97KCU6nJ/LYn42bwtylIKX9FSXyJoi4U+oqFiFg5Dp/zoCzb29EJkqlac GZSx7AsZs9W/Ezv8vd1ceRKBQf/IR4yKObfl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XDytqye9yW0LCquA2OMMSdCTr1v64/R2jJBdMb9IrJ0=; b=PIhd7UrKjzE/uP1QgaDDRhdfbYz5oGK7cDunV6MzDjYQxDaktPXo7QWOSJ/eLa2g3G +4kHciv+0nLVj4QFbhCweVpGJrYtxSFp0gfXrzQKaPsGu5PsoKaEbpSZCzDiJOy8vTLq OZmv+/91W8yNRuW5Njhm33+yh+TF5L0OBbB1oxOpGzVbLAd3pyilfP4jAM/iCD18Z98r rXWnKAK6tMhHcMz75H96R55mQHyz84NoN4RVxnhRrIz73mWshtmE4Lv80yMO5T5w5tSg qp5Ys3XurDIvwUPgF943ZK1Hkxf+7bhy/8hNPLWjIZ75gL3Ig8N9SqdqXWtgVJfH0ytZ iTOg== X-Gm-Message-State: AD7BkJJ4GaxNk9yix1A1wiT+KVDd9EnoOnOVYnyKgykc/ZI/8zXhZi+OcWYwC7OTiKm7sbum X-Received: by 10.194.185.108 with SMTP id fb12mr10572749wjc.89.1459352601111; Wed, 30 Mar 2016 08:43:21 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id h7sm20330403wmf.9.2016.03.30.08.43.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 08:43:20 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, jeremy.linton@arm.com Subject: [PATCH v2 4/4] arm64: simplify kernel segment mapping granularity Date: Wed, 30 Mar 2016 17:43:09 +0200 Message-Id: <1459352589-28721-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459352589-28721-1-git-send-email-ard.biesheuvel@linaro.org> References: <1459352589-28721-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160330_084343_439918_DF2F9E84 X-CRM114-Status: GOOD ( 16.27 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The mapping of the kernel consist of four segments, each of which is mapped with different permission attributes and/or lifetimes. To optimize the TLB and translation table footprint, we define various opaque constants in the linker script that resolve to different aligment values depending on the page size and whether CONFIG_DEBUG_ALIGN_RODATA is set. Considering that - a 4 KB granule kernel benefits from a 64 KB segment alignment (due to the fact that it allows the use of the contiguous bit), - the minimum alignment of the .data segment is THREAD_SIZE already, not PAGE_SIZE (i.e., we already have padding between _data and the start of the .data payload in many cases), - 2 MB is a suitable alignment value on all granule sizes, either for mapping directly (level 2 on 4 KB), or via the contiguous bit (level 3 on 16 KB and 64 KB), - anything beyond 2 MB exceeds the minimum alignment mandated by the boot protocol, and can only be mapped efficiently if the physical alignment happens to be the same, we can simplify this by standardizing on 64 KB (or 2 MB) explicitly, i.e., regardless of granule size, all segments are aligned either to 64 KB, or to 2 MB if CONFIG_DEBUG_ALIGN_RODATA=y. This also means we can drop the Kconfig dependency of CONFIG_DEBUG_ALIGN_RODATA on CONFIG_ARM64_4K_PAGES. Signed-off-by: Ard Biesheuvel --- arch/arm64/Kconfig.debug | 2 +- arch/arm64/kernel/vmlinux.lds.S | 25 ++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index 7e76845a0434..710fde4ad0f0 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug @@ -59,7 +59,7 @@ config DEBUG_RODATA If in doubt, say Y config DEBUG_ALIGN_RODATA - depends on DEBUG_RODATA && ARM64_4K_PAGES + depends on DEBUG_RODATA bool "Align linker sections up to SECTION_SIZE" help If this option is enabled, sections that may potentially be marked as diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 61a1075b9c30..77d86c976abd 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -63,14 +63,19 @@ PECOFF_FILE_ALIGNMENT = 0x200; #endif #if defined(CONFIG_DEBUG_ALIGN_RODATA) -#define ALIGN_DEBUG_RO . = ALIGN(1<