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

From: kernel test robot
Date: Sun Oct 08 2023 - 15:58: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-tinyconfig (https://download.01.org/0day-ci/archive/20231009/202310090338.4PmYjmBS-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/20231009/202310090338.4PmYjmBS-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/202310090338.4PmYjmBS-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

arch/x86/events/core.c: In function 'perf_callchain_guest32':
>> arch/x86/events/core.c:2784:43: warning: passing argument 1 of 'perf_guest_read_virt' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2784 | if (!perf_guest_read_virt(&fp->next_frame, &frame.next_frame,
| ^~~~~~~~~~~~~~~
In file included from arch/x86/events/core.c:15:
include/linux/perf_event.h:1531:41: note: expected 'void *' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
1531 | static inline bool perf_guest_read_virt(void*, void*, unsigned int) { return 0; }
| ^~~~~
arch/x86/events/core.c:2787:43: warning: passing argument 1 of 'perf_guest_read_virt' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2787 | if (!perf_guest_read_virt(&fp->return_address, &frame.return_address,
| ^~~~~~~~~~~~~~~~~~~
include/linux/perf_event.h:1531:41: note: expected 'void *' but argument is of type 'const u32 *' {aka 'const unsigned int *'}
1531 | static inline bool perf_guest_read_virt(void*, void*, unsigned int) { return 0; }
| ^~~~~
arch/x86/events/core.c: In function 'perf_callchain_guest':
arch/x86/events/core.c:2808:51: warning: passing argument 1 of 'perf_guest_read_virt' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2808 | if (!perf_guest_read_virt(&fp->next_frame, &frame.next_frame,
| ^~~~~~~~~~~~~~~
include/linux/perf_event.h:1531:41: note: expected 'void *' but argument is of type 'struct stack_frame * const*'
1531 | static inline bool perf_guest_read_virt(void*, void*, unsigned int) { return 0; }
| ^~~~~
arch/x86/events/core.c:2811:51: warning: passing argument 1 of 'perf_guest_read_virt' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2811 | if (!perf_guest_read_virt(&fp->return_address, &frame.return_address,
| ^~~~~~~~~~~~~~~~~~~
include/linux/perf_event.h:1531:41: note: expected 'void *' but argument is of type 'const long unsigned int *'
1531 | static inline bool perf_guest_read_virt(void*, void*, unsigned int) { return 0; }
| ^~~~~


vim +2784 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

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