runtime constants: move list of constants to vmlinux.lds.h
Subsystems (4)
PATCH 1/1 runtime constants: move list of constants to vmlinux.lds.h
Refactor the list of constant variables into a macro. This should make it easier to add more constants in the future.
---
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(-)
arch/arm64/kernel/vmlinux.lds.S +1 -2
@@ -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
arch/s390/kernel/vmlinux.lds.S +1 -2
@@ -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 */
arch/x86/kernel/vmlinux.lds.S +1 -2
@@ -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 = .;
include/asm-generic/vmlinux.lds.h +4 -0
@@ -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 */
---
base-commit: 94ede2a3e9135764736221c080ac7c0ad993dc2d
change-id: 20240730-runtime-constants-refactor-309f966d4100
Signature · 1 line
Jann Horn <[email protected]>
Quoted 6 lines · Jann Horn
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 <[email protected]>---
I'm not sure whose tree this has to go through - I guess Arnd's?
This is for 6.12, right? I can take it through the asm-generic tree if that helps, but someone else should review it first.
If you have any other patches that would depend on this patch, you can also take it through the other tree and add
for cross-architecture bits.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Jann Horn
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 <[email protected]>---
I'm not sure whose tree this has to go through - I guess Arnd's?This is for 6.12, right?
Yeah.
Quoted 9 lines
I can take it through the asm-generic
tree if that helps, but someone else should review it first.If you have any other patches that would depend on this patch, you can also take it through the other tree and add
Acked-by Arnd Bergmann <[email protected]>for cross-architecture bits.
Thanks!
I was thinking of maybe trying to write a patch based on it that'd have to go through the MM tree (for using this in kfence), though I'm not sure whether I'll actually do that yet. So your suggestion makes sense, maybe hold off on putting this in a tree for now...
Quoted 2 lines
Arnd
Quoted 21 lines · Jann Horn
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Jann Horn
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 <[email protected]>---
I'm not sure whose tree this has to go through - I guess Arnd's?This is for 6.12, right?
Yeah.
Quoted 8 lines
I can take it through the asm-generic
tree if that helps, but someone else should review it first.If you have any other patches that would depend on this patch, you can also take it through the other tree and add
Acked-by Arnd Bergmann <[email protected]>
Quoted 8 lines
Quoted 1 line
for cross-architecture bits.
Thanks!
I was thinking of maybe trying to write a patch based on it that'd have to go through the MM tree (for using this in kfence), though I'm not sure whether I'll actually do that yet. So your suggestion makes sense, maybe hold off on putting this in a tree for now...
I don't think I'll get around to doing anything on top of this patch for the next few months at least, please take it through your tree.
Quoted 12 lines · Jann Horn
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 <[email protected]>---
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(-)
...
Quoted 10 lines
arch/s390/kernel/vmlinux.lds.S +0
-0@@ -187,14 +187,13 @@ SECTIONS _eamode31 = .; /* early.c uses stsi, which requires page aligned data. */ . = ALIGN(PAGE_SIZE); INIT_DATA_SECTION(0x100)
arch/s390/kernel/vmlinux.lds.S SECTIONS · line 199
Quoted 10 lines
arch/s390/kernel/vmlinux.lds.S +1
-2- 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 */
...
For s390:
Quoted 4 lines · Jann Horn
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 <[email protected]>
Quoted 3 lines · Jann Horn
Refactor the list of constant variables into a macro. This should make it easier to add more constants in the future.
LGTM too.
Linus
Quoted 22 lines · Jann Horn
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 <[email protected]>---
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(-)arch/arm64/kernel/vmlinux.lds.S +0
-0@@ -261,14 +261,13 @@ SECTIONS *(.init.altinstructions .init.bss) /* from the EFI stub */ } .exit.data : { EXIT_DATA
arch/arm64/kernel/vmlinux.lds.S SECTIONS · line 272
Quoted 10 lines
arch/arm64/kernel/vmlinux.lds.S +1
-2} - 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
I'm assuming Arnd will pick this up.
Will
Arnd Bergmann
maintainerQuoted 11 lines · Will Deacon
Quoted 6 lines · Jann Horn
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 <[email protected]>---
I'm not sure whose tree this has to go through - I guess Arnd's?Acked-by Will Deacon <[email protected]>I'm assuming Arnd will pick this up.
I'm back from vacation now and applied it to the asm-generic tree for 6.12.
Arnd