diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2019-04-18 13:57:42 -0600 |
---|---|---|
committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2019-05-03 09:35:28 -0600 |
commit | 4de1e6dee83da8fe67e6b7fa5cfcf1d77f8e7349 (patch) | |
tree | aeb12557c9bd6017bcb5711ef980e18e8b20e03d /drivers/hwtracing/coresight/coresight-etb10.c | |
parent | 78e6427b4e7b017951785982f7f97cf64e2d624b (diff) |
coresight: Fix buffer size in snapshot mode
In snapshot mode the buffer used by the sink devices need to be
equal to the ring buffer size in order for the user space mechanic
to work properly.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-etb10.c')
-rw-r--r-- | drivers/hwtracing/coresight/coresight-etb10.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 4ee4c80a4354..0764647b92bc 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -374,7 +374,30 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int nr_pages, bool overwrite) { int node, cpu = event->cpu; + u32 capacity; struct cs_buffers *buf; + struct etb_drvdata *drvdata; + + /* + * In snapsot mode the size of the perf ring buffer needs to be equal + * to the size of the device's internal memory if we want to reuse the + * generic AUX buffer management mechanic. + * + * For example (assuming 4096 byte page size): + * + * # cat /sys/bus/coresight/devices/20010000.etb/mgmt/rdp + * 0x2000 + * # perf record -e cs_etm/@20010000.etf/ -S -m,8 --per-thread $APP + * + */ + drvdata = dev_get_drvdata(csdev->dev.parent); + capacity = drvdata->buffer_depth * ETB_FRAME_SIZE_WORDS; + + if (overwrite && + ((nr_pages << PAGE_SHIFT) != capacity)) { + dev_err(&csdev->dev, "Ring buffer not equal to device buffer"); + return NULL; + } if (cpu == -1) cpu = smp_processor_id(); |