linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] perf: Introduce address range filtering
@ 2016-04-27 15:44 Alexander Shishkin
  2016-04-27 15:44 ` [PATCH v2 1/7] perf: Move set_filter() from behind EVENT_TRACING Alexander Shishkin
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Alexander Shishkin @ 2016-04-27 15:44 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thomas Gleixner, x86, Borislav Petkov, Ingo Molnar, linux-kernel,
	vince, eranian, Arnaldo Carvalho de Melo, Mathieu Poirier,
	Alexander Shishkin

Hi Peter,

Here's my third round of address range filtering support for perf.

Changes since v1 [1]:

 * got rid of the race filter syncing cross-call if favor of a restart
 sequence and
 * moved all filter synchronization to pmu::start()
 * simplified some paths and structures as a result
 * added some more comments
 * dropped "file"/"kernel" specifier from filter format
 * added a pmu attribute for those pmus that support address filtering
 * moved all PT MSR bit definitions to pt.h.

Changes since v0 [2], notably

 * split the pmu callback in two as we discussed,
 * split the filter itself into 'core' and 'hw' parts,
 * made only parent events eligible for configuring filters (children
   can still have their 'hw' portions),
 * and basically re-wrote the whole thing around that.

Newer version of Intel PT supports address-based filtering, and this
patchset adds support for it to perf core and the PT pmu driver. It
works by configuring a number of address ranges in hardware and
telling it to use these ranges to filter its traces. Similar feature
also exists in ARM Coresight ETM/PTM and it is also taken into account
in this patchset.

Firstly, userspace configures filters via an ioctl(), filters are
formatted as an ascii string. Filters may refer to addresses in object
files for userspace code or kernel addresses. The latter might be
extended in the future to support kernel modules.

For userspace filters, we scan the task's vmas to see if any of them
match the defined filters (inode+offset) and if they do, calculate
memory offsets and program them into hardware. Note that since
different tasks will have different mappings for the same object
files, supporting cpu-wide events would require special tricks to
context-switch filters for userspace code.

Also, we monitor new mmap and exec events to update (or clear) filter
configuration.

[1] http://marc.info/?l=linux-kernel&m=146125264018801
[2] http://marc.info/?l=linux-kernel&m=144984116019143

Alexander Shishkin (7):
  perf: Move set_filter() from behind EVENT_TRACING
  perf/x86/intel/pt: Move MSR bit definitions to a private header
  perf/x86/intel/pt: IP filtering register/cpuid bits
  perf: Extend perf_event_aux_ctx() to optionally iterate through more
    events
  perf: Introduce address range filtering
  perf/x86/intel/pt: Add support for address range filtering in PT
  perf: Let userspace know if pmu supports address filters

 arch/x86/events/intel/pt.c       | 181 +++++++++-
 arch/x86/events/intel/pt.h       |  62 ++++
 arch/x86/include/asm/msr-index.h |  29 +-
 include/linux/perf_event.h       |  98 ++++++
 kernel/events/core.c             | 713 ++++++++++++++++++++++++++++++++++++---
 5 files changed, 1005 insertions(+), 78 deletions(-)

-- 
2.8.0.rc3

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

end of thread, other threads:[~2016-05-05  9:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 15:44 [PATCH v2 0/7] perf: Introduce address range filtering Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 1/7] perf: Move set_filter() from behind EVENT_TRACING Alexander Shishkin
2016-05-05  9:45   ` [tip:perf/core] perf/core: Move set_filter() out of CONFIG_EVENT_TRACING tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 2/7] perf/x86/intel/pt: Move MSR bit definitions to a private header Alexander Shishkin
2016-05-05  9:45   ` [tip:perf/core] perf/x86/intel/pt: Move PT specific " tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 3/7] perf/x86/intel/pt: IP filtering register/cpuid bits Alexander Shishkin
2016-05-05  9:46   ` [tip:perf/core] perf/x86/intel/pt: Add IP filtering register/CPUID bits tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 4/7] perf: Extend perf_event_aux_ctx() to optionally iterate through more events Alexander Shishkin
2016-05-05  9:46   ` [tip:perf/core] perf/core: " tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 5/7] perf: Introduce address range filtering Alexander Shishkin
2016-04-28 17:09   ` Peter Zijlstra
2016-04-29 18:12   ` Mathieu Poirier
2016-04-30  4:59     ` Alexander Shishkin
2016-05-02 14:31       ` Mathieu Poirier
2016-05-03  8:56   ` Peter Zijlstra
2016-05-05  9:46   ` [tip:perf/core] perf/core: " tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 6/7] perf/x86/intel/pt: Add support for address range filtering in PT Alexander Shishkin
2016-05-05  9:47   ` [tip:perf/core] " tip-bot for Alexander Shishkin
2016-04-27 15:44 ` [PATCH v2 7/7] perf: Let userspace know if pmu supports address filters Alexander Shishkin
2016-05-05  9:47   ` [tip:perf/core] perf/core: Let userspace know if the PMU " tip-bot for Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).