[tip:WIP.x86/paravirt 7/8] arch/x86/events/intel/ds.c:359:17: sparse: sparse: incorrect type in initializer (different address spaces)

From: kbuild test robot
Date: Thu Apr 25 2019 - 11:40:19 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/paravirt
head: 269b8685f55e335b82b64f9858a751ba3d5ea8d8
commit: 124d6af5a5f559e516ed2c6ea857e889ed293b43 [7/8] x86/paravirt: Standardize 'insn_buff' variable names
reproduce:
# apt-get install sparse
git checkout 124d6af5a5f559e516ed2c6ea857e889ed293b43
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> arch/x86/events/intel/ds.c:359:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] <asn:3> *__vpp_verify @@ got sn:3> *__vpp_verify @@
>> arch/x86/events/intel/ds.c:359:17: sparse: expected void const [noderef] <asn:3> *__vpp_verify
>> arch/x86/events/intel/ds.c:359:17: sparse: got void **

vim +359 arch/x86/events/intel/ds.c

333
334 static int alloc_pebs_buffer(int cpu)
335 {
336 struct cpu_hw_events *hwev = per_cpu_ptr(&cpu_hw_events, cpu);
337 struct debug_store *ds = hwev->ds;
338 size_t bsiz = x86_pmu.pebs_buffer_size;
339 int max, node = cpu_to_node(cpu);
340 void *buffer, *insn_buff, *cea;
341
342 if (!x86_pmu.pebs)
343 return 0;
344
345 buffer = dsalloc_pages(bsiz, GFP_KERNEL, cpu);
346 if (unlikely(!buffer))
347 return -ENOMEM;
348
349 /*
350 * HSW+ already provides us the eventing ip; no need to allocate this
351 * buffer then.
352 */
353 if (x86_pmu.intel_cap.pebs_format < 2) {
354 insn_buff = kzalloc_node(PEBS_FIXUP_SIZE, GFP_KERNEL, node);
355 if (!insn_buff) {
356 dsfree_pages(buffer, bsiz);
357 return -ENOMEM;
358 }
> 359 per_cpu(insn_buff, cpu) = insn_buff;
360 }
361 hwev->ds_pebs_vaddr = buffer;
362 /* Update the cpu entry area mapping */
363 cea = &get_cpu_entry_area(cpu)->cpu_debug_buffers.pebs_buffer;
364 ds->pebs_buffer_base = (unsigned long) cea;
365 ds_update_cea(cea, buffer, bsiz, PAGE_KERNEL);
366 ds->pebs_index = ds->pebs_buffer_base;
367 max = x86_pmu.pebs_record_size * (bsiz / x86_pmu.pebs_record_size);
368 ds->pebs_absolute_maximum = ds->pebs_buffer_base + max;
369 return 0;
370 }
371

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation