Re: [tip:x86/boot 9/9] arch/x86/include/asm/desc.h:54:16: sparse: sparse: incorrect type in initializer (different address spaces)

From: Yujie Liu
Date: Sat Mar 02 2024 - 08:09:28 EST


On Sat, Mar 02, 2024 at 04:19:58PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/boot
> head: 721f791ce1cddfa5f2bf524ac14741bfa0f72697
> commit: 11e36b0f7c2150a6453872b79555767b43c846d0 [9/9] x86/boot/64: Load the final kernel GDT during early boot directly, remove startup_gdt[]
> config: x86_64-randconfig-121-20240301 (https://download.01.org/0day-ci/archive/20240302/202403021605.gg6Sr3yI-lkp@xxxxxxxxx/config)
> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240302/202403021605.gg6Sr3yI-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202403021605.gg6Sr3yI-lkp@xxxxxxxxx/
>
> sparse warnings: (new ones prefixed by >>)

Sorry for the empty warning here. The actual sparse warning is:

arch/x86/include/asm/desc.h:54:16: sparse: sparse: incorrect type in initializer (different address spaces)
arch/x86/include/asm/desc.h:54:16: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/x86/include/asm/desc.h:54:16: sparse: got struct gdt_page *

>
>
> vim +54 arch/x86/include/asm/desc.h
>
> a939098afcfa5f include/asm-x86/desc.h Glauber Costa 2008-05-28 50
> 69218e47994da6 arch/x86/include/asm/desc.h Thomas Garnier 2017-03-14 51 /* Provide the original GDT */
> 69218e47994da6 arch/x86/include/asm/desc.h Thomas Garnier 2017-03-14 52 static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)
> a939098afcfa5f include/asm-x86/desc.h Glauber Costa 2008-05-28 53 {
> a939098afcfa5f include/asm-x86/desc.h Glauber Costa 2008-05-28 @54 return per_cpu(gdt_page, cpu).gdt;
> a939098afcfa5f include/asm-x86/desc.h Glauber Costa 2008-05-28 55 }
> a939098afcfa5f include/asm-x86/desc.h Glauber Costa 2008-05-28 56
>
> :::::: The code at line 54 was first introduced by commit
> :::::: a939098afcfa5f81d3474782ec15c6d114e57763 x86: move x86_64 gdt closer to i386
>
> :::::: TO: Glauber Costa <gcosta@xxxxxxxxxx>
> :::::: CC: Ingo Molnar <mingo@xxxxxxx>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>