Re: arch/x86/include/asm/processor.h:698:16: sparse: sparse: incorrect type in initializer (different address spaces)

From: Thomas Gleixner
Date: Fri Mar 01 2024 - 17:26:50 EST


On Fri, Mar 01 2024 at 22:57, Thomas Gleixner wrote:

> On Sat, Mar 02 2024 at 04:12, kernel test robot wrote:
>> FYI, the error/warning was bisected to this commit, please ignore it
>> if it's irrelevant.
>
> I have no idea to which previous thread you are replying to because your
> mail lacks any references.
>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 87adedeba51a822533649b143232418b9e26d08b
>> commit: 6e29032340b60f7aa7475c8234b17273e4424007 x86/cpu: Move cpu_l[l2]c_id into topology info
>> date: 5 months ago
>> config: i386-randconfig-062-20240301 (https://download.01.org/0day-ci/archive/20240302/202403020457.RCJoQ3ts-lkp@xxxxxxxxx/config)
>> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240302/202403020457.RCJoQ3ts-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/202403020457.RCJoQ3ts-lkp@xxxxxxxxx/
>>
>> sparse warnings: (new ones prefixed by >>)
>>
>> vim +698 arch/x86/include/asm/processor.h
>>
>> 695
>> 696 static inline u16 per_cpu_llc_id(unsigned int cpu)
>> 697 {
>> > 698 return per_cpu(cpu_info.topo.llc_id, cpu);
>> 699 }
>> 700
>
> This is bogus and I looked at another related bogosity today:
>
> https://lore.kernel.org/all/202403010704.oGQZPu0P-lkp@xxxxxxxxx
>
> which has similar complaints.
>
> So I went and downloaded the config and followed the reproduction
> instructions except for one detail.
>
> The only difference is the sparse version:
>
> 1) I had the regular debian variant installed.
>
> Version: 0.6.4 (Debian: 0.6.4-3)
>
> 2) I updated my sparse clone and rebuilt
>
> Version: v0.6.4-66-g0196afe16a50
>
> Neither one of them exposed the problem, but you are using:
>
> sparse version: v0.6.4-66-g0196afe1-dirty
>
> which is obviously based on the latest upstream tree, but seems to have
> some extra muck on top which I don't know what it is.
>
> Does this reproduce with an unpatched upstream sparse for you?
>
> If so then I'm really curious why it does not reproduce here.

Sorry, my fault. I can reproduce now but it still does not make any
sense. The code is correct...

Let me put something together which the sparse folks can digest.

Thanks,

tglx