From patchwork Thu Mar 3 13:09:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 63481 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2939709lbc; Thu, 3 Mar 2016 05:12:02 -0800 (PST) X-Received: by 10.98.11.88 with SMTP id t85mr3497835pfi.98.1457010722165; Thu, 03 Mar 2016 05:12:02 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id lq6si1763768pab.140.2016.03.03.05.12.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Mar 2016 05:12:02 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@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 1abT1y-00063V-7R; Thu, 03 Mar 2016 13:11:02 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1abT19-00049f-T1 for linux-arm-kernel@lists.infradead.org; Thu, 03 Mar 2016 13:10:15 +0000 Received: by mail-wm0-x233.google.com with SMTP id p65so30909091wmp.0 for ; Thu, 03 Mar 2016 05:09:51 -0800 (PST) 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=Anq7hYjh5NbLtkFNSEL/XBG0BBCeu+xasRoGfUb0u0Q=; b=kbye5tUFnebGDWndXIlNo6Er6KQmtv9Ba0V34vsDFKfjHZpik94zg8peq0Kf6LgfA3 mgPlVm8CK8US9nFnRLqtcvoWQfWGtZHWBuoHno8GTet6e/3/d5s58IStnt939fz3MW7P q+6Fy5L7Aowld4Vy08SPL6UK1tyZ+k2pkCStc= 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=Anq7hYjh5NbLtkFNSEL/XBG0BBCeu+xasRoGfUb0u0Q=; b=a9ditWzJWpadEIKGdiKexqpzPXPhl8L8cTV4SgWz0yr+jE+PoIdHfnMzMv70qlxvZ9 Z3zooze+2hxfblu77CWOHBy3bEhHw6iYatFL2l5LDmnGPU7dHkXdizW2Jk2r/r1V45pa qaxc8OZJT+Ni6v0BmD7c1+QgxdO94QXKcCihzhurJTaImm4AQHvNzpWWzzd3TVz0H3Ve pgaFH9DjXdPjK/Gp4UVdFKDEEkYMBBmeFH86Nsc+ASN2Cz7bzSeVLruWaB77VNX0FmkT 35jG4ZrKVoD5/5u1NHNxyE7Zd/kvJZ7YHAe+KfnMEKKmJ0KzXAK7hS2Xw7C/GDZySJid TR6w== X-Gm-Message-State: AD7BkJJk6Z/Rl9lUNcFXu0zA79tqUOCGEnGq1MmPLVmEGrSjfMnEUBS4Q4NSAyRU7oeZiO7h X-Received: by 10.28.134.137 with SMTP id i131mr6192734wmd.62.1457010589972; Thu, 03 Mar 2016 05:09:49 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id hh8sm40429803wjc.42.2016.03.03.05.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Mar 2016 05:09:49 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, mark.rutland@arm.com, jeremy.linton@arm.com, labbott@fedoraproject.org Subject: [PATCH 3/3] arm64: simplify kernel segment mapping granularity Date: Thu, 3 Mar 2016 14:09:41 +0100 Message-Id: <1457010581-4924-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457010581-4924-1-git-send-email-ard.biesheuvel@linaro.org> References: <1457010581-4924-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160303_051012_295646_AB0D0391 X-CRM114-Status: GOOD ( 14.73 ) 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:233 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_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 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. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/vmlinux.lds.S | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 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/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 7a141c098bbb..2c60d19b038c 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<