mbox series

[v2,0/7] perf: Add ioctl for PMU driver configuration

Message ID 1530828827-11604-1-git-send-email-mathieu.poirier@linaro.org
Headers show
Series perf: Add ioctl for PMU driver configuration | expand

Message

Mathieu Poirier July 5, 2018, 10:13 p.m. UTC
This set adds the capability to communiate event specific configuration
to the PMU kernel driver using an ioctl().  The functionatlity is made
generic enough for anyone to use but is targeted at the identification
of CoreSight sinks when operating in CPU-wide trace scenarios.

Other than the changes highlighted below I have moved things around,
deciding to start with the kernel portion rather than user space -
hopefully this will be easier to review.

Applies cleanly on v4.18-rc3.

Thanks,
Mathieu

---
Changes for V2:
. Fixed s390 problem reported by buildbot.
. Removed uneeded check in perf_event_process_drv_config() (Jiri)
. Reordered data copy in perf_event_set_drv_config() (Jiri)
. Went from 2 to 1 step driver configuration process (Alex)
. Moved structure name "perf_drv_config" to "pmu_drv_config".

V1: https://lkml.org/lkml/2018/7/2/1008

Mathieu Poirier (7):
  perf: Introduce ioctl to communicate driver configuration to kernel
  perf/core: Use ioctl to communicate driver configuration to kernel
  perf/aux: Make perf_event accessible to setup_aux()
  coresight: Use PMU driver configuration for sink selection
  perf tools: Use ioctl to communicate driver configuration to kernel
  perf tools: Make perf_evsel accessible to PMU driver configuration
    code
  perf tools: Use ioctl function to send sink configuration to kernel

 arch/s390/kernel/perf_cpum_sf.c                  |   6 +-
 arch/x86/events/intel/bts.c                      |   4 +-
 arch/x86/events/intel/pt.c                       |   5 +-
 drivers/hwtracing/coresight/coresight-etm-perf.c | 136 ++++++++++++++++++++---
 drivers/hwtracing/coresight/coresight-etm-perf.h |   4 +
 drivers/perf/arm_spe_pmu.c                       |   6 +-
 include/linux/perf_event.h                       |  47 +++++++-
 include/uapi/linux/perf_event.h                  |   1 +
 kernel/events/core.c                             |  77 +++++++++++++
 kernel/events/ring_buffer.c                      |   2 +-
 tools/include/uapi/linux/perf_event.h            |   1 +
 tools/perf/arch/arm/util/cs-etm.c                |  60 +++-------
 tools/perf/arch/arm/util/cs-etm.h                |   3 +-
 tools/perf/util/drv_configs.c                    |  30 ++---
 tools/perf/util/evsel.c                          |   7 ++
 tools/perf/util/evsel.h                          |   1 +
 tools/perf/util/pmu.h                            |   3 +-
 17 files changed, 300 insertions(+), 93 deletions(-)

-- 
2.7.4

Comments

Kim Phillips July 6, 2018, 11:38 p.m. UTC | #1
On Thu,  5 Jul 2018 16:13:40 -0600
Mathieu Poirier <mathieu.poirier@linaro.org> wrote:

> This set adds the capability to communiate event specific configuration

> to the PMU kernel driver using an ioctl().  The functionatlity is made

> generic enough for anyone to use but is targeted at the identification

> of CoreSight sinks when operating in CPU-wide trace scenarios.


With this series, a --per-thread -less invocation looks like it
succeeds (instead of giving a "failed to mmap with 12 (Cannot allocate
memory)" error):

# perf record -e /cs_etm/@20010000.etf/ sleep 1
[ perf record: Woken up 3 times to write data ]
Warning:
AUX data lost 2 times out of 3!

[ perf record: Captured and wrote 0.182 MB perf.data ]
# 

but now perf report - built with libopencsd - is unable to process the
perf.data file:

# perf report --stdio 
0x3a0 [0x60]: failed to process type: 1
Error:
failed to process sample
# To display the perf.data header info, please use --header/--header-only options.
#

Also, a "record -a" invocation also acts like it's working, but Juno
has a hardware limitation where it can't record all cpus concurrently,
right?  So, shouldn't record commands that exceed the h/w's
capabilities error out instead?

Thanks,

Kim
Mathieu Poirier July 9, 2018, 7:21 p.m. UTC | #2
On Fri, 6 Jul 2018 at 17:38, Kim Phillips <kim.phillips@arm.com> wrote:
>

> On Thu,  5 Jul 2018 16:13:40 -0600

> Mathieu Poirier <mathieu.poirier@linaro.org> wrote:

>

> > This set adds the capability to communiate event specific configuration

> > to the PMU kernel driver using an ioctl().  The functionatlity is made

> > generic enough for anyone to use but is targeted at the identification

> > of CoreSight sinks when operating in CPU-wide trace scenarios.

>

> With this series, a --per-thread -less invocation looks like it

> succeeds (instead of giving a "failed to mmap with 12 (Cannot allocate

> memory)" error):

>

> # perf record -e /cs_etm/@20010000.etf/ sleep 1

> [ perf record: Woken up 3 times to write data ]

> Warning:

> AUX data lost 2 times out of 3!

>

> [ perf record: Captured and wrote 0.182 MB perf.data ]

> #

>

> but now perf report - built with libopencsd - is unable to process the

> perf.data file:

>

> # perf report --stdio

> 0x3a0 [0x60]: failed to process type: 1

> Error:

> failed to process sample

> # To display the perf.data header info, please use --header/--header-only options.

> #


Right, that's expected since the perf tools patches for CPU-wide trace
scenarios haven't been merged yet.  The real problem is, as you
pointed above, that this patchset should still report an error as full
functionality isn't merged yet.  I will fix that.

>

> Also, a "record -a" invocation also acts like it's working, but Juno

> has a hardware limitation where it can't record all cpus concurrently,

> right?  So, shouldn't record commands that exceed the h/w's

> capabilities error out instead?


To be clear there is no hardware limitation preventing "record -a" to
work properly, just SW.  This patchset is the first step in addressing
the situation.

Thanks,
Mathieu

>

> Thanks,

>

> Kim