linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
@ 2021-03-26 12:27 kernel test robot
  2021-04-13 20:00 ` Nathan Chancellor
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2021-03-26 12:27 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kbuild-all, clang-built-linux, linux-kernel, Paolo Bonzini,
	Alexandru Elisei

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

Hi Marc,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   db24726bfefa68c606947a86132591568a06bfb4
commit: 6b5b368fccd7109b052e45af8ba1464c8d140a49 KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key
date:   3 weeks ago
config: arm64-randconfig-r005-20210326 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b5b368fccd7109b052e45af8ba1464c8d140a49
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6b5b368fccd7109b052e45af8ba1464c8d140a49
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

>> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' [-Werror,-Wimplicit-function-declaration]
           if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
                                             ^
   1 error generated.


vim +/perf_num_counters +58 arch/arm64/kvm/perf.c

    50	
    51	int kvm_perf_init(void)
    52	{
    53		/*
    54		 * Check if HW_PERF_EVENTS are supported by checking the number of
    55		 * hardware performance counters. This could ensure the presence of
    56		 * a physical PMU and CONFIG_PERF_EVENT is selected.
    57		 */
  > 58		if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
    59			static_branch_enable(&kvm_arm_pmu_available);
    60	
    61		return perf_register_guest_info_callbacks(&kvm_guest_cbs);
    62	}
    63	

---
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: 40412 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
  2021-03-26 12:27 arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' kernel test robot
@ 2021-04-13 20:00 ` Nathan Chancellor
  2021-04-14 10:12   ` Marc Zyngier
  2021-04-14 10:16   ` Alexandru Elisei
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-04-13 20:00 UTC (permalink / raw)
  To: kernel test robot
  Cc: Marc Zyngier, kbuild-all, clang-built-linux, linux-kernel,
	Paolo Bonzini, Alexandru Elisei

On Fri, Mar 26, 2021 at 08:27:13PM +0800, kernel test robot wrote:
> Hi Marc,
> 
> FYI, the error/warning still remains.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   db24726bfefa68c606947a86132591568a06bfb4
> commit: 6b5b368fccd7109b052e45af8ba1464c8d140a49 KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key
> date:   3 weeks ago
> config: arm64-randconfig-r005-20210326 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install arm64 cross compiling tool for clang build
>         # apt-get install binutils-aarch64-linux-gnu
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b5b368fccd7109b052e45af8ba1464c8d140a49
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 6b5b368fccd7109b052e45af8ba1464c8d140a49
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
> >> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' [-Werror,-Wimplicit-function-declaration]
>            if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>                                              ^
>    1 error generated.
> 
> 
> vim +/perf_num_counters +58 arch/arm64/kvm/perf.c
> 
>     50	
>     51	int kvm_perf_init(void)
>     52	{
>     53		/*
>     54		 * Check if HW_PERF_EVENTS are supported by checking the number of
>     55		 * hardware performance counters. This could ensure the presence of
>     56		 * a physical PMU and CONFIG_PERF_EVENT is selected.
>     57		 */
>   > 58		if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>     59			static_branch_enable(&kvm_arm_pmu_available);
>     60	
>     61		return perf_register_guest_info_callbacks(&kvm_guest_cbs);
>     62	}
>     63	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

I just ran into this again. It is not a clang specific issue, it
reproduces quite easily with arm64 defconfig minus CONFIG_PERF_EVENTS
and gcc 10.3.0:

arch/arm64/kvm/perf.c: In function 'kvm_perf_init':
arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function
'perf_num_counters'; did you mean 'dec_mm_counter'?
[-Werror=implicit-function-declaration]
   58 |  if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
      |                                    ^~~~~~~~~~~~~~~~~
      |                                    dec_mm_counter
cc1: some warnings being treated as errors

I am not sure what the cleanest solution would be for providing a static
inline version of perf_num_counters() would be, as only arm64 actually
uses it (sh and s390 define it but it does not appear to be used) but it
is only available through CONFIG_ARM_PMU instead of just
CONFIG_PERF_EVENTS like the other two architectures mentioned above.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
  2021-04-13 20:00 ` Nathan Chancellor
@ 2021-04-14 10:12   ` Marc Zyngier
  2021-04-14 10:16   ` Alexandru Elisei
  1 sibling, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2021-04-14 10:12 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, kbuild-all, clang-built-linux, linux-kernel,
	Paolo Bonzini, Alexandru Elisei

On Tue, 13 Apr 2021 21:00:57 +0100,
Nathan Chancellor <nathan@kernel.org> wrote:

[...]

> I just ran into this again. It is not a clang specific issue, it
> reproduces quite easily with arm64 defconfig minus CONFIG_PERF_EVENTS
> and gcc 10.3.0:
> 
> arch/arm64/kvm/perf.c: In function 'kvm_perf_init':
> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function
> 'perf_num_counters'; did you mean 'dec_mm_counter'?
> [-Werror=implicit-function-declaration]
>    58 |  if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>       |                                    ^~~~~~~~~~~~~~~~~
>       |                                    dec_mm_counter
> cc1: some warnings being treated as errors
> 
> I am not sure what the cleanest solution would be for providing a static
> inline version of perf_num_counters() would be, as only arm64 actually
> uses it (sh and s390 define it but it does not appear to be used) but it
> is only available through CONFIG_ARM_PMU instead of just
> CONFIG_PERF_EVENTS like the other two architectures mentioned above.

As you point out, KVM/arm64 is the only user of perf_num_counters()
across the whole kernel. The whole oprofile subsystem has been
removed, so maybe a a bigger cleanup is in order.

I'll post something shortly.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
  2021-04-13 20:00 ` Nathan Chancellor
  2021-04-14 10:12   ` Marc Zyngier
@ 2021-04-14 10:16   ` Alexandru Elisei
  1 sibling, 0 replies; 5+ messages in thread
From: Alexandru Elisei @ 2021-04-14 10:16 UTC (permalink / raw)
  To: Nathan Chancellor, kernel test robot
  Cc: Marc Zyngier, kbuild-all, clang-built-linux, linux-kernel, Paolo Bonzini

Hi,

On 4/13/21 9:00 PM, Nathan Chancellor wrote:
> On Fri, Mar 26, 2021 at 08:27:13PM +0800, kernel test robot wrote:
>> Hi Marc,
>>
>> FYI, the error/warning still remains.
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   db24726bfefa68c606947a86132591568a06bfb4
>> commit: 6b5b368fccd7109b052e45af8ba1464c8d140a49 KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key
>> date:   3 weeks ago
>> config: arm64-randconfig-r005-20210326 (attached as .config)
>> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
>> reproduce (this is a W=1 build):
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # install arm64 cross compiling tool for clang build
>>         # apt-get install binutils-aarch64-linux-gnu
>>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b5b368fccd7109b052e45af8ba1464c8d140a49
>>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>>         git fetch --no-tags linus master
>>         git checkout 6b5b368fccd7109b052e45af8ba1464c8d140a49
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>):
>>
>>>> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' [-Werror,-Wimplicit-function-declaration]
>>            if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>>                                              ^
>>    1 error generated.
>>
>>
>> vim +/perf_num_counters +58 arch/arm64/kvm/perf.c
>>
>>     50	
>>     51	int kvm_perf_init(void)
>>     52	{
>>     53		/*
>>     54		 * Check if HW_PERF_EVENTS are supported by checking the number of
>>     55		 * hardware performance counters. This could ensure the presence of
>>     56		 * a physical PMU and CONFIG_PERF_EVENT is selected.
>>     57		 */
>>   > 58		if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>>     59			static_branch_enable(&kvm_arm_pmu_available);
>>     60	
>>     61		return perf_register_guest_info_callbacks(&kvm_guest_cbs);
>>     62	}
>>     63	
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> I just ran into this again. It is not a clang specific issue, it
> reproduces quite easily with arm64 defconfig minus CONFIG_PERF_EVENTS
> and gcc 10.3.0:
>
> arch/arm64/kvm/perf.c: In function 'kvm_perf_init':
> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function
> 'perf_num_counters'; did you mean 'dec_mm_counter'?
> [-Werror=implicit-function-declaration]
>    58 |  if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
>       |                                    ^~~~~~~~~~~~~~~~~
>       |                                    dec_mm_counter
> cc1: some warnings being treated as errors

I was also able to reproduce it with gcc 10.2.0. I think the problem is that the
perf_num_counters() declaration is guarded by CONFIG_PERF_EVENTS (in
include/linux/perf_event.h), the implementation is in drivers/perf/arm_pmu.c,
which depends on CONFIG_ARM_PMU, but CONFIG_ARM_PMU=y doesn't select
CONFIG_PERF_EVENTS. So we end up in a situation where we have the implementation
of perf_num_counters(), but no prototype (CONFIG_ARM_PMU=y, CONFIG_PERF_EVENTS is
not set).

Thanks,

Alex

>
> I am not sure what the cleanest solution would be for providing a static
> inline version of perf_num_counters() would be, as only arm64 actually
> uses it (sh and s390 define it but it does not appear to be used) but it
> is only available through CONFIG_ARM_PMU instead of just
> CONFIG_PERF_EVENTS like the other two architectures mentioned above.
>
> Cheers,
> Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
@ 2021-03-26  3:54 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-03-26  3:54 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kbuild-all, clang-built-linux, linux-kernel, Paolo Bonzini,
	Alexandru Elisei

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   db24726bfefa68c606947a86132591568a06bfb4
commit: 6b5b368fccd7109b052e45af8ba1464c8d140a49 KVM: arm64: Turn kvm_arm_support_pmu_v3() into a static key
date:   3 weeks ago
config: arm64-randconfig-r005-20210326 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b5b368fccd7109b052e45af8ba1464c8d140a49
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 6b5b368fccd7109b052e45af8ba1464c8d140a49
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

>> arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' [-Werror,-Wimplicit-function-declaration]
           if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
                                             ^
   1 error generated.


vim +/perf_num_counters +58 arch/arm64/kvm/perf.c

    50	
    51	int kvm_perf_init(void)
    52	{
    53		/*
    54		 * Check if HW_PERF_EVENTS are supported by checking the number of
    55		 * hardware performance counters. This could ensure the presence of
    56		 * a physical PMU and CONFIG_PERF_EVENT is selected.
    57		 */
  > 58		if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
    59			static_branch_enable(&kvm_arm_pmu_available);
    60	
    61		return perf_register_guest_info_callbacks(&kvm_guest_cbs);
    62	}
    63	

---
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: 40412 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14 10:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 12:27 arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters' kernel test robot
2021-04-13 20:00 ` Nathan Chancellor
2021-04-14 10:12   ` Marc Zyngier
2021-04-14 10:16   ` Alexandru Elisei
  -- strict thread matches above, loose matches on Subject: below --
2021-03-26  3:54 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).