Hi Joey,
Please provide more information on the problems you are encountering
and any errors you are seeing. Without this I cannot investigate
further.
1) How are you attempting to use OpenCSD to decode this file? The
trc_pkt_lister test program will provide the same packet decode as
PTMtoHuman but does require additional context to ensure that the
decode is correct. This involves providing the raw data and certain
ETMv4 registers in a "trace snapshot" format. The library comes with
examples in this format and a specification for this format in the
documentation.
2) If you wish to go beyond packet decode then OpenCSD can do that -
but you will need to provide additional program image data - again in
the snapshot format described above.
Thanks & Regards
Mike
On Tue, 10 Dec 2019 at 07:55, Joey Jiao <joeyjiaojg(a)163.com> wrote:
>
> Hi Mike,
> I cannot attach the dump into github, so I have to ask here.
>
> OpenCSD cannot decode the etm binary attached, however an opensource ETM decoder https://github.com/hwangcc23/ptm2human can parse.
>
> Can you help understand why?
>
> And is there any bug in OpenCSD?
>
> Thanks
>
> Joey
>
>
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
From: Leo Yan <leo.yan(a)linaro.org>
[ Upstream commit 9d604aad4bb022e848dec80d6fe5f73fe87061a2 ]
Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan'
as its parameter, this doesn't match with its definition body which uses
'trace_chan_id'. So renames the parameter to 'trace_chan_id'.
It's luck to have a local variable 'trace_chan_id' in the function
cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR,
the local variable 'trace_chan_id' is used rather than the macro's
parameter 'trace_id_chan'; so the compiler doesn't complain for this
before.
After renaming the parameter, it leads to a compiling error due
cs_etm__setup_queue() has no variable 'trace_id_chan'. This patch uses
the variable 'trace_chan_id' for the macro so that fixes the compiling
error.
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier(a)linaro.org>
Cc: Alexander Shishkin <alexander.shishkin(a)linux.intel.com>
Cc: Jiri Olsa <jolsa(a)redhat.com>
Cc: Mark Rutland <mark.rutland(a)arm.com>
Cc: Namhyung Kim <namhyung(a)kernel.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose(a)arm.com>
Cc: coresight ml <coresight(a)lists.linaro.org>
Cc: linux-arm-kernel(a)lists.infradead.org
Link: http://lore.kernel.org/lkml/20191021074808.25795-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
tools/perf/util/cs-etm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 4ba0f871f086d..f5f855fff412e 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);
* encode the etm queue number as the upper 16 bit and the channel as
* the lower 16 bit.
*/
-#define TO_CS_QUEUE_NR(queue_nr, trace_id_chan) \
+#define TO_CS_QUEUE_NR(queue_nr, trace_chan_id) \
(queue_nr << 16 | trace_chan_id)
#define TO_QUEUE_NR(cs_queue_nr) (cs_queue_nr >> 16)
#define TO_TRACE_CHAN_ID(cs_queue_nr) (cs_queue_nr & 0x0000ffff)
@@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
* Note that packets decoded above are still in the traceID's packet
* queue and will be processed in cs_etm__process_queues().
*/
- cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_id_chan);
+ cs_queue_nr = TO_CS_QUEUE_NR(queue_nr, trace_chan_id);
ret = auxtrace_heap__add(&etm->heap, cs_queue_nr, timestamp);
out:
return ret;
--
2.20.1
Good day Joey,
I can spot several problems with your manipulations - please see below. I
also suggest to CC the coresight mailing list when looking for support.
On Tue, 10 Dec 2019 at 00:44, Joey Jiao <notifications(a)github.com> wrote:
> Hi,
> I have a arm64 device,
> perf list pmu
>
> List of pre-defined events (to be used in -e):
> cs_etm// [Kernel PMU event]
>
> However I cannot run perf record -e cs_etm successfully.
>
> can you help?
> ls /sys/bus/coresight/devices/|grep coresight-etm
>
> coresight-etm0
> coresight-etm1
> coresight-etm2
> coresight-etm3
> coresight-etm4
> coresight-etm5
> coresight-etm6
> coresight-etm7
>
We will need a full list of all the CS devices on your system. Just
listing the ETMs is not sufficient.
> #2 <https://github.com/Linaro/perf-opencsd/issues/2> ls -l
> /sys/bus/coresight/devices/coresight-etm0
> lrwxrwxrwx. 1 root root 0 Dec 7 16:58
> /sys/bus/coresight/devices/coresight-etm0 ->
> ../../../devices/platform/soc/7040000.etm/coresight-etm0
> perf record -e cs_etm ls
>
> event syntax error: 'cs_etm'
> ___ parser error
> Run 'perf list' for a list of valid events
>
> Usage: perf record [] []
> or: perf record [] -- []
>
> -e, --event <event> event selector. use 'perf list' to list available events
>
>
Yes, that is the expected behavior. On systems with a 1:N topology a sink
needs to be specified. System with 1:1 topologies aren't supported, hence
the request to see all the CS devices on your system (above).
> perf record -e cs_etm/7040000.etm/ ls
>
> event syntax error: 'cs_etm/7040000.etm/'
> ___ parser error
> Run 'perf list' for a list of valid events
>
> Usage: perf record [] []
> or: perf record [] -- []
>
> -e, --event <event> event selector. use 'perf list' to list available events
>
>
Also incorrect. First the sink needs to be preceded by '@' and actually be
a sink - here you have specified a source. Before going further I advise
you to spend some time in the documentation [1].
Thanks,
Mathieu
[1].
https://elixir.bootlin.com/linux/v5.5-rc1/source/Documentation/trace/coresi…
> perf record -e cs_etm/(a)7040000.etm/ ls
>
> failed to set config "7040000.etm" on event cs_etm/(a)7040000.etm/ with 2
> (No such file or directory)
>
I can cat /dev/coresight-tmc-etr > dump.bin after enabled ETM, but perf
> doesn't work as above stated.
>
> Thanks
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/Linaro/perf-opencsd/issues/3?email_source=notifications&…>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAELPW5NE5EXRUA7F3274G3QX…>
> .
>
Hi everyone,
since it seems very hard to get valuable information from vendors about
the CoreSight capabilities of their SoC's, I was wondering if anyone has
recommendations for development boards.
I started with the dragonboard 410c which I can definitely recommend for
learning and first SW projects with CS due to the low price and
well-working Debian support (and it actually had vendor documentation on
CS).
But the board and CoreSight features (especially ETMv4 capabilities) are
somewhat limited. I am especially missing the conditional non-branch
tracing.
Also, I would be very interested in testing the "new" SoC-600
features/improvements.
After some research on higher-end development-boards, the only
informative resource I found are the device tree source files in the
linux and android kernels, which at least give an overview of the
components implemented for several SoCs.
Currently, I was looking at the Open-Q 820 or Open-Q 845 so I would be
happy to hear any experiences with CoreSight on these boards
(SoC-400/600? ETMv4 capabilities? SW Support?).
Other suggestions/recommendations are also very welcomed!
Thank you in advance!
Robin Röhrig
CTIs are defined in the device tree and associated with other CoreSight
devices. The core CoreSight code has been modified to enable the registration
of the CTI devices on the same bus as the other CoreSight components,
but as these are not actually trace generation / capture devices, they
are not part of the Coresight path when generating trace.
However, the definition of the standard CoreSight device has been extended
to include a reference to an associated CTI device, and the enable / disable
trace path operations will auto enable/disable any associated CTI devices at
the same time.
Programming is at present via sysfs - a full API is provided to utilise the
hardware capabilities. As CTI devices are unprogrammed by default, the auto
enable describe above will have no effect until explicit programming takes
place.
A set of device tree bindings specific to the CTI topology has been defined.
The driver accesses these in a platform agnostic manner, so ACPI bindings
can be added later, once they have been agreed and defined for the CTI device.
Documentation has been updated to describe both the CTI hardware, its use and
programming in sysfs, and the new dts bindings required.
Tested on DB410 board.
Applies on coresight/next tree after following dependent set applied for
documentation directory changes [1]. Kernel version 5.4-rc7.
[1] https://www.spinics.net/lists/linux-doc/msg71062.html
Changes since v4:
Multiple changes following feedback from Mathieu, Leo and Suzuki.
1) Dropped RFC tag - wider distribution
2) CTI bindings definition now presented as a .yaml file - tested with
with 'dt-doc-validate' from devicetree.org/dt-schema project and in kernel
build tree with 'make dtbs_check' per kernel docs.
3) Sysfs links to other CoreSight devices moved out of this set into
a following set that deals with all CoreSight devices & sysfs links.
4) Documentation in .rst format and new directory following patchset in [1].
Extended example provided in docs.
5) Rationalised devicetree of_ specifics to use generic fwnode functions
where possible to enable easier addition of ACPI support later.
6) Other minor changes as requested in feedback from last patchset.
Changes since v3:
1) After discussion on CS mailing list, each CTI connection has a triggers<N>
sysfs directory with name and trigger signals listed for the connection.
2) Initial code for creating sysfs links between CoreSight components is
introduced and implementation for CTI provided. This allows exploration
of the CoreSight topology within the sysfs infrastructure. Patches for
links between other CoreSight components to follow.
3) Power management - CPU hotplug and idle omitted from this set as ongoing
developments may define required direction. Additional patch set to follow.
4) Multiple fixes applied as requested by reviewers esp. Matthieu, Suzuki
and Leo.
Changes since v2:
Updates to allow for new features on coresight/next and feedback from
Mathieu and Leo.
1) Rebase and restructuring to apply on top of ACPI support patch set,
currently on coresight/next. of_coresight_cti has been renamed to
coresight-cti-platform and device tree bindings added to this but accessed
in a platform agnostic manner using fwnode for later ACPI support
to be added.
2) Split the sysfs patch info a series of functional patches.
3) Revised the refcount and enabling support.
4) Adopted the generic naming protocol - CTIs are either cti_cpuN or
cti_sysM
5) Various minor presentation /checkpatch issues highlighted in feedback.
6) revised CPU hotplug to cover missing cases needed by ETM.
Changes since v1:
1) Significant restructuring of the source code. Adds cti-sysfs file and
cti device tree file. Patches add per feature rather than per source
file.
2) CPU type power event handling for hotplug moved to CoreSight core,
with generic registration interface provided for all CPU bound CS devices
to use.
3) CTI signal interconnection details in sysfs now generated dynamically
from connection lists in driver. This to fix issue with multi-line sysfs
output in previous version.
4) Full device tree bindings for DB410 and Juno provided (to the extent
that CTI information is available).
5) AMBA driver update for UCI IDs are now upstream so no longer included
in this set.
Mike Leach (14):
coresight: cti: Initial CoreSight CTI Driver
coresight: cti: Add sysfs coresight mgmt reg access.
coresight: cti: Add sysfs access to program function regs
coresight: cti: Add sysfs trigger / channel programming API
dt-bindings: arm: Adds CoreSight CTI hardware definitions.
coresight: cti: Add device tree support for v8 arch CTI
coresight: cti: Add device tree support for custom CTI.
coresight: cti: Enable CTI associated with devices.
coresight: cti: Add connection information to sysfs
dt-bindings: qcom: Add CTI options for qcom msm8916
dt-bindings: arm: Juno platform - add CTI entries to device tree.
dt-bindings: hisilicon: Add CTI bindings for hi-6220
docs: coresight: Update documentation for CoreSight to cover CTI.
docs: sysfs: coresight: Add sysfs ABI documentation for CTI
.../testing/sysfs-bus-coresight-devices-cti | 221 +++
.../bindings/arm/coresight-cti.yaml | 303 ++++
.../devicetree/bindings/arm/coresight.txt | 7 +
.../trace/coresight/coresight-ect.rst | 200 +++
Documentation/trace/coresight/coresight.rst | 13 +
MAINTAINERS | 2 +
arch/arm64/boot/dts/arm/juno-base.dtsi | 150 +-
arch/arm64/boot/dts/arm/juno-cs-r1r2.dtsi | 31 +-
arch/arm64/boot/dts/arm/juno-r1.dts | 25 +
arch/arm64/boot/dts/arm/juno-r2.dts | 25 +
arch/arm64/boot/dts/arm/juno.dts | 25 +
.../boot/dts/hisilicon/hi6220-coresight.dtsi | 130 +-
arch/arm64/boot/dts/qcom/msm8916.dtsi | 85 +-
drivers/hwtracing/coresight/Kconfig | 12 +
drivers/hwtracing/coresight/Makefile | 3 +
.../coresight/coresight-cti-platform.c | 500 +++++++
.../hwtracing/coresight/coresight-cti-sysfs.c | 1219 +++++++++++++++++
drivers/hwtracing/coresight/coresight-cti.c | 712 ++++++++++
drivers/hwtracing/coresight/coresight-cti.h | 232 ++++
.../hwtracing/coresight/coresight-platform.c | 23 +
drivers/hwtracing/coresight/coresight-priv.h | 7 +
drivers/hwtracing/coresight/coresight.c | 61 +-
include/dt-bindings/arm/coresight-cti-dt.h | 37 +
include/linux/coresight.h | 28 +
24 files changed, 4028 insertions(+), 23 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-cti
create mode 100644 Documentation/devicetree/bindings/arm/coresight-cti.yaml
create mode 100644 Documentation/trace/coresight/coresight-ect.rst
create mode 100644 drivers/hwtracing/coresight/coresight-cti-platform.c
create mode 100644 drivers/hwtracing/coresight/coresight-cti-sysfs.c
create mode 100644 drivers/hwtracing/coresight/coresight-cti.c
create mode 100644 drivers/hwtracing/coresight/coresight-cti.h
create mode 100644 include/dt-bindings/arm/coresight-cti-dt.h
--
2.17.1
hi,I started implementing GDB process record and replay with ARM CoreSight as described in the rfc published early this year. Current implementation of coresight tracing in Perf is based on the sysfs interface, by accessing /sys/bus/event_source/devices/cs_etm ... file. GDB implementation of bts and ipt is based on the syscall "sys_perf_event_open".it would be nice to use the similar mechanism for realizing similar functionalities. therefore I would like to know if linux kernel (with coresight deivers) is exposing coresight drivers through the syscall sys_perf_event_open and if this is the case how shall I configure the perf_event_attr to use it.
thanks Zied Guermazi
The connections between CoreSight sources, links and sinks is not obvious
without documentation or access to the device tree / ACPI definitions for
the platform.
This patchset provides sysfs links to enable the user to follow the trace
patch from source to sink.
Components in the trace path are updated to have a connections sysfs
group, which collates all the links for that component.
The CTI components which exist aside from the main trace patch, also
have an added connections directory showing connections to other
CoreSight devices.
This patchset applies on top of the recent CTI patchset [1].
Adaptation of an original patchset [2] from Suzuki, reusing 2 patches
unchanged with update to 3rd adapt to the new common code for trace
path and CTI component links & add a default connections group.
Tested on Juno r1, DB410c 5.4-rc7, coresight/next branch.
[1] https://lists.linaro.org/pipermail/coresight/2019-November/003414.html
[2] https://lists.linaro.org/pipermail/coresight/2019-May/002803.html
Changes since v1:
1) Code from original v4 CTI set moved here so that all connections related
code in this set.
2) Connections directory mandatory for all CoreSight components and
generated as part of the registration process.
Mike Leach (3):
coresight: Add generic sysfs link creation functions.
coresight: cti: Add in sysfs links to other coresight devices.
coresight: docs: Add information about the topology representations.
Suzuki K Poulose (3):
coresight: Pass coresight_device for coresight_release_platform_data
coresight: add return value for fixup connections
coresight: Expose device connections via sysfs
.../trace/coresight/coresight-ect.rst | 5 +-
Documentation/trace/coresight/coresight.rst | 85 ++++++++
drivers/hwtracing/coresight/Makefile | 3 +-
drivers/hwtracing/coresight/coresight-cti.c | 44 +++-
.../hwtracing/coresight/coresight-platform.c | 2 +-
drivers/hwtracing/coresight/coresight-priv.h | 12 +-
drivers/hwtracing/coresight/coresight-sysfs.c | 203 ++++++++++++++++++
drivers/hwtracing/coresight/coresight.c | 72 ++++---
include/linux/coresight.h | 22 ++
9 files changed, 417 insertions(+), 31 deletions(-)
create mode 100644 drivers/hwtracing/coresight/coresight-sysfs.c
--
2.20.1
OpenCSD library version 0.12.1 is released.
Changes:-
1) Snapshots can now have generic core type names that reflect
architecture and profile. e,g, ARMv8-A.
2) Bugfix - certain classes of authenticated pointer instructions were
not being recognised as P0 elements locations.
3) Bugfix - if a trace implementation represented the transition
between A64 & A32 as an address packet followed by a separate context
packet then decode could fail in some cases. Most implementations use
a combined Address+Context packet.
Mike
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK