arch/csky/kernel/perf_event.c:878:6: sparse: sparse: symbol 'csky_pmu_event_set_period' was not declared. Should it be static?

kernel test robot
2021-07-26T01:40:25Z

[-- Attachment #1: Type: text/plain, Size: 5351 bytes --]

Hi Stephen,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ff1176468d368232b684f75e82563369208bc371
commit: 7d37cb2c912dc5c25ffac784a4f9b98c06c6bd08 lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
date: 4 months ago
config: csky-randconfig-s031-20210726 (attached as .config)
compiler: csky-linux-gcc (GCC) 10.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d37cb2c912dc5c25ffac784a4f9b98c06c6bd08
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7d37cb2c912dc5c25ffac784a4f9b98c06c6bd08
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> arch/csky/kernel/perf_event.c:878:6: sparse: sparse: symbol 'csky_pmu_event_set_period' was not declared. Should it be static?
>> arch/csky/kernel/perf_event.c:1178:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __percpu *percpu_dev_id @@ got struct pmu_hw_events * @@
arch/csky/kernel/perf_event.c:1178:34: sparse: expected void [noderef] __percpu *percpu_dev_id
arch/csky/kernel/perf_event.c:1178:34: sparse: got struct pmu_hw_events *
>> arch/csky/kernel/perf_event.c:1195:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __percpu * @@ got struct pmu_hw_events * @@
arch/csky/kernel/perf_event.c:1195:38: sparse: expected void [noderef] __percpu *
arch/csky/kernel/perf_event.c:1195:38: sparse: got struct pmu_hw_events *
>> arch/csky/kernel/perf_event.c:1293:5: sparse: sparse: symbol 'csky_pmu_device_probe' was not declared. Should it be static?

vim +/csky_pmu_event_set_period +878 arch/csky/kernel/perf_event.c

f50fd2d8524c15 Guo Ren 2019-01-02 877
f622fbf205966a Mao Han 2019-06-04 @878 int csky_pmu_event_set_period(struct perf_event *event)
f622fbf205966a Mao Han 2019-06-04 879 {
f622fbf205966a Mao Han 2019-06-04 880 struct hw_perf_event *hwc = &event->hw;
f622fbf205966a Mao Han 2019-06-04 881 s64 left = local64_read(&hwc->period_left);
f622fbf205966a Mao Han 2019-06-04 882 s64 period = hwc->sample_period;
f622fbf205966a Mao Han 2019-06-04 883 int ret = 0;
f622fbf205966a Mao Han 2019-06-04 884
f622fbf205966a Mao Han 2019-06-04 885 if (unlikely(left <= -period)) {
f622fbf205966a Mao Han 2019-06-04 886 left = period;
f622fbf205966a Mao Han 2019-06-04 887 local64_set(&hwc->period_left, left);
f622fbf205966a Mao Han 2019-06-04 888 hwc->last_period = period;
f622fbf205966a Mao Han 2019-06-04 889 ret = 1;
f622fbf205966a Mao Han 2019-06-04 890 }
f622fbf205966a Mao Han 2019-06-04 891
f622fbf205966a Mao Han 2019-06-04 892 if (unlikely(left <= 0)) {
f622fbf205966a Mao Han 2019-06-04 893 left += period;
f622fbf205966a Mao Han 2019-06-04 894 local64_set(&hwc->period_left, left);
f622fbf205966a Mao Han 2019-06-04 895 hwc->last_period = period;
f622fbf205966a Mao Han 2019-06-04 896 ret = 1;
f622fbf205966a Mao Han 2019-06-04 897 }
f622fbf205966a Mao Han 2019-06-04 898
f622fbf205966a Mao Han 2019-06-04 899 if (left > (s64)csky_pmu.max_period)
f622fbf205966a Mao Han 2019-06-04 900 left = csky_pmu.max_period;
f622fbf205966a Mao Han 2019-06-04 901
f622fbf205966a Mao Han 2019-06-04 902 /*
f622fbf205966a Mao Han 2019-06-04 903 * The hw event starts counting from this event offset,
f622fbf205966a Mao Han 2019-06-04 904 * mark it to be able to extract future "deltas":
f622fbf205966a Mao Han 2019-06-04 905 */
f622fbf205966a Mao Han 2019-06-04 906 local64_set(&hwc->prev_count, (u64)(-left));
f622fbf205966a Mao Han 2019-06-04 907
f622fbf205966a Mao Han 2019-06-04 908 if (hw_raw_write_mapping[hwc->idx] != NULL)
f622fbf205966a Mao Han 2019-06-04 909 hw_raw_write_mapping[hwc->idx]((u64)(-left) &
f622fbf205966a Mao Han 2019-06-04 910 csky_pmu.max_period);
f622fbf205966a Mao Han 2019-06-04 911
f622fbf205966a Mao Han 2019-06-04 912 cpwcr(HPOFSR, ~BIT(hwc->idx) & cprcr(HPOFSR));
f622fbf205966a Mao Han 2019-06-04 913
f622fbf205966a Mao Han 2019-06-04 914 perf_event_update_userpage(event);
f622fbf205966a Mao Han 2019-06-04 915
f622fbf205966a Mao Han 2019-06-04 916 return ret;
f622fbf205966a Mao Han 2019-06-04 917 }
f622fbf205966a Mao Han 2019-06-04 918

:::::: The code at line 878 was first introduced by commit
:::::: f622fbf205966a8e911f81a00db17997dd171404 csky: Add pmu interrupt support

:::::: TO: Mao Han <han_mao@c-sky.com>
:::::: CC: Guo Ren <ren_guo@c-sky.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40551 bytes --]