summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/current.h
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2023-12-04 22:02:29 +0100
committerIngo Molnar <mingo@kernel.org>2023-12-11 11:47:14 +0100
commit0e3703630bd3fead041a6bfb3a3f2a9891af6c34 (patch)
tree610d738bf6c30b4db16044479fe23f3244781c5f /arch/x86/include/asm/current.h
parentfc50065325f8b88d6986f089ae103b5db858ab96 (diff)
x86/percpu: Fix "const_pcpu_hot" version generation failure
Version generation for "const_pcpu_hot" symbol failed because genksyms doesn't know the __seg_gs keyword. Effectively revert commit 4604c052b84d ("x86/percpu: Declare const_pcpu_hot as extern const variable") and use this_cpu_read_const() instead to avoid "sparse: dereference of noderef expression" warning when reading const_pcpu_hot. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20231204210320.114429-1-ubizjak@gmail.com
Diffstat (limited to 'arch/x86/include/asm/current.h')
-rw-r--r--arch/x86/include/asm/current.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h
index 9fbd7cb2dc86..c8c5674d69f6 100644
--- a/arch/x86/include/asm/current.h
+++ b/arch/x86/include/asm/current.h
@@ -37,12 +37,13 @@ static_assert(sizeof(struct pcpu_hot) == 64);
DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot);
/* const-qualified alias to pcpu_hot, aliased by linker. */
-extern const struct pcpu_hot __percpu_seg_override const_pcpu_hot;
+DECLARE_PER_CPU_ALIGNED(const struct pcpu_hot __percpu_seg_override,
+ const_pcpu_hot);
static __always_inline struct task_struct *get_current(void)
{
if (IS_ENABLED(CONFIG_USE_X86_SEG_SUPPORT))
- return const_pcpu_hot.current_task;
+ return this_cpu_read_const(const_pcpu_hot.current_task);
return this_cpu_read_stable(pcpu_hot.current_task);
}