public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] perf, persistent: Kernel updates for perf tool integration
@ 2013-05-31  8:47 Robert Richter
  2013-05-31  8:47 ` [PATCH 01/16] perf, persistent: Fix build error for no-tracepoints configs Robert Richter
                   ` (16 more replies)
  0 siblings, 17 replies; 33+ messages in thread
From: Robert Richter @ 2013-05-31  8:47 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Ingo Molnar, Peter Zijlstra, Arnaldo Carvalho de Melo,
	linux-kernel, Robert Richter

From: Robert Richter <robert.richter@calxeda.com>

This patch set implements out of the box support of perf tools for
persistent events. For this the kernel must provide necessary
information about existing persistent events via sysfs to userland.
Persistent events are provided by the kernel with readonly event
buffers. To allow the independent usage of the event buffers by any
process without limiting other processes, multiple users of a single
event must be handled too.

The basic concept is to use a pmu as an event container for persistent
events. The pmu registers events in sysfs and provides format and
event information for the userland. The persistent event framework
requires to add events to the pmu dynamically.

With the information in sysfs userland knows about how to setup the
perf_event attribute of a persistent event. Since a persistent event
always has the persistent flag set, a way is needed to express this in
sysfs. A new syntax is used for this. With 'attr<num>:<mask>' any bit
in the attribute structure may be set in a similar way as using
'config<num>', but <num> is an index that points to the u64 value to
change within the attribute.

For persistent events the persistent flag (bit 23 of flag field in
struct perf_event_attr) needs to be set which is expressed in sysfs
with "attr5:23". E.g. the mce_record event is described in sysfs as
follows:

 /sys/bus/event_source/devices/persistent/events/mce_record:persistent,config=106
 /sys/bus/event_source/devices/persistent/format/persistent:attr5:23

Note that perf tools need to support the 'attr<num>' syntax that is
added in a separate patch set. With it we are able to run perf tool
commands to read persistent events, e.g.:

 # perf record -e persistent/mce_record/ sleep 10
 # perf top -e persistent/mce_record/

In general the new syntax is flexible to describe with sysfs any event
to be setup by perf tools.

First patches contain also fixes and reworks made after reviewing
code. Could be applied separately.

Patches base on Boris' patches which I have rebased to latest
tip/perf/core. All patches can be found here:

 git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git persistent

-Robert



Robert Richter (16):
  perf, persistent: Fix build error for no-tracepoints configs
  perf, persistent: Fix attr size
  perf, persistent: Setting default buffer size to 512k as in perf tools
  perf, persistent: Print error code on failure when adding events
  perf, persistent: Return resonable error code
  perf, persistent: Return -EACCES if mapped buffers must be readonly
  perf, persistent: Rework struct pers_event_desc
  perf, persistent: Remove rb_put()
  perf, persistent: Introduce get_persistent_event()
  perf, persistent: Reworking perf_get_persistent_event_fd()
  perf, persistent: Protect event lists with mutex
  perf, persistent: Avoid adding identical events
  perf, persistent: Implementing a persistent pmu
  perf, persistent: Name each persistent event
  perf, persistent: Exposing persistent events using sysfs
  perf, persistent: Allow multiple users for an event

 arch/x86/kernel/cpu/mcheck/mce.c |   7 +-
 include/linux/perf_event.h       |  11 +-
 kernel/events/core.c             |   6 +-
 kernel/events/internal.h         |   1 -
 kernel/events/persistent.c       | 292 +++++++++++++++++++++++++++++----------
 5 files changed, 229 insertions(+), 88 deletions(-)

-- 
1.8.1.1


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

end of thread, other threads:[~2013-06-07 13:47 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31  8:47 [PATCH 00/16] perf, persistent: Kernel updates for perf tool integration Robert Richter
2013-05-31  8:47 ` [PATCH 01/16] perf, persistent: Fix build error for no-tracepoints configs Robert Richter
2013-05-31  9:05   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 02/16] perf, persistent: Fix attr size Robert Richter
2013-05-31  9:05   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 03/16] perf, persistent: Setting default buffer size to 512k as in perf tools Robert Richter
2013-05-31  9:07   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 04/16] perf, persistent: Print error code on failure when adding events Robert Richter
2013-05-31  9:10   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 05/16] perf, persistent: Return resonable error code Robert Richter
2013-05-31  9:11   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 06/16] perf, persistent: Return -EACCES if mapped buffers must be readonly Robert Richter
2013-05-31  9:12   ` Borislav Petkov
2013-05-31  8:47 ` [PATCH 07/16] perf, persistent: Rework struct pers_event_desc Robert Richter
2013-05-31  8:47 ` [PATCH 08/16] perf, persistent: Remove rb_put() Robert Richter
2013-05-31  8:47 ` [PATCH 09/16] perf, persistent: Introduce get_persistent_event() Robert Richter
2013-05-31  8:47 ` [PATCH 10/16] perf, persistent: Reworking perf_get_persistent_event_fd() Robert Richter
2013-05-31  8:47 ` [PATCH 11/16] perf, persistent: Protect event lists with mutex Robert Richter
2013-05-31  8:47 ` [PATCH 12/16] perf, persistent: Avoid adding identical events Robert Richter
2013-05-31  8:47 ` [PATCH 13/16] perf, persistent: Implementing a persistent pmu Robert Richter
2013-05-31  8:47 ` [PATCH 14/16] perf, persistent: Name each persistent event Robert Richter
2013-05-31  8:47 ` [PATCH 15/16] perf, persistent: Exposing persistent events using sysfs Robert Richter
2013-05-31  8:47 ` [PATCH 16/16] perf, persistent: Allow multiple users for an event Robert Richter
2013-06-03 13:49   ` Jiri Olsa
2013-06-04  8:20     ` Borislav Petkov
2013-06-04  9:19       ` Jiri Olsa
2013-06-04  9:35         ` Borislav Petkov
2013-06-07 13:47           ` Robert Richter
2013-05-31  9:15 ` [PATCH 00/16] perf, persistent: Kernel updates for perf tool integration Borislav Petkov
2013-05-31  9:32   ` Robert Richter
2013-05-31 12:21     ` Borislav Petkov
2013-06-01 16:15       ` Robert Richter
2013-06-02  7:29         ` Borislav Petkov

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