public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] perf events finer grained context instrumentation / context exclusion
@ 2010-06-10  3:49 Frederic Weisbecker
  2010-06-10  3:49 ` [PATCH 1/5] perf: Provide a proper stop action for software events Frederic Weisbecker
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: Frederic Weisbecker @ 2010-06-10  3:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras, Stephane Eranian,
	Cyrill Gorcunov, Zhang Yanmin, Steven Rostedt

Here is the new version of per context exclusion, based on hooks
on irq_enter/irq_exit. I haven't observed slowdowns but I haven't
actually measured the impact.

It's pullable from:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/exclusion-3

It's against latest tip:perf/core.

Thanks.

Frederic Weisbecker (5):
  perf: Provide a proper stop action for software events
  perf: Support disable() after stop() on software events
  perf: New PERF_EVENT_STATE_PAUSED event state
  perf: Introduce task, softirq and hardirq contexts exclusion
  perf: Support for task/softirq/hardirq exclusion on tools

 arch/x86/kernel/cpu/perf_event.c |    6 +-
 include/linux/perf_event.h       |   44 +++++++-
 kernel/perf_event.c              |  232 ++++++++++++++++++++++++++++++++------
 kernel/softirq.c                 |    6 +
 kernel/trace/trace_event_perf.c  |    2 +-
 tools/perf/util/parse-events.c   |   37 +++++--
 6 files changed, 276 insertions(+), 51 deletions(-)


^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH 0/5 v3] perf events finer grained context instrumentation / context exclusion
@ 2010-06-12  7:34 Frederic Weisbecker
  2010-06-12  7:34 ` [PATCH 2/5] perf: Support disable() after stop() on software events Frederic Weisbecker
  0 siblings, 1 reply; 27+ messages in thread
From: Frederic Weisbecker @ 2010-06-12  7:34 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras, Stephane Eranian,
	Cyrill Gorcunov, Zhang Yanmin, Steven Rostedt

Hi,

In this new version, the weird hangs have been fixed. They were
due to some ACTIVE state checks that didn't handle the paused
mode.

And also comes a new pmu->reserve callback to schedule an event
on the cpu without actually starting it (as if ->stop() was
just called in it).
In x86 it is the same than the enable() callback, the decision
to activate the event beeing eventually handled by checking the
PERF_EVENT_STATE_PAUSED. On software events it is a stub as
they can be activated anytime in a lightweight fashion, without
the need to fight against a finite resource.

BTW, there is a quite handy way to make a diff between task
context and task + irq context profiling.

Just run:

sudo ./perf stat -r 10 -e task-clock -e task-clock:t -e cs -e cs:t \
	-e migrations -e migrations:t -e faults -e faults:t -e cycles \
	-e cycles:t -e instructions -e instructions:t -e branches \
	-e branches:t -e branch-misses -e branch-misses:t taskset 1 hackbench 1

(Did I just say handy?)

Example of result:

 Performance counter stats for 'taskset 1 hackbench 1' (10 runs):

         604,727182  task-clock-msecs         #      0,969 CPUs    ( +-   6,176% )
         604,727182  task-clock-msecs         #      0,969 CPUs    ( +-   6,176% )
              11584  context-switches         #      0,019 M/sec   ( +-  26,945% )
              11593  context-switches         #      0,019 M/sec   ( +-  26,909% )
                  1  CPU-migrations           #      0,000 M/sec   ( +-  61,464% )
                  0  CPU-migrations           #      0,000 M/sec   ( +- 100,000% )
               1844  page-faults              #      0,003 M/sec   ( +-   1,425% )
               1847  page-faults              #      0,003 M/sec   ( +-   1,423% )
          917442262  cycles                   #   1517,118 M/sec   ( +-   6,814% )  (scaled from 69,40%)
          908980892  cycles                   #   1503,126 M/sec   ( +-   5,807% )  (scaled from 68,51%)
          335812687  instructions             #      0,368 IPC     ( +-   6,977% )  (scaled from 73,77%)
          321284628  instructions             #      0,352 IPC     ( +-   6,377% )  (scaled from 20,59%)
           48956776  branches                 #     80,957 M/sec   ( +-   5,936% )  (scaled from 22,67%)
           48144741  branches                 #     79,614 M/sec   ( +-   6,480% )  (scaled from 21,68%)
            2310259  branch-misses            #      4,758 %       ( +-   9,698% )  (scaled from 15,11%)
            2200507  branch-misses            #      4,532 %       ( +-   9,294% )  (scaled from 15,35%)

        0,624082951  seconds time elapsed   ( +-   5,939% )


Most of the time, the instruction counter diff shows that irqs take 0.01% of noise
with hackbench. Something that does more IO would probably be a more
interesting example.

The thing is pullable there:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/exclusion-4

Thanks.


Frederic Weisbecker (5):
  perf: Provide a proper stop action for software events
  perf: Support disable() after stop() on software events
  perf: Ability to enable in a paused mode
  perf: Introduce task, softirq and hardirq contexts exclusion
  perf: Support for task/softirq/hardirq exclusion on tools

 arch/x86/kernel/cpu/perf_event.c |    7 +-
 include/linux/perf_event.h       |   52 ++++++++-
 kernel/hw_breakpoint.c           |    1 +
 kernel/perf_event.c              |  257 +++++++++++++++++++++++++++++++-------
 kernel/softirq.c                 |    6 +
 kernel/trace/trace_event_perf.c  |    2 +-
 tools/perf/util/parse-events.c   |   37 ++++--
 7 files changed, 302 insertions(+), 60 deletions(-)


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

end of thread, other threads:[~2010-06-12  7:35 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10  3:49 [PATCH 0/5] perf events finer grained context instrumentation / context exclusion Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 1/5] perf: Provide a proper stop action for software events Frederic Weisbecker
2010-06-10 10:46   ` Peter Zijlstra
2010-06-10 11:10     ` Peter Zijlstra
2010-06-10 16:12       ` Frederic Weisbecker
2010-06-10 16:16         ` Peter Zijlstra
2010-06-10 16:29           ` Frederic Weisbecker
2010-06-10 16:38             ` Peter Zijlstra
2010-06-10 17:04               ` Frederic Weisbecker
2010-06-10 19:54           ` Frederic Weisbecker
2010-06-10 12:06     ` Ingo Molnar
2010-06-10  3:49 ` [PATCH 2/5] perf: Support disable() after stop() on " Frederic Weisbecker
2010-06-10 10:50   ` Peter Zijlstra
2010-06-10 16:31     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 3/5] perf: New PERF_EVENT_STATE_PAUSED event state Frederic Weisbecker
2010-06-10 10:55   ` Peter Zijlstra
2010-06-10 16:26     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 4/5] perf: Introduce task, softirq and hardirq contexts exclusion Frederic Weisbecker
2010-06-10 11:01   ` Peter Zijlstra
2010-06-10 16:24     ` Frederic Weisbecker
2010-06-10  3:49 ` [PATCH 5/5] perf: Support for task/softirq/hardirq exclusion on tools Frederic Weisbecker
2010-06-10  6:26 ` [PATCH 0/5] perf events finer grained context instrumentation / context exclusion Ingo Molnar
2010-06-10  7:15   ` Frederic Weisbecker
2010-06-10  7:31   ` Frederic Weisbecker
2010-06-10 10:16     ` Ingo Molnar
2010-06-10 17:03       ` Frederic Weisbecker
  -- strict thread matches above, loose matches on Subject: below --
2010-06-12  7:34 [PATCH 0/5 v3] " Frederic Weisbecker
2010-06-12  7:34 ` [PATCH 2/5] perf: Support disable() after stop() on software events Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox