Re: arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
From: Marc Zyngier
Date: Wed Apr 14 2021 - 06:12:41 EST
On Tue, 13 Apr 2021 21:00:57 +0100,
Nathan Chancellor <nathan@xxxxxxxxxx> 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.