arch/x86/kernel/cpu/bugs.c:68:13: sparse: sparse: incorrect type in initializer (different address spaces)

kernel test robot
2022-07-15T00:12:59Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e5d523f1ae8f2cef01f8e071aeee432654166708
commit: caa0ff24d5d0e02abce5e65c3d2b7f20a6617be5 x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value
date: 3 weeks ago
config: x86_64-randconfig-s022 (https://download.01.org/0day-ci/archive/20220715/202207150816.81pQSTa5-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=caa0ff24d5d0e02abce5e65c3d2b7f20a6617be5
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout caa0ff24d5d0e02abce5e65c3d2b7f20a6617be5
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kernel/cpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
arch/x86/kernel/cpu/bugs.c:57:1: sparse: sparse: symbol 'x86_spec_ctrl_current' was not declared. Should it be static?
>> arch/x86/kernel/cpu/bugs.c:68:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long long * @@
arch/x86/kernel/cpu/bugs.c:68:13: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/x86/kernel/cpu/bugs.c:68:13: sparse: got unsigned long long *
arch/x86/kernel/cpu/bugs.c:71:9: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long long * @@
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 *
arch/x86/kernel/cpu/bugs.c:794:12: sparse: sparse: symbol 'retbleed_strings' was not declared. Should it be static?

vim +68 arch/x86/kernel/cpu/bugs.c

55
56 /* The current value of the SPEC_CTRL MSR with task-specific bits set */
> 57 DEFINE_PER_CPU(u64, x86_spec_ctrl_current);
58 EXPORT_SYMBOL_GPL(x86_spec_ctrl_current);
59
60 static DEFINE_MUTEX(spec_ctrl_mutex);
61
62 /*
63 * Keep track of the SPEC_CTRL MSR value for the current task, which may differ
64 * from x86_spec_ctrl_base due to STIBP/SSB in __speculation_ctrl_update().
65 */
66 void write_spec_ctrl_current(u64 val)
67 {
> 68 if (this_cpu_read(x86_spec_ctrl_current) == val)
69 return;
70
71 this_cpu_write(x86_spec_ctrl_current, val);
72 wrmsrl(MSR_IA32_SPEC_CTRL, val);
73 }
74

--
0-DAY CI Kernel Test Service