Re: [PATCH v2 4/5] perf kvm: Support sampling guest callchains

From: kernel test robot
Date: Thu Oct 12 2023 - 16:42:35 EST


Hi Tianyi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 8a749fd1a8720d4619c91c8b6e7528c0a355c0aa]

url: https://github.com/intel-lab-lkp/linux/commits/Tianyi-Liu/KVM-Add-arch-specific-interfaces-for-sampling-guest-callchains/20231008-230042
base: 8a749fd1a8720d4619c91c8b6e7528c0a355c0aa
patch link: https://lore.kernel.org/r/SY4P282MB108433024762F1F292D47C2A9DCFA%40SY4P282MB1084.AUSP282.PROD.OUTLOOK.COM
patch subject: [PATCH v2 4/5] perf kvm: Support sampling guest callchains
config: i386-randconfig-061-20231012 (https://download.01.org/0day-ci/archive/20231013/202310130419.cIkNaYZm-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/20231013/202310130419.cIkNaYZm-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/202310130419.cIkNaYZm-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/x86/events/core.c:2808:52: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected void *addr @@ got struct stack_frame *const * @@
arch/x86/events/core.c:2808:52: sparse: expected void *addr
arch/x86/events/core.c:2808:52: sparse: got struct stack_frame *const *
>> arch/x86/events/core.c:2811:52: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected void *addr @@ got unsigned long const * @@
arch/x86/events/core.c:2811:52: sparse: expected void *addr
arch/x86/events/core.c:2811:52: sparse: got unsigned long const *
>> arch/x86/events/core.c:2784:44: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected void *addr @@ got unsigned int const * @@
arch/x86/events/core.c:2784:44: sparse: expected void *addr
arch/x86/events/core.c:2784:44: sparse: got unsigned int const *
arch/x86/events/core.c:2787:44: sparse: sparse: incorrect type in argument 1 (different modifiers) @@ expected void *addr @@ got unsigned int const * @@
arch/x86/events/core.c:2787:44: sparse: expected void *addr
arch/x86/events/core.c:2787:44: sparse: got unsigned int const *

vim +2808 arch/x86/events/core.c

2775
2776 static inline void
2777 perf_callchain_guest32(struct perf_callchain_entry_ctx *entry)
2778 {
2779 struct stack_frame_ia32 frame;
2780 const struct stack_frame_ia32 *fp;
2781
2782 fp = (void *)perf_guest_get_frame_pointer();
2783 while (fp && entry->nr < entry->max_stack) {
> 2784 if (!perf_guest_read_virt(&fp->next_frame, &frame.next_frame,
2785 sizeof(frame.next_frame)))
2786 break;
2787 if (!perf_guest_read_virt(&fp->return_address, &frame.return_address,
2788 sizeof(frame.return_address)))
2789 break;
2790 perf_callchain_store(entry, frame.return_address);
2791 fp = (void *)frame.next_frame;
2792 }
2793 }
2794
2795 void
2796 perf_callchain_guest(struct perf_callchain_entry_ctx *entry)
2797 {
2798 struct stack_frame frame;
2799 const struct stack_frame *fp;
2800 unsigned int guest_state;
2801
2802 guest_state = perf_guest_state();
2803 perf_callchain_store(entry, perf_guest_get_ip());
2804
2805 if (guest_state & PERF_GUEST_64BIT) {
2806 fp = (void *)perf_guest_get_frame_pointer();
2807 while (fp && entry->nr < entry->max_stack) {
> 2808 if (!perf_guest_read_virt(&fp->next_frame, &frame.next_frame,
2809 sizeof(frame.next_frame)))
2810 break;
> 2811 if (!perf_guest_read_virt(&fp->return_address, &frame.return_address,
2812 sizeof(frame.return_address)))
2813 break;
2814 perf_callchain_store(entry, frame.return_address);
2815 fp = (void *)frame.next_frame;
2816 }
2817 } else {
2818 perf_callchain_guest32(entry);
2819 }
2820 }
2821

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki