Skip to content

Commit 38a4968

Browse files
Brian GerstIngo Molnar
authored andcommitted
x86/percpu/64: Remove INIT_PER_CPU macros
Now that the load and link addresses of percpu variables are the same, these macros are no longer necessary. 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-12-brgerst@gmail.com
1 parent a8327be commit 38a4968

File tree

6 files changed

+1
-33
lines changed

6 files changed

+1
-33
lines changed

arch/x86/include/asm/desc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct gdt_page {
4646
} __attribute__((aligned(PAGE_SIZE)));
4747

4848
DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
49-
DECLARE_INIT_PER_CPU(gdt_page);
5049

5150
/* Provide the original GDT */
5251
static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)

arch/x86/include/asm/percpu.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020

2121
#define PER_CPU_VAR(var) __percpu(var)__percpu_rel
2222

23-
#ifdef CONFIG_X86_64_SMP
24-
# define INIT_PER_CPU_VAR(var) init_per_cpu__##var
25-
#else
26-
# define INIT_PER_CPU_VAR(var) var
27-
#endif
28-
2923
#else /* !__ASSEMBLY__: */
3024

3125
#include <linux/build_bug.h>
@@ -97,22 +91,6 @@
9791
#define __percpu_arg(x) __percpu_prefix "%" #x
9892
#define __force_percpu_arg(x) __force_percpu_prefix "%" #x
9993

100-
/*
101-
* Initialized pointers to per-CPU variables needed for the boot
102-
* processor need to use these macros to get the proper address
103-
* offset from __per_cpu_load on SMP.
104-
*
105-
* There also must be an entry in vmlinux_64.lds.S
106-
*/
107-
#define DECLARE_INIT_PER_CPU(var) \
108-
extern typeof(var) init_per_cpu_var(var)
109-
110-
#ifdef CONFIG_X86_64_SMP
111-
# define init_per_cpu_var(var) init_per_cpu__##var
112-
#else
113-
# define init_per_cpu_var(var) var
114-
#endif
115-
11694
/*
11795
* For arch-specific code, we can use direct single-insn ops (they
11896
* don't give an lvalue though).

arch/x86/kernel/head64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ void early_setup_idt(void)
567567
*/
568568
void __head startup_64_setup_gdt_idt(void)
569569
{
570-
struct desc_struct *gdt = (void *)(__force unsigned long)init_per_cpu_var(gdt_page.gdt);
570+
struct desc_struct *gdt = (void *)(__force unsigned long)gdt_page.gdt;
571571
void *handler = NULL;
572572

573573
struct desc_ptr startup_gdt_descr = {

arch/x86/kernel/irq_64.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <asm/apic.h>
2828

2929
DEFINE_PER_CPU_PAGE_ALIGNED(struct irq_stack, irq_stack_backing_store) __visible;
30-
DECLARE_INIT_PER_CPU(irq_stack_backing_store);
3130

3231
#ifdef CONFIG_VMAP_STACK
3332
/*

arch/x86/kernel/vmlinux.lds.S

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,6 @@ SECTIONS
471471
PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
472472

473473
#ifdef CONFIG_X86_64
474-
/*
475-
* Per-cpu symbols which need to be offset from __per_cpu_load
476-
* for the boot processor.
477-
*/
478-
#define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x)
479-
INIT_PER_CPU(gdt_page);
480-
INIT_PER_CPU(irq_stack_backing_store);
481474

482475
#ifdef CONFIG_MITIGATION_UNRET_ENTRY
483476
. = ASSERT((retbleed_return_thunk & 0x3f) == 0, "retbleed_return_thunk not cacheline-aligned");

arch/x86/tools/relocs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
9090
"__initramfs_start|"
9191
"(jiffies|jiffies_64)|"
9292
#if ELF_BITS == 64
93-
"init_per_cpu__.*|"
9493
"__end_rodata_hpage_align|"
9594
#endif
9695
"_end)$"

0 commit comments

Comments
 (0)