From patchwork Mon Oct 14 10:58:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EECCD16245 for ; Mon, 14 Oct 2024 11:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O6/Jx7UMSGM5GsZJBCvRZxEmHJTJyTPnGhAVFa7W4Fs=; b=eq0hQ0/HaEbZ0VZxp23lYxjqQo rkEayx9zGw+0PiXqieh8zqG980oZ7mKyOK4VIU3qt9HRdiNi4tzXNs1nksnPUNXMATSYvQDRliKav pCbVRmK7fzSPRxrnc8ftLa5q4fwfEwpEfBBv94AiFdmNfH40Jv+2Uqje8JcNoDRqZI6HVH56qS0Zh mIsSBHxifRRhj6g9EpBnfSPns7NZJZh9wM0O+ZZ34PpjKoSdagIrtyu9bC5BBbkfWtJ5XEgkO5xKQ sXhAGb7D6WO5ycJxvr+RJF6IAEOcvLgfZ4rFuIin5Iy9K08g0j6eaMYOrvmW/39r6Nj0AOOopqB3k OqUNumXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0JDN-00000004vEa-0gJN; Mon, 14 Oct 2024 11:26:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0InV-00000004nN0-0yw7 for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2024 10:59:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 443921684; Mon, 14 Oct 2024 04:00:02 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E5CD3F51B; Mon, 14 Oct 2024 03:59:29 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Christoph Lameter , David Hildenbrand , Dennis Zhou , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Tejun Heo , Will Deacon Cc: Ryan Roberts , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 02/57] vmlinux: Align to PAGE_SIZE_MAX Date: Mon, 14 Oct 2024 11:58:09 +0100 Message-ID: <20241014105912.3207374-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_035933_396368_A532CBF9 X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Increase alignment of structures requiring at least PAGE_SIZE alignment to PAGE_SIZE_MAX. For compile-time PAGE_SIZE, PAGE_SIZE_MAX == PAGE_SIZE so there is no change. For boot-time PAGE_SIZE, PAGE_SIZE_MAX is the largest selectable page size. Signed-off-by: Ryan Roberts --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ include/asm-generic/vmlinux.lds.h | 32 +++++++++++++++---------------- include/linux/linkage.h | 4 ++-- include/linux/percpu-defs.h | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 1ae44793132a8..5727f883001bb 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -13,7 +13,7 @@ * . = START; * __init_begin = .; * HEAD_TEXT_SECTION - * INIT_TEXT_SECTION(PAGE_SIZE) + * INIT_TEXT_SECTION(PAGE_SIZE_MAX) * INIT_DATA_SECTION(...) * PERCPU_SECTION(CACHELINE_SIZE) * __init_end = .; @@ -23,7 +23,7 @@ * _etext = .; * * _sdata = .; - * RO_DATA(PAGE_SIZE) + * RO_DATA(PAGE_SIZE_MAX) * RW_DATA(...) * _edata = .; * @@ -371,10 +371,10 @@ * Data section helpers */ #define NOSAVE_DATA \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ __nosave_begin = .; \ *(.data..nosave) \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ __nosave_end = .; #define PAGE_ALIGNED_DATA(page_align) \ @@ -733,9 +733,9 @@ . = ALIGN(bss_align); \ .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ BSS_FIRST_SECTIONS \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ *(.bss..page_aligned) \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ *(.dynbss) \ *(BSS_MAIN) \ *(COMMON) \ @@ -950,9 +950,9 @@ */ #ifdef CONFIG_AMD_MEM_ENCRYPT #define PERCPU_DECRYPTED_SECTION \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ *(.data..percpu..decrypted) \ - . = ALIGN(PAGE_SIZE); + . = ALIGN(PAGE_SIZE_MAX); #else #define PERCPU_DECRYPTED_SECTION #endif @@ -1030,7 +1030,7 @@ #define PERCPU_INPUT(cacheline) \ __per_cpu_start = .; \ *(.data..percpu..first) \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ *(.data..percpu..page_aligned) \ . = ALIGN(cacheline); \ *(.data..percpu..read_mostly) \ @@ -1075,16 +1075,16 @@ * PERCPU_SECTION - define output section for percpu area, simple version * @cacheline: cacheline size * - * Align to PAGE_SIZE and outputs output section for percpu area. This + * Align to PAGE_SIZE_MAX and outputs output section for percpu area. This * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and * __per_cpu_start will be identical. * - * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,) + * This macro is equivalent to ALIGN(PAGE_SIZE_MAX); PERCPU_VADDR(@cacheline,,) * except that __per_cpu_load is defined as a relative symbol against * .data..percpu which is required for relocatable x86_32 configuration. */ #define PERCPU_SECTION(cacheline) \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ __per_cpu_load = .; \ PERCPU_INPUT(cacheline) \ @@ -1102,15 +1102,15 @@ * All sections are combined in a single .data section. * The sections following CONSTRUCTORS are arranged so their * typical alignment matches. - * A cacheline is typical/always less than a PAGE_SIZE so + * A cacheline is typical/always less than a PAGE_SIZE_MAX so * the sections that has this restriction (or similar) - * is located before the ones requiring PAGE_SIZE alignment. - * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which + * is located before the ones requiring PAGE_SIZE_MAX alignment. + * NOSAVE_DATA starts and ends with a PAGE_SIZE_MAX alignment which * matches the requirement of PAGE_ALIGNED_DATA. * * use 0 as page_align if page_aligned data is not used */ #define RW_DATA(cacheline, pagealigned, inittask) \ - . = ALIGN(PAGE_SIZE); \ + . = ALIGN(PAGE_SIZE_MAX); \ .data : AT(ADDR(.data) - LOAD_OFFSET) { \ INIT_TASK_DATA(inittask) \ NOSAVE_DATA \ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 5c8865bb59d91..68aa9775fce51 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -36,8 +36,8 @@ __stringify(name)) #endif -#define __page_aligned_data __section(".data..page_aligned") __aligned(PAGE_SIZE) -#define __page_aligned_bss __section(".bss..page_aligned") __aligned(PAGE_SIZE) +#define __page_aligned_data __section(".data..page_aligned") __aligned(PAGE_SIZE_MAX) +#define __page_aligned_bss __section(".bss..page_aligned") __aligned(PAGE_SIZE_MAX) /* * For assembly routines. diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 8efce7414fad6..89c7f430015ba 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -156,11 +156,11 @@ */ #define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \ - __aligned(PAGE_SIZE) + __aligned(PAGE_SIZE_MAX) #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \ - __aligned(PAGE_SIZE) + __aligned(PAGE_SIZE_MAX) /* * Declaration/definition used for per-CPU variables that must be read mostly.