Re: [PATCH] scripts/ only whine perf_counter_open when supported

From: Mike Frysinger
Date: Fri Jun 12 2009 - 08:42:21 EST

On Fri, Jun 12, 2009 at 08:31, Ingo Molnar wrote:
> * Mike Frysinger <vapier.adi@xxxxxxxxx> wrote:
>> On Fri, Jun 12, 2009 at 08:17, Ingo Molnar wrote:
>> > * Mike Frysinger <vapier.adi@xxxxxxxxx> wrote:
>> >> On Fri, Jun 12, 2009 at 08:05, Ingo Molnar wrote:
>> >> > * Mike Frysinger <vapier@xxxxxxxxxx> wrote:
>> >> >> If the port does not support HAVE_PERF_COUNTERS, then they can't
>> >> >> support the perf_counter_open syscall either. ÂRather than forcing
>> >> >> everyone to add an ignore (or suffer the warning until they get
>> >> >> around to implementing support), only whine about the syscall when
>> >> >> applicable.
>> >> >
>> >> > No, this patch is wrong - it's really easy to add support: just hook
>> >> > up the syscall. This should happen for every architecture really, so
>> >> > the warning is correct and it should not be patched out.
>> >> >
>> >> > PMU support is not required to get perfcounters support: if an
>> >> > architecture hooks up the syscall it will get generic software
>> >> > counters and the tools will work as well.
>> >> >
>> >> > Profiling falls back to a hrtimer-based sampling method - this is a
>> >> > much better fallback than oprofile's fall-back to the timer tick.
>> >> > This hrtimer based sampling is dynticks/nohz-correct and can go
>> >> > beyond HZ if the architecture supports hrtimers.
>> >>
>> >> if there is generic support available, why must every arch select
>> >> HAVE_PERF_COUNTERS in their Kconfig ?
>> >
>> > Because we only want to enable it on architectures that have tested
>> > it. It should only need a syscall addition, but nothing beats having
>> > tested things, hence we have that additional Kconfig symbol.
>> that is a pretty weak reason. [...]
> It isnt - this is proper isolation - dont offer something to the
> user to enable that 1) cannot be used due to the lack of a syscall
> 2) has not been tested by anyone on that architecture, ever.
> That way say build breakages or runtime failures due to perfcounters
> only become possible on an architecture if the architecture
> maintainer has hooked up the syscall and has provided
> HAVE_PERF_COUNTERS explicitly.

except that the syscall presence is trivial to detect in the code by
something like:
#ifndef __NR_perf_counter_open
# error sorry, your arch has not hooked up perf_counter_open syscall yet

as for "no arch testing yet", there are plenty of drivers which lack
arch depends in the Kconfig specifically so that it can be *easily*
tested on random systems out there without requiring manual twiddling.
having it not build on an arch results in someone noticing and things
getting fixed. having it not even be an option means it often times
goes largely unnoticed.

the missing syscall is obvious for arch porters -- they get a warning
on every make. the need for a useless HAVE_PERF_COUNTERS in the
Kconfig however is completely unknown because there's (yet again) 0
information on this define and what it takes for arch people to add
support for it. in this case, the define is completely spurious.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at