Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()
From: Linus Torvalds
Date: Wed Oct 18 2023 - 12:13:10 EST
On Wed, 18 Oct 2023 at 06:15, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> Attached is the prototype patch that works for me (together with
> Linus' FPU switching patch).
That looks reasonable, but I think the separate compilation unit is
unnecessary, and I still absolutely hate how that const_pcpu_hot thing
is declared twice (your patch does it in both current.h and in
percpu-hot.c).
How about we just do the whole alias as a linker thing instead? So the
same way that we just do
jiffies = jiffies_64;
in our arch/x86/kernel/vmlinux.lds.S file, we could just do
const_pcpu_hot = pcpu_hot;
in there.
Then, as far as the compiler is concerned, we just have
DECLARE_PER_CPU_ALIGNED(
const struct pcpu_hot __percpu_seg_override,
const_pcpu_hot)
and the compiler doesn't know that it's aliased to anything else.
And please do that declaration in just *one* place.
Linus