From patchwork Tue Jul 30 20:15:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 13747847 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 EB119C3DA7F for ; Tue, 30 Jul 2024 20:16:19 +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:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=GbC9UKeYMk5Ne4+C+5nQILNnrxv/5Wxp3vD/sA5rOPk=; b=s7QtFVcDX60QaURt22DnJlNTgW 6/aJq7I4JEF8IkM6y/6IU0xAkVbAFiBc8GFrrmPesgJeQQSBc6FvBIxvarUuS0vUz6F4k4kaY8qL/ A98URY1bPtEEtWRZ0qQ54lMTQUlN4BU/SLx3QP2rYV+Ibw2nqxGtXpi/NodQYYvXJ/OgT7OTupVsT BisIpAAY2YaSJASW84nQqnJod9SXt3Z/uim7LNSUCIukR/B0JtxNo4bWPOjnONDgIP+1aeVfkkw4W YnMIlwb8/Yf/QppEzesqCb53RsW9dz1ZJlZws24pmatM+PL9bmfZ3NMkMyivqFC2y3Bf1f8UFSxPU BeWFIvaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYtGR-0000000GPG8-2d3C; Tue, 30 Jul 2024 20:16:07 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYtFk-0000000GOwj-38CL for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 20:15:26 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-428078ebeb9so10915e9.0 for ; Tue, 30 Jul 2024 13:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722370522; x=1722975322; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=GbC9UKeYMk5Ne4+C+5nQILNnrxv/5Wxp3vD/sA5rOPk=; b=yNt+bPRdY6D9XmRFWqYx+XBfR+WrqNACPMGvgD98R1/dkEQeGOs2U76znz5LgEJPxH vW/peJtvBotWBlBwtLvSACnYmqsPOo/wjMA5ZUOT3ebfhqBL3jQ/CprAE19yA0nBRfXM ZA0tjrOHufPxvbHiFuH3r58D9olpHA6sYJC/txzj7IWW2b/an/Qixd8HkmyBH7NS5GRo 25YHSwghZfL5DD3xeElPhPf9x5DFZzrTtKxTTj6XX2SFfBGQ2E15TadecTv48tlJoXS7 HuWen+k+STcfT/Ue7UW7sRavkbGuefMYVTY2ymn8PQh/Uu3/gmb3B5kGN2i2aInotex6 qCyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722370522; x=1722975322; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GbC9UKeYMk5Ne4+C+5nQILNnrxv/5Wxp3vD/sA5rOPk=; b=QMgdomVJbuCqDim11986QbARox8EysyITcgnRfN6o84fT0BxJjpISlaJiJuDBoWMXT gbYevUW4JCYD1a8eX5IOibxMKzro4Hf56NCK9KfJqaYRRBpfr7qXqQ3BI2ylEr/JbqtA yfqNPwKgEPlKbpfsPNk1m9hl+yDTAhis4jbqn+kYEfrYp57WuxooFw94vpVpniSykG95 LRhBlzGVK6YXLUI94qLFEJi4O4l+ER4wtOebIJ07tBmsEadbrJ1tGd9dutTbY1I0i/tN 6UtihSIMUJTBQ0qiB+L2MQybhAlFcUf4qcOfRvlLl/5ZomLa0E6CDv5noynwiumMgLn6 Y96A== X-Forwarded-Encrypted: i=1; AJvYcCUz26cvt5eREoBzQ0B5YyFUQblc1WRCEir3/89f4SLlNulHc2xxEd9lS0fI/lT4pFP0DooMzmYNYHuN/WUemnlZ4u82PDl36UwCQOMiKvtOJbUXY1U= X-Gm-Message-State: AOJu0YzM3FXS2Ma/B4TcuxTIIKqJBwBu2E3Uxsq4eB4hAS6kZh86P3LM qBOfVh4FamFWKlGzuM/rUW+kqP0Oe09tkluxVsEhm8wcMnCSglcI56bOLynSng== X-Google-Smtp-Source: AGHT+IFc88rxPpono4+Iwy5LAjLRDVlbjIErlSn/ZQzI/kRwLwwyWlo83gbzFy9/j160CW2PDZTnCQ== X-Received: by 2002:a05:600c:4fc1:b0:428:31c:5a4f with SMTP id 5b1f17b1804b1-42829f4723fmr18055e9.3.1722370521005; Tue, 30 Jul 2024 13:15:21 -0700 (PDT) Received: from localhost ([2a00:79e0:9d:4:be6a:cd70:bdf:6a62]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b8f51eaf5sm2074784f8f.29.2024.07.30.13.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 13:15:20 -0700 (PDT) From: Jann Horn Date: Tue, 30 Jul 2024 22:15:16 +0200 Subject: [PATCH] runtime constants: move list of constants to vmlinux.lds.h MIME-Version: 1.0 Message-Id: <20240730-runtime-constants-refactor-v1-1-90c2c884c3f8@google.com> X-B4-Tracking: v=1; b=H4sIANNJqWYC/x3MTQqDQAxA4atI1gbiDxa9irgYxqhZNCPJWAri3 Tt0+fHg3eBswg5TdYPxR1ySFjR1BfEIujPKWgwttT29OkK7NMubMSb1HDQ7Gm8h5mTY0biNw7D 2DRGUwVmKfP/zeXmeHxICEJlsAAAA To: Arnd Bergmann , Linus Torvalds Cc: Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-arch@vger.kernel.org, Jann Horn X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1722370517; l=3172; i=jannh@google.com; s=20240730; h=from:subject:message-id; bh=rsUtJOr5uf6xI/SHZkaRwLOdSyrVoVqLcTwk6EZKpNE=; b=MlTEOhWkW4Bugg/+QlvwFd1FRN1rJ6V5BN337jS5TdJqtH26gADznIruIJvSeYBrOrhYaQ/zA PKWhOPq6oKVAUX6ZLZ2S2ZFYLegT0MkMNh5nJWOe+sXb9NFVCkqkbI1 X-Developer-Key: i=jannh@google.com; a=ed25519; pk=AljNtGOzXeF6khBXDJVVvwSEkVDGnnZZYqfWhP1V+C8= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_131524_862258_A005A204 X-CRM114-Status: GOOD ( 14.44 ) 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 Refactor the list of constant variables into a macro. This should make it easier to add more constants in the future. Signed-off-by: Jann Horn Acked-by: Arnd Bergmann Reviewed-by: Alexander Gordeev Reviewed-by: Thomas Gleixner Acked-by: Will Deacon --- I'm not sure whose tree this has to go through - I guess Arnd's? --- arch/arm64/kernel/vmlinux.lds.S | 3 +-- arch/s390/kernel/vmlinux.lds.S | 3 +-- arch/x86/kernel/vmlinux.lds.S | 3 +-- include/asm-generic/vmlinux.lds.h | 4 ++++ 4 files changed, 7 insertions(+), 6 deletions(-) --- base-commit: 94ede2a3e9135764736221c080ac7c0ad993dc2d change-id: 20240730-runtime-constants-refactor-309f966d4100 diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 55a8e310ea12..58d89d997d05 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -261,14 +261,13 @@ SECTIONS *(.init.altinstructions .init.bss) /* from the EFI stub */ } .exit.data : { EXIT_DATA } - RUNTIME_CONST(shift, d_hash_shift) - RUNTIME_CONST(ptr, dentry_hashtable) + RUNTIME_CONST_VARIABLES PERCPU_SECTION(L1_CACHE_BYTES) HYPERVISOR_PERCPU_SECTION HYPERVISOR_RELOC_SECTION diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 975c654cf5a5..3e8ebf1d64c5 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -187,14 +187,13 @@ SECTIONS _eamode31 = .; /* early.c uses stsi, which requires page aligned data. */ . = ALIGN(PAGE_SIZE); INIT_DATA_SECTION(0x100) - RUNTIME_CONST(shift, d_hash_shift) - RUNTIME_CONST(ptr, dentry_hashtable) + RUNTIME_CONST_VARIABLES PERCPU_SECTION(0x100) . = ALIGN(PAGE_SIZE); __init_end = .; /* freed after init ends here */ diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 6e73403e874f..6726be89b7a6 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -354,14 +354,13 @@ SECTIONS } #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP) PERCPU_SECTION(INTERNODE_CACHE_BYTES) #endif - RUNTIME_CONST(shift, d_hash_shift) - RUNTIME_CONST(ptr, dentry_hashtable) + RUNTIME_CONST_VARIABLES . = ALIGN(PAGE_SIZE); /* freed after init ends here */ .init.end : AT(ADDR(.init.end) - LOAD_OFFSET) { __init_end = .; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index ad6afc5c4918..54986eac2f73 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -916,12 +916,16 @@ #define RUNTIME_CONST(t,x) \ . = ALIGN(8); \ RUNTIME_NAME(t,x) : AT(ADDR(RUNTIME_NAME(t,x)) - LOAD_OFFSET) { \ *(RUNTIME_NAME(t,x)); \ } +#define RUNTIME_CONST_VARIABLES \ + RUNTIME_CONST(shift, d_hash_shift) \ + RUNTIME_CONST(ptr, dentry_hashtable) + /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */ #define KUNIT_TABLE() \ . = ALIGN(8); \ BOUNDED_SECTION_POST_LABEL(.kunit_test_suites, __kunit_suites, _start, _end) /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */