All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: linux-perf-users@vger.kernel.org
Subject: Re: perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect
Date: Mon, 30 Jul 2012 13:04:15 -0700	[thread overview]
Message-ID: <m2pq7d9fsw.fsf@firstfloor.org> (raw)
In-Reply-To: 20120727115351.GA4514@gmail.com

Ingo Molnar <mingo@kernel.org> writes:

> * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>
>> > It also allows system-wide profiling after you've modified a 
>> > library to self-profile, while your suggestion does not 
>> > allow that.
>> 
>> But its no long self-profiling when some other process is 
>> involved. And system wide is definitely not self.
>
> If I'm a library developer and want to self-profile my 
> modifications, then it's entirely appropriate to do a 
> system-wide profile to see the system-wide use of this library!
>
> System-wide and self-profiling is not exclusive. Think of it as 
> a narrow, precise filter applied to a given area of 
> functionality only.
>
> AFAICS the alternative, under your method, would be to recompile 
> every single app in the system - that's cumbersome beyond 
> imagination, I wouldn't even call it a solution, let alone a 
> quality implementation.
>
>> > > It really isn't that hard to make userspace do what is 
>> > > needed, it just takes a bit of work.
>> > 
>> > Even if your suggested solution was available (it isn't), my 
>> > suggested approach is easier to use and covers more 
>> > usecases.
>> > 
>> > User-space expecting the kernel to provide usable and 
>> > minimal interfaces is not 'being silly'. It's the 
>> > fundamental task of a kernel to provide them.
>> 
>> Bloating the interface for something that is already well 
>> possible is.
>
> There's no 'bloat' worth speaking off: a single bit out of an 
> already allocated bitmap, plus a single check in an already 
> existing loop, plus a single new command-line flag to the 
> tooling side and minimal glue.

I tried it some time ago because I had a user who was very interested in
getting rid of initialization overhead in measurements.
I have a little library too to self instrument, but it's 
still a lot more work than adding a ioctl or two.

The patch is actually broken (causes occasional crashes)
and does not implement the opt in bit (but that would be easy 
to add). And it's against a quite old kernel.

Also had to do the disabling only after exec to avoid some issues.

But it worked well enough for some tests.

There are likely better ways to implement this
(or least ways that don't crash :-)
Frederic's generic contexts also sound nice.

The nice thing is that combined with some LD_PRELOAD 
tricks you can even use it with unmodified binaries.

(not a submission or anything, just FYI)

-Andi

http://firstfloor.org/~andi/perf-disabled-1


-- 
ak@linux.intel.com -- Speaking for myself only

  reply	other threads:[~2012-07-30 21:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 10:54 perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect Iegorov Oleg
2012-07-27  7:26 ` Ingo Molnar
2012-07-27  8:00   ` Peter Zijlstra
2012-07-27  8:18     ` Ingo Molnar
2012-07-27  8:29       ` Peter Zijlstra
2012-07-27 11:40         ` Iegorov Oleg
2012-07-27 11:53         ` Ingo Molnar
2012-07-30 20:04           ` Andi Kleen [this message]
2012-07-31  5:47           ` Peter Zijlstra
2012-07-31  7:16             ` Ingo Molnar
2012-07-31 19:48               ` Peter Zijlstra
2012-07-27 11:56   ` [RFD] perf: events defined contexts (was Re: perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect) Frederic Weisbecker
2012-07-27 12:45     ` Jiri Olsa
2012-08-06  1:41       ` Namhyung Kim
  -- strict thread matches above, loose matches on Subject: below --
2012-01-27 17:03 perf: prctl(PR_TASK_PERF_EVENTS_DISABLE) has no effect Andrew Steets
2012-01-27 17:12 ` Peter Zijlstra
2012-01-27 20:06   ` Andrew Steets
2012-01-27 21:34     ` Peter Zijlstra
2012-01-28 12:01 ` Ingo Molnar
2012-01-28 23:48   ` Andrew Steets
2012-01-29 16:32     ` Ingo Molnar
2012-01-29 16:32       ` Ingo Molnar
2012-01-29 17:50       ` Gleb Natapov
2012-01-30  9:52       ` Peter Zijlstra
2012-01-30 10:11         ` Ingo Molnar
2012-01-30 11:01           ` Peter Zijlstra
2012-01-30 11:31             ` Ingo Molnar
2012-01-30 13:45               ` Peter Zijlstra
2012-01-30 13:58                 ` Ingo Molnar
2012-01-30 15:30                 ` Arnaldo Carvalho de Melo
2012-01-30 15:29             ` Arnaldo Carvalho de Melo
2012-02-01 19:03           ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pq7d9fsw.fsf@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=linux-perf-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.