]> www.infradead.org Git - nvme.git/commit
x86/percpu/64: Use relative percpu offsets
authorBrian Gerst <brgerst@gmail.com>
Thu, 23 Jan 2025 19:07:40 +0000 (14:07 -0500)
committerIngo Molnar <mingo@kernel.org>
Tue, 18 Feb 2025 09:15:27 +0000 (10:15 +0100)
commit9d7de2aa8b41407bc96d89a80dc1fd637d389d42
treeb94af48af75aa5b347f9624e73fd7dc1821a4e2d
parent80d47defddc000271502057ebd7efa4fd6481542
x86/percpu/64: Use relative percpu offsets

The percpu section is currently linked at absolute address 0, because
older compilers hard-coded the stack protector canary value at a fixed
offset from the start of the GS segment.  Now that the canary is a
normal percpu variable, the percpu section does not need to be linked
at a specific address.

x86-64 will now calculate the percpu offsets as the delta between the
initial percpu address and the dynamically allocated memory, like other
architectures.  Note that GSBASE is limited to the canonical address
width (48 or 57 bits, sign-extended).  As long as the kernel text,
modules, and the dynamically allocated percpu memory are all in the
negative address space, the delta will not overflow this limit.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250123190747.745588-9-brgerst@gmail.com
arch/x86/include/asm/processor.h
arch/x86/kernel/head_64.S
arch/x86/kernel/setup_percpu.c
arch/x86/kernel/vmlinux.lds.S
arch/x86/platform/pvh/head.S
arch/x86/tools/relocs.c
arch/x86/xen/xen-head.S
init/Kconfig