On Sat, Mar 02 2024 at 16:44, Thomas Gleixner wrote: > On Sat, Mar 02 2024 at 12:37, Thomas Gleixner wrote: > The below addresses _all_ percpu related sparse warnings except > the ones in arch/x86/cpu/bugs.o but that's a sparse problem: > > The following is handled correctly: > > DECLARE_PER_CPU(u64, foo); > this_cpu_read(foo); > > But this is not: > > DECLARE_PER_CPU(u64, foo); > DEFINE_PER_CPU(u64, foo); > this_cpu_read(foo); > > arch/x86/kernel/cpu/bugs.c:71:9: sparse: warning: incorrect type in initializer (different address spaces) > arch/x86/kernel/cpu/bugs.c:71:9: sparse: expected void const [noderef] __percpu *__vpp_verify > arch/x86/kernel/cpu/bugs.c:71:9: sparse: got unsigned long long * > > Commenting out the DEFINE_PER_CPU(u64, x86_spec_ctrl_current) in that > file makes sparse happy, but that's obviously not a solution :) Correction. I found the real issue: DEFINE_PER_CPU(u64, x86_spec_ctrl_current); EXPORT_SYMBOL_GPL(x86_spec_ctrl_current); I had commented out both. But the real reason is the EXPORT_SYMBOL, which obviously wants to be EXPORT_PER_CPU_SYMBOL_GPL... So sparse was right. Nothing to see here. Thanks, tglx