[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110524212925.GL27634@elte.hu>
Date: Tue, 24 May 2011 23:29:25 +0200
From: Ingo Molnar <mingo@...e.hu>
To: David Ahern <dsahern@...il.com>
Cc: Vince Weaver <vweaver1@...s.utk.edu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
linux-kernel@...r.kernel.org, paulus@...ba.org, acme@...hat.com
Subject: Re: perf: regression -- missing /sys/devices/system/cpu/perf_events
* David Ahern <dsahern@...il.com> wrote:
> On 05/24/11 14:12, Vince Weaver wrote:
> > On Tue, 24 May 2011, Ingo Molnar wrote:
> >>
> >> So, what is wrong with the method Peter suggested: the presence of the perf
> >> syscall (it not returning -ENOSYS) is bona fide evidence that perf is
> >> available.
> >
> > it's just hard to do that from a shell script.
>
> What about kallsyms:
>
> grep sys_perf_event_open /proc/kallsyms
that looks pretty roundabout and expensive - kallsyms can be large.
Nor is there a guarantee that the function will always be called
sys_perf_event_open() - we already renamed it from sys_perf_counter_open() as
you yourself mentioned it :-)
Plus the kernel can be built without /proc/kallsyms, and root can chmod off the
file permissions of /proc/kallsyms for unprivileged user-space as well. So it's
not a particularly robust check.
I agree with Vince that as far as shell scripts are concerned, checking
/proc/sys/kernel/perf_event_paranoid would work best - and it works better than
having to check the perf syscall.
Vince: mind sending a patch that adds a comment to perf_event_paranoid that
userspace relies on the existence of that file as a feature check? Having such
reminders in the code works even better than frequent testing ;-)
As far as the actual PAPI library goes i really hope it checks the syscall
itself: that's much faster and more robust than an
access("/proc/sys/kernel/perf_event_paranoid") call ...
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists