All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/27] coresight: TMC ETR backend support for perf
@ 2018-05-01  9:10 ` Suzuki K Poulose
  0 siblings, 0 replies; 134+ messages in thread
From: Suzuki K Poulose @ 2018-05-01  9:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, mathieu.poirier, mike.leach, robert.walker,
	mark.rutland, will.deacon, robin.murphy, sudeep.holla,
	frowand.list, robh, john.horley, Suzuki K Poulose


This series achieves two goals :

 a) Support for all possible backends in ETR buffer and
    transparent management of the buffer irrespective of the
    backend in use.
 b) Adds support for perf using ETR as a sink, using the
    best possible backend.

For (a), we add support TMC ETR in-built scatter gather unit and
the new dedicated scatter-gather component, Coresight Address
Translation Unit (CATU) - new IP, part of the Arm Coresight SoC-600
family to provide improved SG mechanism.

With the addition of CATU, we could operate the ETR in 3 possible
combinations of buffers.

 1) Contiguous DMA buffer
 2) TMC-ETR built-in Scatter Gather table
 3) CATU backed scatter gather table.

To avoid the complications of the managing the buffer, this series
adds a layer for managing the ETR buffer, which makes the best possibly
choice based on what is available. The allocation can be tuned by passing
in flags, existing pages (e.g, perf ring buffer) etc.

Towards supporting ETR Scatter Gather mode and CATU tables, we introduce
a generic TMC scatter-gather table which can be used to manage the data
and table pages. The table can be filled in the respective mode (CATU
vs ETR_SG) by the mode specific code.

During the testing of v1 of the ETR SG driver, we found out that a couple
of the boards (Hikey 960 and DB410c. Juno is fine) have an unusable
Scatter-Gather mode. In SG mode the ETR performs both READs
(for next table pointer) and WRITEs (the trace data) simultaneously.
So if the READ transaction doesn't complete (which is what we
have observed), that could hold up the ETR from writing the data
as it doesn't know the buffer address and hence stalling it. This
has also been confirmed by reading the buffer data via RRD for the
ETR, which implies that there are some issues with the READ transactions
from the ETR. Juno is the only platform we have tested the SG mode
successfully. So, in order to avoid causing problems by using SG mode,
we disable the SG mode by default on all platforms unless it is known
to be safe. We add a DT bindings for white listing an ETR for scatter
gather mode.

The TMC ETR-SG mechanism doesn't allow starting the trace at non-zero
offset (required by perf). So we make some tricky changes to the table
at run time to allow starting at any "Page aligned" offset and then
wrap around to the beginning of the buffer with very less overhead.
See patches for more description.

The series also improves the way the ETR is controlled by different modes
(sysfs vs. perf) by keeping mode specific data. This allows access
to the trace data collected in sysfs mode, even when the ETR is
operated in perf mode. Also with the transparent management of the
buffer and scatter-gather mechanism, we can allow the user to
request for larger trace buffers for sysfs mode. This is supported
by providing a sysfs file, "buffer_size" which accepts a page aligned
size, which will be used by the ETR when allocating a buffer.

Finally, it cleans up the etm perf sink callbacks a little bit and
then adds the support for ETR sink. For the ETR, we try our best to
use the perf ring buffer as the target hardware buffer, provided :
 1) The ETR is dma coherent (since the pages will be shared with
    userspace perf tool).
 2) The perf is used in snapshot mode (The ETR cannot be stopped
    based on the size of the data written hence we could easily
    overwrite the buffer. We may be able to fix this in the future)
 3) The ETR supports one of the Scatter-Gather modes (in-built SG
    or a CATU).

TODO: The conditions above need some discussion. Please see the
last patch for more information.

If we can't use the perf buffers directly, we fallback to using
software buffering where we have to copy the trace data back
to the perf ring buffer.

Tested on Juno, an FPGA platform with CATU.

Applies on 4.17-rc3 and is also available at :

	git://linux-arm.org/linux-skp.git etr-perf-catu/v2

Changes since V1 :
 [ http://lists.infradead.org/pipermail/linux-arm-kernel/2017-October/538151.html ]

 - Address comments on v1
 - Fix build failure on arm32
 - Add CATU (Coresight Address Translation Unit) support.
 - Provide buffer isolation. i.e hide the buffer consumed by userspace from
   the ETR when using ETR SG or CATU
 - Add device-tree bindings to allow usage of ETR scatter-gather mode.


Suzuki K Poulose (27):
  coresight: ETM: Add support for ARM Cortex-A73
  coresight: Cleanup device subtype struct
  coresight: Add helper device type
  coresight: Introduce support for Coresight Addrss Translation Unit
  dts: bindings: Document device tree binding for CATU
  coresight: tmc etr: Disallow perf mode temporarily
  coresight: tmc: Hide trace buffer handling for file read
  coresight: tmc-etr: Do not clean trace buffer
  coresight: Add helper for inserting synchronization packets
  dts: bindings: Restrict coresight tmc-etr scatter-gather mode
  dts: juno: Add scatter-gather support for all revisions
  coresight: tmc-etr: Allow commandline option to override SG use
  coresight: Add generic TMC sg table framework
  coresight: Add support for TMC ETR SG unit
  coresight: tmc-etr: Make SG table circular
  coresight: tmc-etr: Add transparent buffer management
  coresight: etr: Add support for save restore buffers
  coresight: catu: Add support for scatter gather tables
  coresight: catu: Plug in CATU as a backend for ETR buffer
  coresight: tmc: Add configuration support for trace buffer size
  coresight: Convert driver messages to dev_dbg
  coresight: tmc-etr: Track if the device is coherent
  coresight: tmc-etr: Handle driver mode specific ETR buffers
  coresight: tmc-etr: Relax collection of trace from sysfs mode
  coresight: etr_buf: Add helper for padding an area of trace data
  coresight: perf: Remove reset_buffer call back for sinks
  coresight: etm-perf: Add support for ETR backend

 .../ABI/testing/sysfs-bus-coresight-devices-tmc    |    8 
 Documentation/admin-guide/kernel-parameters.txt    |    8 +
 .../devicetree/bindings/arm/coresight.txt          |   55 +
 arch/arm64/boot/dts/arm/juno-base.dtsi             |    1 +
 drivers/hwtracing/coresight/Kconfig                |   10 +
 drivers/hwtracing/coresight/Makefile               |    1 +
 drivers/hwtracing/coresight/coresight-catu.c       |  785 +++++++++
 drivers/hwtracing/coresight/coresight-catu.h       |  119 ++
 .../coresight/coresight-dynamic-replicator.c       |    4 +-
 drivers/hwtracing/coresight/coresight-etb10.c      |   74 +-
 drivers/hwtracing/coresight/coresight-etm-perf.c   |    9 +-
 drivers/hwtracing/coresight/coresight-etm3x.c      |    4 +-
 drivers/hwtracing/coresight/coresight-etm4x.c      |   28 +-
 drivers/hwtracing/coresight/coresight-funnel.c     |    4 +-
 drivers/hwtracing/coresight/coresight-priv.h       |   10 +-
 drivers/hwtracing/coresight/coresight-replicator.c |    4 +-
 drivers/hwtracing/coresight/coresight-stm.c        |    4 +-
 drivers/hwtracing/coresight/coresight-tmc-etf.c    |  111 +-
 drivers/hwtracing/coresight/coresight-tmc-etr.c    | 1767 ++++++++++++++++++--
 drivers/hwtracing/coresight/coresight-tmc.c        |   94 +-
 drivers/hwtracing/coresight/coresight-tmc.h        |  160 +-
 drivers/hwtracing/coresight/coresight-tpiu.c       |    4 +-
 drivers/hwtracing/coresight/coresight.c            |   49 +-
 include/linux/coresight.h                          |   51 +-
 24 files changed, 3065 insertions(+), 299 deletions(-)
 create mode 100644 drivers/hwtracing/coresight/coresight-catu.c
 create mode 100644 drivers/hwtracing/coresight/coresight-catu.h

-- 
2.7.4

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

end of thread, other threads:[~2018-05-14 14:42 UTC | newest]

Thread overview: 134+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01  9:10 [PATCH v2 00/27] coresight: TMC ETR backend support for perf Suzuki K Poulose
2018-05-01  9:10 ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 01/27] coresight: ETM: Add support for ARM Cortex-A73 Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 02/27] coresight: Cleanup device subtype struct Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 03/27] coresight: Add helper device type Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-03 17:00   ` Mathieu Poirier
2018-05-03 17:00     ` Mathieu Poirier
2018-05-05  9:56     ` Suzuki K Poulose
2018-05-05  9:56       ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 04/27] coresight: Introduce support for Coresight Addrss Translation Unit Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-03 17:31   ` Mathieu Poirier
2018-05-03 17:31     ` Mathieu Poirier
2018-05-03 20:25     ` Mathieu Poirier
2018-05-03 20:25       ` Mathieu Poirier
2018-05-05 10:03       ` Suzuki K Poulose
2018-05-05 10:03         ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 05/27] dts: bindings: Document device tree binding for CATU Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01 13:10   ` Rob Herring
2018-05-01 13:10     ` Rob Herring
2018-05-03 17:42     ` Mathieu Poirier
2018-05-03 17:42       ` Mathieu Poirier
2018-05-08 15:40       ` Suzuki K Poulose
2018-05-08 15:40         ` Suzuki K Poulose
2018-05-11 16:05         ` Rob Herring
2018-05-11 16:05           ` Rob Herring
2018-05-14 14:42           ` Mathieu Poirier
2018-05-14 14:42             ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 06/27] coresight: tmc etr: Disallow perf mode temporarily Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 07/27] coresight: tmc: Hide trace buffer handling for file read Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-03 19:50   ` Mathieu Poirier
2018-05-03 19:50     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 08/27] coresight: tmc-etr: Do not clean trace buffer Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 09/27] coresight: Add helper for inserting synchronization packets Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 10/27] dts: bindings: Restrict coresight tmc-etr scatter-gather mode Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01 13:13   ` Rob Herring
2018-05-01 13:13     ` Rob Herring
2018-05-03 20:32     ` Mathieu Poirier
2018-05-03 20:32       ` Mathieu Poirier
2018-05-04 22:56       ` Rob Herring
2018-05-04 22:56         ` Rob Herring
2018-05-08 15:48         ` Suzuki K Poulose
2018-05-08 15:48           ` Suzuki K Poulose
2018-05-08 17:34           ` Rob Herring
2018-05-08 17:34             ` Rob Herring
2018-05-01  9:10 ` [PATCH v2 11/27] dts: juno: Add scatter-gather support for all revisions Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 12/27] coresight: tmc-etr: Allow commandline option to override SG use Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-03 20:40   ` Mathieu Poirier
2018-05-03 20:40     ` Mathieu Poirier
2018-05-08 15:49     ` Suzuki K Poulose
2018-05-08 15:49       ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 13/27] coresight: Add generic TMC sg table framework Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-04 17:35   ` Mathieu Poirier
2018-05-04 17:35     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 14/27] coresight: Add support for TMC ETR SG unit Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 15/27] coresight: tmc-etr: Make SG table circular Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 16/27] coresight: tmc-etr: Add transparent buffer management Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-07 17:20   ` Mathieu Poirier
2018-05-07 17:20     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 17/27] coresight: etr: Add support for save restore buffers Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-07 17:48   ` Mathieu Poirier
2018-05-07 17:48     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 18/27] coresight: catu: Add support for scatter gather tables Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-07 20:25   ` Mathieu Poirier
2018-05-07 20:25     ` Mathieu Poirier
2018-05-08 15:56     ` Suzuki K Poulose
2018-05-08 15:56       ` Suzuki K Poulose
2018-05-08 16:13       ` Mathieu Poirier
2018-05-08 16:13         ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 19/27] coresight: catu: Plug in CATU as a backend for ETR buffer Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-07 22:02   ` Mathieu Poirier
2018-05-07 22:02     ` Mathieu Poirier
2018-05-08 16:21     ` Suzuki K Poulose
2018-05-08 16:21       ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 20/27] coresight: tmc: Add configuration support for trace buffer size Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 21/27] coresight: Convert driver messages to dev_dbg Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-02  3:55   ` Kim Phillips
2018-05-02  3:55     ` Kim Phillips
2018-05-02  8:25     ` Robert Walker
2018-05-02  8:25       ` Robert Walker
2018-05-02 13:52     ` Robin Murphy
2018-05-02 13:52       ` Robin Murphy
2018-05-10 13:36       ` Suzuki K Poulose
2018-05-10 13:36         ` Suzuki K Poulose
2018-05-07 22:28   ` Mathieu Poirier
2018-05-07 22:28     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 22/27] coresight: tmc-etr: Track if the device is coherent Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 23/27] coresight: tmc-etr: Handle driver mode specific ETR buffers Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-08 17:18   ` Mathieu Poirier
2018-05-08 17:18     ` Mathieu Poirier
2018-05-08 21:51     ` Suzuki K Poulose
2018-05-08 21:51       ` Suzuki K Poulose
2018-05-09 17:12       ` Mathieu Poirier
2018-05-09 17:12         ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 24/27] coresight: tmc-etr: Relax collection of trace from sysfs mode Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-07 22:54   ` Mathieu Poirier
2018-05-07 22:54     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 25/27] coresight: etr_buf: Add helper for padding an area of trace data Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-08 17:34   ` Mathieu Poirier
2018-05-08 17:34     ` Mathieu Poirier
2018-05-01  9:10 ` [PATCH v2 26/27] coresight: perf: Remove reset_buffer call back for sinks Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-08 19:42   ` Mathieu Poirier
2018-05-08 19:42     ` Mathieu Poirier
2018-05-11 16:35     ` Suzuki K Poulose
2018-05-11 16:35       ` Suzuki K Poulose
2018-05-01  9:10 ` [PATCH v2 27/27] coresight: etm-perf: Add support for ETR backend Suzuki K Poulose
2018-05-01  9:10   ` Suzuki K Poulose
2018-05-08 22:04   ` Mathieu Poirier
2018-05-08 22:04     ` Mathieu Poirier

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.