On 10/07/2022 20:13, Arnd Bergmann wrote:
> On Sat, Jul 9, 2022 at 1:15 AM Nick Desaulniers <ndesaulniers(a)google.com> wrote:
>
>> ({ \
>> u64 __val; \
>> \
>> - if (__builtin_constant_p((offset))) \
>> + if (__is_constexpr((offset))) \
>> __val = read_etm4x_sysreg_const_offset((offset)); \
>> else \
>> __val = etm4x_sysreg_read((offset), true, (_64bit)); \
>>
>
> This is clearly better than the current version using
> __builtin_constant_p(), but
> I don't think it's safe in all cases, since there are expressions that
> are constant
> expressions to the compiler but are not valid input to the assembler.
>
> I would prefer to see this fixed differently, but doing this one first is also
> fine with me:
>
> Acked-by: Arnd Bergmann <arnd(a)arndb.de>
>
> Arnd
Thanks, I have queued this.
Suzuki
This improves how perf test handles finding shell scripts to run as
part of the testing allowing sub-directories, skipping files that
are not intentional shell script tests and then adds a set of tests
that improve what we cover for Arm CoreSight testing. The goal of
these tests is to expand the scenarios and data traced and examined
to track quality of trace data and improvements to that over time.
Eventually it'd be neater to break up the current Arm CoreSight tests
into smaller focused tests that share the same infrastructure, but
this here would be a first step.
On 7/2/22 04:02, Bagas Sanjaya wrote:
> On Fri, Jul 01, 2022 at 01:08:03PM +0100, carsten.haitzler(a)foss.arm.com wrote:
>> From: "Carsten Haitzler (Rasterman)" <raster(a)rasterman.com>
>>
>
> Hi Carsten,
>
> This doc patch can be improved, see below.
I'll look at addressing the below - with some exceptions as they are not
what you think they are.
>> This adds/improves documentation helping people get started with
>> CoreSight and perf as well as describing the testing and how it works.
>>
>
> Use imperative mood instead of descriptive one for patch description.
>
>> Signed-off-by: Carsten Haitzler <carsten.haitzler(a)arm.com>
>> ---
>> .../trace/coresight/coresight-perf.rst | 160 ++++++++++++++++++
>> tools/perf/Documentation/arm-coresight.txt | 5 +
>> 2 files changed, 165 insertions(+)
>> create mode 100644 Documentation/trace/coresight/coresight-perf.rst
>> create mode 100644 tools/perf/Documentation/arm-coresight.txt
>>
>> diff --git a/Documentation/trace/coresight/coresight-perf.rst b/Documentation/trace/coresight/coresight-perf.rst
>> new file mode 100644
>> index 000000000000..de25082447dd
>> --- /dev/null
>> +++ b/Documentation/trace/coresight/coresight-perf.rst
>> @@ -0,0 +1,160 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +================
>> +CoreSight - Perf
>> +================
>> +
>> + :Author: Carsten Haitzler <carsten.haitzler(a)arm.com>
>> + :Date: June 29th, 2022
>> +
>> +Perf is able to locally access CoreSight trace data and store it to the
>> +output perf data files. This data can then be later decoded to give the
>> +instructions that were traced for debugging or profiling purposes. You
>> +can log such data with a perf record command like:
>> +
>> + perf record -e cs_etm//u testbinary
>> +
>
> Use literal code block.
>
>> +This would run some test binary (testbinary) until it exits and record
>> +a perf.data trace file. That file would have AUX sections if CoreSight
>> +is working correctly. You can dump the content of this file as
>> +readable text with a command like:
>> +
>> + perf report --stdio --dump -i perf.data
>> +
>
> Same as above.
>
>> +You should find some sections of this file have AUX data blocks like:
>> +
>> + 0x1e78 [0x30]: PERF_RECORD_AUXTRACE size: 0x11dd0 offset: 0 ref: 0x1b614fc1061b0ad1 idx: 0 tid: 531230 cpu: -1
>> +
>> + . ... CoreSight ETM Trace data: size 73168 bytes
>> + Idx:0; ID:10; I_ASYNC : Alignment Synchronisation.
>> + Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
>> + Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000;
>> + Idx:26; ID:10; I_TRACE_ON : Trace On.
>> + Idx:27; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFB6069140; Ctxt: AArch64,EL0, NS;
>> + Idx:38; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
>> + Idx:39; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
>> + Idx:40; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
>> + Idx:41; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEN
>> + ...
>> +
>
> Here too.
>
>> +If you see these above, then your system is tracing CoreSight data
>> +correctly.
>> +
>> +To compile perf with CoreSight support in the tools/perf directory do
>> +
>> + make CORESIGHT=1
>> +
>
> Here too again.
>
>> +This requires OpenCSD to build. You may install distribution packages
>> +for the support such as libopencsd and libopencsd-dev or download it
>> +and build yourself. Upstream OpenCSD is located at:
>> +
>> + https://github.com/Linaro/OpenCSD
>> +
>> +For complete information on building perf with CoreSight support and
>> +more extensive usage look at:
>> +
>> + https://github.com/Linaro/OpenCSD/blob/master/HOWTO.md
>> +
>> +
>> +Kernel CoreSight Support
>> +------------------------
>> +
>> +You will also want CoreSight support enabled in your kernel config.
>> +Ensure it is enabled with:
>> +
>> + CONFIG_CORESIGHT=y
>> +
>> +There are various other CoreSight options you probably also want
>> +enabled like:
>> +
>> + CONFIG_CORESIGHT_LINKS_AND_SINKS=y
>> + CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
>> + CONFIG_CORESIGHT_CATU=y
>> + CONFIG_CORESIGHT_SINK_TPIU=y
>> + CONFIG_CORESIGHT_SINK_ETBV10=y
>> + CONFIG_CORESIGHT_SOURCE_ETM4X=y
>> + CONFIG_CORESIGHT_STM=y
>> + CONFIG_CORESIGHT_CPU_DEBUG=y
>> + CONFIG_CORESIGHT_CTI=y
>> + CONFIG_CORESIGHT_CTI_INTEGRATION_REGS=y
>> +
>
> Same as above again.
>
>> +Please refer to the kernel configuration help for more information.
>> +
>> +Perf test - Verify kernel and userspace perf CoreSight work
>> +-----------------------------------------------------------
>> +
>> +When you run perf test, it will do a lot of self tests. Some of those
>> +tests will cover CoreSight (only if enabled and on ARM64). You
>> +generally would run perf test from the tools/perf directory in the
>> +kernel tree. Some tests will check some internal perf support like:
>> +
>> + Check Arm CoreSight trace data recording and synthesized samples
>> + Check Arm SPE trace data recording and synthesized samples
>> +
>
> Use bullet lists.
Actually this would be a code block - it is literally the stdout from
perf test (just 2 lines of it for those tests).
>> +Some others will actually use perf record and some test binaries that
>> +are in tests/shell/coresight and will collect traces to ensure a
>> +minimum level of functionality is met. The scripts that launch these
>> +tests are in the same directory. These will all look like:
>> +
>> + CoreSight / ASM Pure Loop
>> + CoreSight / Memcpy 16k 10 Threads
>> + CoreSight / Thread Loop 10 Threads - Check TID
>> + ...
>> +
>
> Same as above.
This too - a code block.
>> +These perf record tests will not run if the tool binaries do not exist
>> +in tests/shell/coresight/*/ and will be skipped. If you do not have
>> +CoreSight support in hardware then either do not build perf with
>> +CoreSight support or remove these binaries in order to not have these
>> +tests fail and have them skip instead.
>> +
>> +These tests will log historical results in the current working
>> +directory (e.g. tools/perf) and will be named stats-*.csv like:
>> +
>> + stats-asm_pure_loop-out.csv
>> + stats-memcpy_thread-16k_10.csv
>> + ...
>> +
>
> These above causes htmldocs warning (unescaped wildcard), so I have to apply
> the fixup:
>
> ---- >8 ----
>
> diff --git a/Documentation/trace/coresight/coresight-perf.rst b/Documentation/trace/coresight/coresight-perf.rst
> index de25082447dd50..a25fcda5c37c55 100644
> --- a/Documentation/trace/coresight/coresight-perf.rst
> +++ b/Documentation/trace/coresight/coresight-perf.rst
> @@ -102,13 +102,13 @@ tests are in the same directory. These will all look like:
> ...
>
> These perf record tests will not run if the tool binaries do not exist
> -in tests/shell/coresight/*/ and will be skipped. If you do not have
> +in tests/shell/coresight/\*/ and will be skipped. If you do not have
> CoreSight support in hardware then either do not build perf with
> CoreSight support or remove these binaries in order to not have these
> tests fail and have them skip instead.
>
> These tests will log historical results in the current working
> -directory (e.g. tools/perf) and will be named stats-*.csv like:
> +directory (e.g. tools/perf) and will be named stats-\*.csv like:
>
> stats-asm_pure_loop-out.csv
> stats-memcpy_thread-16k_10.csv
>
> ---- >8 ----
>
> Also, the output list above could be inside code block (since these
> are output).
Yup.
>> +These statistic files log some aspects of the AUX data sections in
>> +the perf data output counting some numbers of certain encodings (a
>> +good way to know that it's working in a very simple way). One problem
>> +with CoreSight is that given a large enough amount of data needing to
>> +be logged, some of it can be lost due to the processor not waking up
>> +in time to read out all the data from buffers etc.. You will notice
>> +that the amount of data collected can vary a lot per run of perf test.
>> +If you wish to see how this changes over time, simply run perf test
>> +multiple times and all these csv files will have more and more data
>> +appended to it that you can later examine, graph and otherwise use to
>> +figure out if things have become worse or better.
>> +
>> +This means sometimes these tests fail as they don't capture all the
>> +data needed. This is about tracking quality and amount of data
>> +produced over time and to see when changes to the Linux kernel improve
>> +quality of traces.
>> +
>> +Be aware that some of these tests take quite a while to run, specifically
>> +in processing the perf data file and dumping contents to then examine what
>> +is inside.
>> +
>> +You can change where these csv logs are stored by setting the
>> +PERF_TEST_CORESIGHT_STATDIR environment variable before running perf
>> +test like:
>> +
>> + export PERF_TEST_CORESIGHT_STATDIR=/var/tmp
>> + perf test
>> +
>> +They will also store resulting perf output data in the current
>> +directory for later inspection like:
>> +
>> + perf-asm_pure_loop-out.data
>> + perf-memcpy_thread-16k_10.data
>> + ...
>> +
>> +You can alter where the perf data files are stored by setting the
>> +PERF_TEST_CORESIGHT_DATADIR environment variable such as:
>> +
>> + PERF_TEST_CORESIGHT_DATADIR=/var/tmp
>> + perf test
>> +
>
> Use code block.
>
>> +You may wish to set these above environment variables if you whish to
>> +keep the output of tests outside of the current working directory for
>> +longer term storage and examination.
>> diff --git a/tools/perf/Documentation/arm-coresight.txt b/tools/perf/Documentation/arm-coresight.txt
>> new file mode 100644
>> index 000000000000..f94743a4d161
>> --- /dev/null
>> +++ b/tools/perf/Documentation/arm-coresight.txt
>> @@ -0,0 +1,5 @@
>> +Arm CoreSight Support
>> +=====================
>> +
>> +Please see docuentation in the central CoreSight location in the
>> +kernel tree under Documentation/trace/coresight
>
> s/ducuentation/documentation/
>
> So here's the improv:
>
> ---- >8 ----
>
> diff --git a/Documentation/trace/coresight/coresight-perf.rst b/Documentation/trace/coresight/coresight-perf.rst
> index a25fcda5c37c55..0dd4689a699ecd 100644
> --- a/Documentation/trace/coresight/coresight-perf.rst
> +++ b/Documentation/trace/coresight/coresight-perf.rst
> @@ -10,37 +10,37 @@ CoreSight - Perf
> Perf is able to locally access CoreSight trace data and store it to the
> output perf data files. This data can then be later decoded to give the
> instructions that were traced for debugging or profiling purposes. You
> -can log such data with a perf record command like:
> +can log such data with a perf record command like::
>
> - perf record -e cs_etm//u testbinary
> + perf record -e cs_etm//u testbinary
>
> This would run some test binary (testbinary) until it exits and record
> a perf.data trace file. That file would have AUX sections if CoreSight
> is working correctly. You can dump the content of this file as
> -readable text with a command like:
> +readable text with a command like::
>
> - perf report --stdio --dump -i perf.data
> + perf report --stdio --dump -i perf.data
>
> -You should find some sections of this file have AUX data blocks like:
> +You should find some sections of this file have AUX data blocks like::
>
> - 0x1e78 [0x30]: PERF_RECORD_AUXTRACE size: 0x11dd0 offset: 0 ref: 0x1b614fc1061b0ad1 idx: 0 tid: 531230 cpu: -1
> + 0x1e78 [0x30]: PERF_RECORD_AUXTRACE size: 0x11dd0 offset: 0 ref: 0x1b614fc1061b0ad1 idx: 0 tid: 531230 cpu: -1
>
> - . ... CoreSight ETM Trace data: size 73168 bytes
> - Idx:0; ID:10; I_ASYNC : Alignment Synchronisation.
> - Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
> - Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000;
> - Idx:26; ID:10; I_TRACE_ON : Trace On.
> - Idx:27; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFB6069140; Ctxt: AArch64,EL0, NS;
> - Idx:38; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> - Idx:39; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> - Idx:40; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> - Idx:41; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEN
> - ...
> + . ... CoreSight ETM Trace data: size 73168 bytes
> + Idx:0; ID:10; I_ASYNC : Alignment Synchronisation.
> + Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
> + Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000;
> + Idx:26; ID:10; I_TRACE_ON : Trace On.
> + Idx:27; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFB6069140; Ctxt: AArch64,EL0, NS;
> + Idx:38; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> + Idx:39; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> + Idx:40; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
> + Idx:41; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEN
> + ...
>
> If you see these above, then your system is tracing CoreSight data
> correctly.
>
> -To compile perf with CoreSight support in the tools/perf directory do
> +To compile perf with CoreSight support in the tools/perf directory do::
>
> make CORESIGHT=1
>
> @@ -60,23 +60,23 @@ Kernel CoreSight Support
> ------------------------
>
> You will also want CoreSight support enabled in your kernel config.
> -Ensure it is enabled with:
> +Ensure it is enabled with::
>
> - CONFIG_CORESIGHT=y
> + CONFIG_CORESIGHT=y
>
> There are various other CoreSight options you probably also want
> -enabled like:
> +enabled like::
>
> - CONFIG_CORESIGHT_LINKS_AND_SINKS=y
> - CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
> - CONFIG_CORESIGHT_CATU=y
> - CONFIG_CORESIGHT_SINK_TPIU=y
> - CONFIG_CORESIGHT_SINK_ETBV10=y
> - CONFIG_CORESIGHT_SOURCE_ETM4X=y
> - CONFIG_CORESIGHT_STM=y
> - CONFIG_CORESIGHT_CPU_DEBUG=y
> - CONFIG_CORESIGHT_CTI=y
> - CONFIG_CORESIGHT_CTI_INTEGRATION_REGS=y
> + CONFIG_CORESIGHT_LINKS_AND_SINKS=y
> + CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
> + CONFIG_CORESIGHT_CATU=y
> + CONFIG_CORESIGHT_SINK_TPIU=y
> + CONFIG_CORESIGHT_SINK_ETBV10=y
> + CONFIG_CORESIGHT_SOURCE_ETM4X=y
> + CONFIG_CORESIGHT_STM=y
> + CONFIG_CORESIGHT_CPU_DEBUG=y
> + CONFIG_CORESIGHT_CTI=y
> + CONFIG_CORESIGHT_CTI_INTEGRATION_REGS=y
>
> Please refer to the kernel configuration help for more information.
>
> @@ -88,18 +88,18 @@ tests will cover CoreSight (only if enabled and on ARM64). You
> generally would run perf test from the tools/perf directory in the
> kernel tree. Some tests will check some internal perf support like:
>
> - Check Arm CoreSight trace data recording and synthesized samples
> - Check Arm SPE trace data recording and synthesized samples
> +* Check Arm CoreSight trace data recording and synthesized samples
> +* Check Arm SPE trace data recording and synthesized samples
>
> Some others will actually use perf record and some test binaries that
> are in tests/shell/coresight and will collect traces to ensure a
> minimum level of functionality is met. The scripts that launch these
> tests are in the same directory. These will all look like:
>
> - CoreSight / ASM Pure Loop
> - CoreSight / Memcpy 16k 10 Threads
> - CoreSight / Thread Loop 10 Threads - Check TID
> - ...
> +* CoreSight / ASM Pure Loop
> +* CoreSight / Memcpy 16k 10 Threads
> +* CoreSight / Thread Loop 10 Threads - Check TID
> +* etc.
>
> These perf record tests will not run if the tool binaries do not exist
> in tests/shell/coresight/\*/ and will be skipped. If you do not have
> @@ -108,11 +108,11 @@ CoreSight support or remove these binaries in order to not have these
> tests fail and have them skip instead.
>
> These tests will log historical results in the current working
> -directory (e.g. tools/perf) and will be named stats-\*.csv like:
> +directory (e.g. tools/perf) and will be named stats-\*.csv like::
>
> - stats-asm_pure_loop-out.csv
> - stats-memcpy_thread-16k_10.csv
> - ...
> + stats-asm_pure_loop-out.csv
> + stats-memcpy_thread-16k_10.csv
> + ...
>
> These statistic files log some aspects of the AUX data sections in
> the perf data output counting some numbers of certain encodings (a
> @@ -137,23 +137,23 @@ is inside.
>
> You can change where these csv logs are stored by setting the
> PERF_TEST_CORESIGHT_STATDIR environment variable before running perf
> -test like:
> +test like::
>
> - export PERF_TEST_CORESIGHT_STATDIR=/var/tmp
> - perf test
> + export PERF_TEST_CORESIGHT_STATDIR=/var/tmp
> + perf test
>
> They will also store resulting perf output data in the current
> -directory for later inspection like:
> +directory for later inspection like::
>
> - perf-asm_pure_loop-out.data
> - perf-memcpy_thread-16k_10.data
> - ...
> + perf-asm_pure_loop-out.data
> + perf-memcpy_thread-16k_10.data
> + ...
>
> You can alter where the perf data files are stored by setting the
> -PERF_TEST_CORESIGHT_DATADIR environment variable such as:
> +PERF_TEST_CORESIGHT_DATADIR environment variable such as::
>
> - PERF_TEST_CORESIGHT_DATADIR=/var/tmp
> - perf test
> + PERF_TEST_CORESIGHT_DATADIR=/var/tmp
> + perf test
>
> You may wish to set these above environment variables if you whish to
> keep the output of tests outside of the current working directory for
> diff --git a/tools/perf/Documentation/arm-coresight.txt b/tools/perf/Documentation/arm-coresight.txt
> index f94743a4d161f2..c117fc50a2a956 100644
> --- a/tools/perf/Documentation/arm-coresight.txt
> +++ b/tools/perf/Documentation/arm-coresight.txt
> @@ -1,5 +1,5 @@
> Arm CoreSight Support
> =====================
>
> -Please see docuentation in the central CoreSight location in the
> -kernel tree under Documentation/trace/coresight
> +For full documentation, see Documentation/trace/coresight/coresight-perf.rst
> +in the kernel tree.
>
> ---- >8 ----
>
> Note: since this is documentation patch, don't forget to Cc linux-doc list.
> I add it for you.
I'll split this out to a separate stand-alone patch from this series. I
put docs in the place I was told to by the perf coresight maintainers,
but that now complicates everyone to send the patch series to and so
only the docs are relevant to the doc mailing list, so I'll split it off.
This set extends the configfs support to allow loading and unloading of
configurations as binary files via configfs.
Additional attributes - load and unload are provided to in the
/config/cs-syscfg subsytem base group to implement the load functionality.
Routines to generate binary configuration files are supplied in
./tools/coresight.
Example generator and reader applications are provided.
Tools may be cross compiled or built for use on host system.
Documentation is updated to describe feature usage.
Changes since v3:
1) Rebase & tested on coresight/next - 5.19-rc3 - which includes the
fix patch for earlier configfs works.
2) Lockdep investigations resulted in re-design of some of the code
accessing configfs.
3) moved load and unload attributes to root of cs-syscfg. (Mathieu)
4) Additional minor fixes suggested by Mathieu.
5) Memory for configfs loaded and unloaded configurations is now
explicitly freed.
6) LOCKDEP nesting fix for configfs base code (fs/configfs/dir.c)
Changes since v2:
1) Rebased & tested on coresight/next - 5.18-rc2
2) Moved coresight config generator and reader programs from samples to
tools/coresight. Docs updated to match. (suggested by Mathieu)
3) userspace builds now use userspace headers from tools/...
4) Other minor fixes from Mathieu's review.
Changes since v1:
1) Rebased to coresight/next - 5.16-rc1 with previous coresight config
set applied.
2) Makefile.host fixed to default to all target.
Mike Leach (7):
coresight: configfs: Update memory allocation / free for configfs
elements
coresight: configfs: Add in functionality for load via configfs
coresight: configfs: Add in binary attributes to load files
coresight: configfs: Modify config files to allow userspace use
coresight: tools: Add config file write and reader tools
Documentation: coresight: docs for config load via configfs
configfs: Fix LOCKDEP nesting issues with fragment semaphores
.../trace/coresight/coresight-config.rst | 202 +++++-
MAINTAINERS | 1 +
drivers/hwtracing/coresight/Makefile | 2 +-
.../coresight/coresight-config-file.c | 583 ++++++++++++++++++
.../coresight/coresight-config-file.h | 139 +++++
.../hwtracing/coresight/coresight-config.h | 27 +
.../coresight/coresight-syscfg-configfs.c | 300 +++++++--
.../coresight/coresight-syscfg-configfs.h | 3 +
.../hwtracing/coresight/coresight-syscfg.c | 107 ++++
.../hwtracing/coresight/coresight-syscfg.h | 2 +
fs/configfs/configfs_internal.h | 3 +
fs/configfs/dir.c | 45 ++
tools/coresight/Makefile | 52 ++
tools/coresight/coresight-cfg-bufw.c | 309 ++++++++++
tools/coresight/coresight-cfg-bufw.h | 26 +
tools/coresight/coresight-cfg-example1.c | 62 ++
tools/coresight/coresight-cfg-example2.c | 95 +++
tools/coresight/coresight-cfg-examples.h | 22 +
tools/coresight/coresight-cfg-file-gen.c | 61 ++
tools/coresight/coresight-cfg-file-read.c | 227 +++++++
tools/coresight/coresight-config-uapi.h | 76 +++
21 files changed, 2298 insertions(+), 46 deletions(-)
create mode 100644 drivers/hwtracing/coresight/coresight-config-file.c
create mode 100644 drivers/hwtracing/coresight/coresight-config-file.h
create mode 100644 tools/coresight/Makefile
create mode 100644 tools/coresight/coresight-cfg-bufw.c
create mode 100644 tools/coresight/coresight-cfg-bufw.h
create mode 100644 tools/coresight/coresight-cfg-example1.c
create mode 100644 tools/coresight/coresight-cfg-example2.c
create mode 100644 tools/coresight/coresight-cfg-examples.h
create mode 100644 tools/coresight/coresight-cfg-file-gen.c
create mode 100644 tools/coresight/coresight-cfg-file-read.c
create mode 100644 tools/coresight/coresight-config-uapi.h
--
2.17.1
This series adds support for the trace performance monitoring and
diagnostics hardware (TPDM and TPDA). It is composed of two major
elements.
a) Changes for original coresight framework to support for TPDM and TPDA.
b) Add driver code for TPDM and TPDA.
Introduction of changes for original coresight framework
Support TPDM as new coresight source.
Since only STM and ETM are supported as coresight source originally.
TPDM is a newly added coresight source. We need to change
the original way of saving coresight path to support more types source
for coresight driver.
The following patch is to add support more coresight sources.
coresight: core: Use IDR for non-cpu bound sources' paths.
Introduction of TPDM and TPDA
TPDM - The trace performance monitoring and diagnostics monitor or TPDM in
short serves as data collection component for various dataset types
specified in the QPMDA(Qualcomm performance monitoring and diagnostics
architecture) spec. The primary use case of the TPDM is to collect data
from different data sources and send it to a TPDA for packetization,
timestamping and funneling.
Coresight: Add coresight TPDM source driver
dt-bindings: arm: Adds CoreSight TPDM hardware definitions
coresight-tpdm: Add DSB dataset support
coresight-tpdm: Add integration test support
docs: sysfs: coresight: Add sysfs ABI documentation for TPDM
TPDA - The trace performance monitoring and diagnostics aggregator or
TPDA in short serves as an arbitration and packetization engine for the
performance monitoring and diagnostics network as specified in the QPMDA
(Qualcomm performance monitoring and diagnostics architecture)
specification. The primary use case of the TPDA is to provide
packetization, funneling and timestamping of Monitor data as specified
in the QPMDA specification.
The following patch is to add driver for TPDA.
Coresight: Add TPDA link driver
dt-bindings: arm: Adds CoreSight TPDA hardware definitions
The last patch of this series is a device tree modification, which add
the TPDM and TPDA configuration to device tree for validating.
ARM: dts: msm: Add coresight components for SM8250
ARM: dts: msm: Add tpdm mm/prng for sm8250
Once this series patches are applied properly, the tpdm and tpda nodes
should be observed at the coresight path /sys/bus/coresight/devices
e.g.
/sys/bus/coresight/devices # ls -l | grep tpd
tpda0 -> ../../../devices/platform/soc(a)0/6004000.tpda/tpda0
tpdm0 -> ../../../devices/platform/soc(a)0/6c08000.mm.tpdm/tpdm0
We can use the commands are similar to the below to validate TPDMs.
Enable coresight sink first.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source
echo 1 > /sys/bus/coresight/devices/tpdm0/integration_test
echo 2 > /sys/bus/coresight/devices/tpdm0/integration_test
The test data will be collected in the coresight sink which is enabled.
If rwp register of the sink is keeping updating when do
integration_test (by cat tmc_etf0/mgmt/rwp), it means there is data
generated from TPDM to sink.
There must be a tpda between tpdm and the sink. When there are some
other trace event hw components in the same HW block with tpdm, tpdm
and these hw components will connect to the coresight funnel. When
there is only tpdm trace hw in the HW block, tpdm will connect to
tpda directly.
+---------------+ +-------------+
| tpdm@6c08000 | |tpdm@684C000 |
+-------|-------+ +------|------+
| |
+-------|-------+ |
| funnel@6c0b000| |
+-------|-------+ |
| |
+-------|-------+ |
|funnel@6c2d000 | |
+-------|-------+ |
| |
| +---------------+ |
+----- tpda@6004000 -----------+
+-------|-------+
|
+-------|-------+
|funnel@6005000 |
+---------------+
This patch series depends on patch series
"coresight: Add new API to allocate trace source ID values".
https://patchwork.kernel.org/project/linux-arm-kernel/cover/20220308205000.…
Changes from V10:
1. Change dev_info to dev_dbg in TPDM/TPDA drivers. -- Suzuki K Poulose <suzuki.poulose(a)arm.com>
2. Merge sysfs API change of integration_test to integration_test driver
change. -- -- Suzuki K Poulose <suzuki.poulose(a)arm.com>
Mao Jinlong (9):
coresight: core: Use IDR for non-cpu bound sources' paths.
Coresight: Add coresight TPDM source driver
dt-bindings: arm: Adds CoreSight TPDM hardware definitions
coresight-tpdm: Add DSB dataset support
coresight-tpdm: Add integration test support
Coresight: Add TPDA link driver
dt-bindings: arm: Adds CoreSight TPDA hardware definitions
arm64: dts: qcom: sm8250: Add coresight components
arm64: dts: qcom: sm8250: Add tpdm mm/prng
.../testing/sysfs-bus-coresight-devices-tpdm | 13 +
.../bindings/arm/qcom,coresight-tpda.yaml | 111 +++
.../bindings/arm/qcom,coresight-tpdm.yaml | 93 +++
MAINTAINERS | 2 +
arch/arm64/boot/dts/qcom/sm8250.dtsi | 671 ++++++++++++++++++
drivers/hwtracing/coresight/Kconfig | 23 +
drivers/hwtracing/coresight/Makefile | 2 +
drivers/hwtracing/coresight/coresight-core.c | 42 +-
drivers/hwtracing/coresight/coresight-tpda.c | 206 ++++++
drivers/hwtracing/coresight/coresight-tpda.h | 35 +
drivers/hwtracing/coresight/coresight-tpdm.c | 259 +++++++
drivers/hwtracing/coresight/coresight-tpdm.h | 62 ++
include/linux/coresight.h | 1 +
13 files changed, 1508 insertions(+), 12 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
create mode 100644 Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
create mode 100644 drivers/hwtracing/coresight/coresight-tpda.c
create mode 100644 drivers/hwtracing/coresight/coresight-tpda.h
create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.c
create mode 100644 drivers/hwtracing/coresight/coresight-tpdm.h
--
2.17.1