Hi Mike & all,
[ + CoreSight Mailing List ]
At my side, I found the perf cs-etm regression. When I execute cs-etm test
with below commands:
# perf test list
...
87: Check Arm CoreSight trace data recording and synthesized samples
...
$ perf test -v 87
Then it's stuck and has no response. In the console, sometimes I can
see the log:
[ 94.248480] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
Apparently, there have lockup and introduces CPU stuck. But I didn't
narrow down furthermore if is a hardware lockup or software lockup.
After git bisect, it's narrowed down the regression is related to the
commit:
e7676a00bc52b994960f89b118b0d548e4542372 is the first bad commit
commit e7676a00bc52b994960f89b118b0d548e4542372
Author: Mike Leach <mike.leach(a)linaro.org>
Date: Wed Apr 13 22:49:25 2022 +0100
arm64: dts: juno: add CTI entries to device tree
Add Coresight Cross Trigger Interface(CTI) entries to the device tree
for all the Juno variants.
Link: https://lore.kernel.org/r/20220413214925.30359-1-mike.leach@linaro.org
Reviewed-by: Mathieu Poirier <mathieu.poirier(a)linaro.org>
Signed-off-by: Mike Leach <mike.leach(a)linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla(a)arm.com>
I built Linux kernel with below commands:
$KERNEL=/kernel/path
$OUT=/build/out/path
pushd $KERNEL
make defconfig O=$OUT
./scripts/config --file $OUT/.config -e CONFIG_BPF_SYSCALL
./scripts/config --file $OUT/.config -e CONFIG_BPF_JIT_ALWAYS_ON
./scripts/config --file $OUT/.config -e CONFIG_TRACEPOINTS
./scripts/config --file $OUT/.config -e CONFIG_KPROBES
./scripts/config --file $OUT/.config -e CONFIG_UPROBES
./scripts/config --file $OUT/.config -e CONFIG_KRETPROBES
./scripts/config --file $OUT/.config -e CONFIG_PROC_KCORE
./scripts/config --file $OUT/.config -e CONFIG_NOP_TRACER
./scripts/config --file $OUT/.config -e CONFIG_TRACER_MAX_TRACE
./scripts/config --file $OUT/.config -e CONFIG_RING_BUFFER
./scripts/config --file $OUT/.config -e CONFIG_EVENT_TRACING
./scripts/config --file $OUT/.config -e CONFIG_CONTEXT_SWITCH_TRACER
./scripts/config --file $OUT/.config -e CONFIG_TRACING
./scripts/config --file $OUT/.config -e CONFIG_GENERIC_TRACER
./scripts/config --file $OUT/.config -e CONFIG_FTRACE
./scripts/config --file $OUT/.config -e CONFIG_FUNCTION_TRACER
./scripts/config --file $OUT/.config -e CONFIG_FUNCTION_GRAPH_TRACER
./scripts/config --file $OUT/.config -e CONFIG_SCHED_TRACER
./scripts/config --file $OUT/.config -e CONFIG_FTRACE_SYSCALLS
./scripts/config --file $OUT/.config -e CONFIG_TRACER_SNAPSHOT
./scripts/config --file $OUT/.config -e CONFIG_KPROBE_EVENTS
./scripts/config --file $OUT/.config -e CONFIG_UPROBE_EVENTS
./scripts/config --file $OUT/.config -e CONFIG_BPF_EVENTS
./scripts/config --file $OUT/.config -e CONFIG_DYNAMIC_EVENTS
./scripts/config --file $OUT/.config -e CONFIG_PROBE_EVENTS
./scripts/config --file $OUT/.config -e CONFIG_DYNAMIC_FTRACE
./scripts/config --file $OUT/.config -e CONFIG_PID_IN_CONTEXTIDR
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_LINKS_AND_SINKS
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_LINK_AND_SINK_TMC
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_CATU
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_SINK_TPIU
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_SINK_ETBV10
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_SOURCE_ETM4X
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_STM
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_CPU_DEBUG
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_CTI
./scripts/config --file $OUT/.config -e CONFIG_CORESIGHT_CTI_INTEGRATION_REGS
./scripts/config --file $OUT/.config -e CONFIG_DEBUG_INFO
./scripts/config --file $OUT/.config -e CONFIG_DEBUG_INFO_DWARF5
./scripts/config --file $OUT/.config -e CONFIG_DEBUG_INFO_BTF
./scripts/config --file $OUT/.config -d CONFIG_DEBUG_INFO_REDUCED
yes "" | make oldconfig O=$OUT
make -j `nproc` Image dtbs O=$OUT
popd
When I have some free time, will come back to dig more for it. If have
any suggestion, please let me know, I am glad to try and test at my
side.
Thanks,
Leo
Hi Sudeep,
On Thu, 21 Jul 2022 at 14:03, Sudeep Holla <sudeep.holla(a)arm.com> wrote:
>
> With lockdeps enabled, we get the following warning:
>
> ======================================================
> WARNING: possible circular locking dependency detected
> ------------------------------------------------------
> kworker/u12:1/53 is trying to acquire lock:
> ffff80000adce220 (coresight_mutex){+.+.}-{4:4}, at: coresight_set_assoc_ectdev_mutex+0x3c/0x5c
> but task is already holding lock:
> ffff80000add1f60 (ect_mutex){+.+.}-{4:4}, at: cti_probe+0x318/0x394
>
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
>
> -> #1 (ect_mutex){+.+.}-{4:4}:
> __mutex_lock_common+0xd8/0xe60
> mutex_lock_nested+0x44/0x50
> cti_add_assoc_to_csdev+0x4c/0x184
> coresight_register+0x2f0/0x314
> tmc_probe+0x33c/0x414
>
> -> #0 (coresight_mutex){+.+.}-{4:4}:
> __lock_acquire+0x1a20/0x32d0
> lock_acquire+0x160/0x308
> __mutex_lock_common+0xd8/0xe60
> mutex_lock_nested+0x44/0x50
> coresight_set_assoc_ectdev_mutex+0x3c/0x5c
> cti_update_conn_xrefs+0x6c/0xf8
> cti_probe+0x33c/0x394
>
> other info that might help us debug this:
> Possible unsafe locking scenario:
> CPU0 CPU1
> ---- ----
> lock(ect_mutex);
> lock(coresight_mutex);
> lock(ect_mutex);
> lock(coresight_mutex);
> *** DEADLOCK ***
>
> 4 locks held by kworker/u12:1/53:
> #0: ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x1fc/0x63c
> #1: (deferred_probe_work){+.+.}-{0:0}, at: process_one_work+0x228/0x63c
> #2: (&dev->mutex){....}-{4:4}, at: __device_attach+0x48/0x1a8
> #3: (ect_mutex){+.+.}-{4:4}, at: cti_probe+0x318/0x394
>
> To fix the same, call cti_add_assoc_to_csdev without the holding
> coresight_mutex and confine the locking while setting the associated
> ect / cti device using coresight_set_assoc_ectdev_mutex().
>
> Cc: Mathieu Poirier <mathieu.poirier(a)linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose(a)arm.com>
> Cc: Mike Leach <mike.leach(a)linaro.org>
> Cc: Leo Yan <leo.yan(a)linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla(a)arm.com>
> ---
> drivers/hwtracing/coresight/coresight-core.c | 7 ++++---
> drivers/hwtracing/coresight/coresight-cti-core.c | 5 +++--
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> Hi,
>
> I am not sure if I missed to consider something, but this is something
> I think could be the fix.
>
> Regards,
> Sudeep
>
I have been running with lockdep testing coresight for a number of
weeks now, without encountering the same issue with CTIs.
That said, I am on a DB410, and the code in question is designed to
take different paths depending on whether the CTI or other device is
discovered first, so this could well be something different in the
discovery order between juno and DB410.
The change looks perfectly fine to me.
As such:
Reviewed-by: Mike Leach <mike.leach(a)linaro.org>
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index 1edfec1e9d18..275b4dce8401 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -1659,14 +1659,15 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
> ret = coresight_fixup_device_conns(csdev);
> if (!ret)
> ret = coresight_fixup_orphan_conns(csdev);
> - if (!ret && cti_assoc_ops && cti_assoc_ops->add)
> - cti_assoc_ops->add(csdev);
>
> out_unlock:
> mutex_unlock(&coresight_mutex);
> /* Success */
> - if (!ret)
> + if (!ret) {
> + if (cti_assoc_ops && cti_assoc_ops->add)
> + cti_assoc_ops->add(csdev);
> return csdev;
> + }
>
> /* Unregister the device if needed */
> if (registered) {
> diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c b/drivers/hwtracing/coresight/coresight-cti-core.c
> index 8988b2ed2ea6..1be92342b5b9 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-core.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-core.c
> @@ -541,7 +541,7 @@ cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name,
> /*
> * Search the cti list to add an associated CTI into the supplied CS device
> * This will set the association if CTI declared before the CS device.
> - * (called from coresight_register() with coresight_mutex locked).
> + * (called from coresight_register() without coresight_mutex locked).
> */
> static void cti_add_assoc_to_csdev(struct coresight_device *csdev)
> {
> @@ -569,7 +569,8 @@ static void cti_add_assoc_to_csdev(struct coresight_device *csdev)
> * if we found a matching csdev then update the ECT
> * association pointer for the device with this CTI.
> */
> - csdev->ect_dev = ect_item->csdev;
> + coresight_set_assoc_ectdev_mutex(csdev->ect_dev,
> + ect_item->csdev);
> break;
> }
> }
> --
> 2.37.1
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
From: Carsten Haitzler <carsten.haitzler(a)arm.com>
This is a prelude to adding more tests to shell tests and in order to
support putting those tests into subdirectories, I need to change the
test code that scans/finds and runs them.
To support subdirs I have to recurse so it's time to refactor the code to
allow this and centralize the shell script finding into one location and
only one single scan that builds a list of all the found tests in memory
instead of it being duplicated in 3 places.
This code also optimizes things like knowing the max width of desciption
strings (as we can do that while we scan instead of a whole new pass
of opening files). It also more cleanly filters scripts to see only
*.sh files thus skipping random other files in directories like *~
backup files, other random junk/data files that may appear and the
scripts must be executable to make the cut (this ensures the script
lib dir is not seen as scripts to run). This avoids perf test running
previous older versions of test scripts that are editor backup files
as well as skipping perf.data files that may appear and so on.
Signed-off-by: Carsten Haitzler <carsten.haitzler(a)arm.com>
Carsten Haitzler (14):
perf test: Refactor shell tests allowing subdirs
perf test: Add CoreSight shell lib shared code for future tests
perf test: Add build infra for perf test tools for CoreSight tests
perf test: Add asm pureloop test tool
perf test: Add asm pureloop test shell script
perf test: Add git ignore for perf data generated by the CoreSight
tests
perf test: Add memcpy thread test tool
perf test: Add memcpy thread test shell script
perf test: Add thread loop test tool
perf test: Add thread loop test shell scripts
perf test: Add unroll thread test tool
perf test: Add unroll thread test shell script
perf test: Add git ignore for tmp and output files of CoreSight tests
perf test: Add relevant documentation about CoreSight testing
.../trace/coresight/coresight-perf.rst | 158 +++++++++++++
MAINTAINERS | 1 +
tools/perf/.gitignore | 6 +-
.../perf/Documentation/perf-arm-coresight.txt | 5 +
tools/perf/Makefile.config | 2 +
tools/perf/Makefile.perf | 17 +-
tools/perf/tests/Build | 1 +
tools/perf/tests/builtin-test-list.c | 207 ++++++++++++++++++
tools/perf/tests/builtin-test-list.h | 12 +
tools/perf/tests/builtin-test.c | 152 ++-----------
tools/perf/tests/shell/coresight/Makefile | 30 +++
.../tests/shell/coresight/Makefile.miniconfig | 14 ++
.../tests/shell/coresight/asm_pure_loop.sh | 18 ++
.../shell/coresight/asm_pure_loop/.gitignore | 1 +
.../shell/coresight/asm_pure_loop/Makefile | 34 +++
.../coresight/asm_pure_loop/asm_pure_loop.S | 28 +++
.../shell/coresight/memcpy_thread/.gitignore | 1 +
.../shell/coresight/memcpy_thread/Makefile | 33 +++
.../coresight/memcpy_thread/memcpy_thread.c | 79 +++++++
.../shell/coresight/memcpy_thread_16k_10.sh | 18 ++
.../shell/coresight/thread_loop/.gitignore | 1 +
.../shell/coresight/thread_loop/Makefile | 33 +++
.../shell/coresight/thread_loop/thread_loop.c | 86 ++++++++
.../coresight/thread_loop_check_tid_10.sh | 19 ++
.../coresight/thread_loop_check_tid_2.sh | 19 ++
.../coresight/unroll_loop_thread/.gitignore | 1 +
.../coresight/unroll_loop_thread/Makefile | 33 +++
.../unroll_loop_thread/unroll_loop_thread.c | 74 +++++++
.../shell/coresight/unroll_loop_thread_10.sh | 18 ++
tools/perf/tests/shell/lib/coresight.sh | 132 +++++++++++
30 files changed, 1094 insertions(+), 139 deletions(-)
create mode 100644 Documentation/trace/coresight/coresight-perf.rst
create mode 100644 tools/perf/Documentation/perf-arm-coresight.txt
create mode 100644 tools/perf/tests/builtin-test-list.c
create mode 100644 tools/perf/tests/builtin-test-list.h
create mode 100644 tools/perf/tests/shell/coresight/Makefile
create mode 100644 tools/perf/tests/shell/coresight/Makefile.miniconfig
create mode 100755 tools/perf/tests/shell/coresight/asm_pure_loop.sh
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c
create mode 100755 tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/thread_loop.c
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loop_thread.c
create mode 100755 tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
create mode 100644 tools/perf/tests/shell/lib/coresight.sh
--
2.32.0
From: "Carsten Haitzler (Rasterman)" <raster(a)rasterman.com>
This is a prelude to adding more tests to shell tests and in order to
support putting those tests into subdirectories, I need to change the
test code that scans/finds and runs them.
To support subdirs I have to recurse so it's time to refactor the code to
allow this and centralize the shell script finding into one location and
only one single scan that builds a list of all the found tests in memory
instead of it being duplicated in 3 places.
This code also optimizes things like knowing the max width of desciption
strings (as we can do that while we scan instead of a whole new pass
of opening files). It also more cleanly filters scripts to see only
*.sh files thus skipping random other files in directories like *~
backup files, other random junk/data files that may appear and the
scripts must be executable to make the cut (this ensures the script
lib dir is not seen as scripts to run). This avoids perf test running
previous older versions of test scripts that are editor backup files
as well as skipping perf.data files that may appear and so on.
Signed-off-by: Carsten Haitzler <carsten.haitzler(a)arm.com>
Carsten Haitzler (Rasterman) (14):
perf test: Refactor shell tests allowing subdirs
perf test: Add CoreSight shell lib shared code for future tests
perf test: Add build infra for perf test tools for CoreSight tests
perf test: Add asm pureloop test tool
perf test: Add asm pureloop test shell script
perf test: Add git ignore for perf data generated by the CoreSight
tests
perf test: Add memcpy thread test tool
perf test: Add memcpy thread test shell script
perf test: Add thread loop test tool
perf test: Add thread loop test shell scripts
perf test: Add unroll thread test tool
perf test: Add unroll thread test shell script
perf test: Add git ignore for tmp and output files of CoreSight tests
perf test: Add relevant documentation about CoreSight testing
.../trace/coresight/coresight-perf.rst | 158 +++++++++++++
MAINTAINERS | 1 +
tools/perf/.gitignore | 6 +-
.../perf/Documentation/perf-arm-coresight.txt | 5 +
tools/perf/Makefile.config | 2 +
tools/perf/Makefile.perf | 17 +-
tools/perf/tests/Build | 1 +
tools/perf/tests/builtin-test-list.c | 207 ++++++++++++++++++
tools/perf/tests/builtin-test-list.h | 12 +
tools/perf/tests/builtin-test.c | 152 ++-----------
tools/perf/tests/shell/coresight/Makefile | 30 +++
.../tests/shell/coresight/Makefile.miniconfig | 14 ++
.../tests/shell/coresight/asm_pure_loop.sh | 18 ++
.../shell/coresight/asm_pure_loop/.gitignore | 1 +
.../shell/coresight/asm_pure_loop/Makefile | 34 +++
.../coresight/asm_pure_loop/asm_pure_loop.S | 28 +++
.../shell/coresight/memcpy_thread/.gitignore | 1 +
.../shell/coresight/memcpy_thread/Makefile | 33 +++
.../coresight/memcpy_thread/memcpy_thread.c | 79 +++++++
.../shell/coresight/memcpy_thread_16k_10.sh | 18 ++
.../shell/coresight/thread_loop/.gitignore | 1 +
.../shell/coresight/thread_loop/Makefile | 33 +++
.../shell/coresight/thread_loop/thread_loop.c | 86 ++++++++
.../coresight/thread_loop_check_tid_10.sh | 19 ++
.../coresight/thread_loop_check_tid_2.sh | 19 ++
.../coresight/unroll_loop_thread/.gitignore | 1 +
.../coresight/unroll_loop_thread/Makefile | 33 +++
.../unroll_loop_thread/unroll_loop_thread.c | 74 +++++++
.../shell/coresight/unroll_loop_thread_10.sh | 18 ++
tools/perf/tests/shell/lib/coresight.sh | 132 +++++++++++
30 files changed, 1094 insertions(+), 139 deletions(-)
create mode 100644 Documentation/trace/coresight/coresight-perf.rst
create mode 100644 tools/perf/Documentation/perf-arm-coresight.txt
create mode 100644 tools/perf/tests/builtin-test-list.c
create mode 100644 tools/perf/tests/builtin-test-list.h
create mode 100644 tools/perf/tests/shell/coresight/Makefile
create mode 100644 tools/perf/tests/shell/coresight/Makefile.miniconfig
create mode 100755 tools/perf/tests/shell/coresight/asm_pure_loop.sh
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c
create mode 100755 tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/thread_loop.c
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loop_thread.c
create mode 100755 tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
create mode 100644 tools/perf/tests/shell/lib/coresight.sh
--
2.32.0
From: "Carsten Haitzler (Rasterman)" <raster(a)rasterman.com>
This is a prelude to adding more tests to shell tests and in order to
support putting those tests into subdirectories, I need to change the
test code that scans/finds and runs them.
To support subdirs I have to recurse so it's time to refactor the code to
allow this and centralize the shell script finding into one location and
only one single scan that builds a list of all the found tests in memory
instead of it being duplicated in 3 places.
This code also optimizes things like knowing the max width of desciption
strings (as we can do that while we scan instead of a whole new pass
of opening files). It also more cleanly filters scripts to see only
*.sh files thus skipping random other files in directories like *~
backup files, other random junk/data files that may appear and the
scripts must be executable to make the cut (this ensures the script
lib dir is not seen as scripts to run). This avoids perf test running
previous older versions of test scripts that are editor backup files
as well as skipping perf.data files that may appear and so on.
Signed-off-by: Carsten Haitzler <carsten.haitzler(a)arm.com>
Carsten Haitzler (Rasterman) (14):
perf test: Refactor shell tests allowing subdirs
perf test: Add CoreSight shell lib shared code for future tests
perf test: Add build infra for perf test tools for CoreSight tests
perf test: Add asm pureloop test tool
perf test: Add asm pureloop test shell script
perf test: Add git ignore for perf data generated by the CoreSight
tests
perf test: Add memcpy thread test tool
perf test: Add memcpy thread test shell script
perf test: Add thread loop test tool
perf test: Add thread loop test shell scripts
perf test: Add unroll thread test tool
perf test: Add unroll thread test shell script
perf test: Add git ignore for tmp and output files of CoreSight tests
perf test: Add relevant documentation about CoreSight testing
.../trace/coresight/coresight-perf.rst | 160 ++++++++++++++
MAINTAINERS | 1 +
tools/perf/.gitignore | 6 +-
tools/perf/Documentation/arm-coresight.txt | 5 +
tools/perf/Makefile.perf | 18 +-
tools/perf/tests/Build | 1 +
tools/perf/tests/builtin-test-list.c | 207 ++++++++++++++++++
tools/perf/tests/builtin-test-list.h | 12 +
tools/perf/tests/builtin-test.c | 152 ++-----------
tools/perf/tests/shell/coresight/Makefile | 30 +++
.../tests/shell/coresight/Makefile.miniconfig | 24 ++
.../tests/shell/coresight/asm_pure_loop.sh | 18 ++
.../shell/coresight/asm_pure_loop/.gitignore | 1 +
.../shell/coresight/asm_pure_loop/Makefile | 34 +++
.../coresight/asm_pure_loop/asm_pure_loop.S | 28 +++
.../shell/coresight/memcpy_thread/.gitignore | 1 +
.../shell/coresight/memcpy_thread/Makefile | 33 +++
.../coresight/memcpy_thread/memcpy_thread.c | 79 +++++++
.../shell/coresight/memcpy_thread_16k_10.sh | 18 ++
.../shell/coresight/thread_loop/.gitignore | 1 +
.../shell/coresight/thread_loop/Makefile | 33 +++
.../shell/coresight/thread_loop/thread_loop.c | 86 ++++++++
.../coresight/thread_loop_check_tid_10.sh | 19 ++
.../coresight/thread_loop_check_tid_2.sh | 19 ++
.../coresight/unroll_loop_thread/.gitignore | 1 +
.../coresight/unroll_loop_thread/Makefile | 33 +++
.../unroll_loop_thread/unroll_loop_thread.c | 74 +++++++
.../shell/coresight/unroll_loop_thread_10.sh | 18 ++
tools/perf/tests/shell/lib/coresight.sh | 132 +++++++++++
29 files changed, 1105 insertions(+), 139 deletions(-)
create mode 100644 Documentation/trace/coresight/coresight-perf.rst
create mode 100644 tools/perf/Documentation/arm-coresight.txt
create mode 100644 tools/perf/tests/builtin-test-list.c
create mode 100644 tools/perf/tests/builtin-test-list.h
create mode 100644 tools/perf/tests/shell/coresight/Makefile
create mode 100644 tools/perf/tests/shell/coresight/Makefile.miniconfig
create mode 100755 tools/perf/tests/shell/coresight/asm_pure_loop.sh
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c
create mode 100755 tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/Makefile
create mode 100644 tools/perf/tests/shell/coresight/thread_loop/thread_loop.c
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
create mode 100755 tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/.gitignore
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/Makefile
create mode 100644 tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loop_thread.c
create mode 100755 tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
create mode 100644 tools/perf/tests/shell/lib/coresight.sh
--
2.32.0
Hi Christoph.
[adding in Suzuki and Mathieu who maintain the coresight subsystem & lists]
You are correct - in this patchset we are adding the use of a binary
attribute to load and unload Coresight configurations and features -
which action has a side effect of adding and removing entries in
particular sub-directories in our configfs sub-system.
Our use case for configfs is somewhat more complex than the other
existing usages - such as ACPI, where the format of the directory
structure and attributes is static, and known ahead of time.
The CoreSight configurations have variable numbers of attributes
appearing in the configfs directories - so the attribute arrays are
built dynamically at load time. The load process and also result in
elements appearing in both the cs-syscfg/configurations and the
cs-syscfg/features sub directories. This dynamic nature and split
elements means that the traditional mkdir/rmdir configfs paradigm
cannot be made to work.
We currently have two methods upstreamed for loading configurations, 1
is a configuration directly built into the coresight core code, and
the other is to allow configurations to be loaded as kernel loadable
modules.
However these 2 are dependent on compile time operations, and have
kernel dependencies.
Hence we have introduced the direct load via configfs binary attribute
- which is more portable, flexible and convenient for the end user.
I appreciate that this may not be a usage you anticipated for
configfs, but it does serve our purposes very well, and as far a I can
tell from examination of configfs code and considerable testing, works
fine and does not have any operational issues, other than the lockdep
warnings on unload, which are caused be the fragment locks (lockdep
being confused by holding the fragment for the initial cs-syscfg root
system, and the one for the sub-directory we want to unload).
I am open to suggestions for a different way of doing this within the
established directory structure we need to maintain.
Thanks and Regards
Mike
On Fri, 29 Jul 2022 at 14:24, Christoph Hellwig <hch(a)lst.de> wrote:
>
> On Fri, Jul 29, 2022 at 07:41:00AM +0100, Mike Leach wrote:
> > Sure - see below
> >
> > Happens during the unload process of the coresight configuration.
>
> Hmm. It seems like youre bin_attr ->write handler (which gets called
> from configfs_release_bin_file) tries to unregister a group. That's
> not really how the configfs API is supposed to be used.
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
Hi all,
I have a system that only has an ETF as a trace sink, so I only have 8 kB of memory available for my trace, which limits me to quite small programs.
What would be the go-to solution for longer trace-runs, when I want to do on-device-trace-capturing? Is it possible at all with my setup?
It is important that I don't loose any trace, I need a trace of the whole execution. For tracing I use CSAL.
Best regards,
Finn
Hi Bhupesh,
On 03/08/2022 20:12, Bhupesh Sharma wrote:
> Some Qualcomm ETM implementations require skipping powering up
> the trace unit, as the ETMs are in the same power domain as
> their CPU cores.
>
> Via commit 5214b563588e ("coresight: etm4x: Add support for
> sysreg only devices"), the setting of 'skip_power_up' flag was
> moved after the 'etm4_init_arch_data' function is called, whereas
> the flag value is itself used inside the function. This causes
> a crash when ETM mode 'Low-power state behavior override' is set
> on some Qualcomm parts.
>
> Fix the same.
>
Thanks for the patch. The patch is correct. But please see my comment
below.
> Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices")
> Cc: Mike Leach <mike.leach(a)linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose(a)arm.com>
> Cc: Mathieu Poirier <mathieu.poirier(a)linaro.org>
> Cc: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
> Signed-off-by: Bhupesh Sharma <bhupesh.sharma(a)linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index d39660a3e50c..cf6254b87fd5 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -1943,6 +1943,16 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)
> init_arg.csa = &desc.access;
> init_arg.pid = etm_pid;
>
> + /*
> + * Some Qualcomm implementations require skipping powering up the trace unit,
> + * as the ETMs are in the same power domain as their CPU cores.
> + *
> + * Since the 'skip_power_up' flag is used inside 'etm4_init_arch_data' function,
> + * initialize it before the function is called.
> + */
> + if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up"))
> + drvdata->skip_power_up = true;
> +
> if (smp_call_function_single(drvdata->cpu,
> etm4_init_arch_data, &init_arg, 1))
> dev_err(dev, "ETM arch init failed\n");
> @@ -1951,8 +1961,7 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)
> return -EINVAL;
>
> /* TRCPDCR is not accessible with system instructions. */
> - if (!desc.access.io_mem ||
> - fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up"))
> + if (!desc.access.io_mem)
> drvdata->skip_power_up = true;
>
Please could you move this setting into "etm4_init_sysreg_access()" ? It
looks a bit odd to split the check in the same function. Moving this to
the sysreg_access() makes it explicit.
Suzuki
> major = ETM_ARCH_MAJOR_VERSION(drvdata->arch);
This is a prelude to adding more tests to shell tests and in order to
support putting those tests into subdirectories, I need to change the
test code that scans/finds and runs them.
To support subdirs I have to recurse so it's time to refactor the code to
allow this and centralize the shell script finding into one location and
only one single scan that builds a list of all the found tests in memory
instead of it being duplicated in 3 places.
This code also optimizes things like knowing the max width of desciption
strings (as we can do that while we scan instead of a whole new pass
of opening files). It also more cleanly filters scripts to see only
*.sh files thus skipping random other files in directories like *~
backup files, other random junk/data files that may appear and the
scripts must be executable to make the cut (this ensures the script
lib dir is not seen as scripts to run). This avoids perf test running
previous older versions of test scripts that are editor backup files
as well as skipping perf.data files that may appear and so on.
Signed-off-by: Carsten Haitzler <carsten.haitzler(a)arm.com>