Re: arch/x86/events/amd/uncore.c:601:10: sparse: sparse: incorrect type in initializer (different address spaces)

From: Yujie Liu
Date: Sat Mar 02 2024 - 08:17:33 EST


On Sat, Mar 02, 2024 at 09:32:05AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: d17468c6f1f49e6259698f6401b8d7a5b90eac68
> commit: 07888daa056e809de0b6b234116b575c11f9f99d perf/x86/amd/uncore: Move discovery and registration
> date: 5 months ago
> config: x86_64-randconfig-r122-20240301 (https://download.01.org/0day-ci/archive/20240302/202403020941.UCnNA0rh-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/202403020941.UCnNA0rh-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/202403020941.UCnNA0rh-lkp@xxxxxxxxx/
>
> sparse warnings: (new ones prefixed by >>)

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

arch/x86/events/amd/uncore.c:601:10: sparse: sparse: incorrect type in initializer (different address spaces)
arch/x86/events/amd/uncore.c:601:10: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/x86/events/amd/uncore.c:601:10: sparse: got union amd_uncore_info *

>
>
> vim +601 arch/x86/events/amd/uncore.c
>
> 582
> 583 static
> 584 void amd_uncore_df_ctx_scan(struct amd_uncore *uncore, unsigned int cpu)
> 585 {
> 586 union cpuid_0x80000022_ebx ebx;
> 587 union amd_uncore_info info;
> 588
> 589 if (!boot_cpu_has(X86_FEATURE_PERFCTR_NB))
> 590 return;
> 591
> 592 info.split.aux_data = 0;
> 593 info.split.num_pmcs = NUM_COUNTERS_NB;
> 594 info.split.cid = topology_die_id(cpu);
> 595
> 596 if (pmu_version >= 2) {
> 597 ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
> 598 info.split.num_pmcs = ebx.split.num_df_pmc;
> 599 }
> 600
> > 601 *per_cpu_ptr(uncore->info, cpu) = info;
> 602 }
> 603
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>