Re: [PATCH] coresight: core: Add sysfs node to reset all sources and sinks

From: Jinlong Mao
Date: Wed Mar 01 2023 - 10:04:42 EST


Hi Mike & Suzuki,

On 2/9/2023 10:56 PM, Mike Leach wrote:
Hi,

On Thu, 9 Feb 2023 at 03:02, Jinlong Mao <quic_jinlmao@xxxxxxxxxxx> wrote:

On 2/9/2023 12:36 AM, Suzuki K Poulose wrote:
On 08/02/2023 16:20, Mike Leach wrote:
Quick correction - you need to look for enable_source / enable_sink
files and disable those that are currently '1'

Mike

On Wed, 8 Feb 2023 at 16:16, Mike Leach <mike.leach@xxxxxxxxxx> wrote:
Hi

As this is a sysfs only update - would it not be easier to simply use
a shell script to iterate through coresight/devices/ looking for
disable_source / disable_sink files and setting those accordingly?

See tools/perf/tests/shell/test_arm_coresight.sh for an example of a
script that does similar iteration to test coresight in perf

+1

Suzuki
Hi Mike & Suzuki,

Sometimes user just want to have some quick test from PC with adb commands.
It is very easy to reset all sources and sinks' status by command below.
echo 1 > /sys/bus/coresight/reset_source_sink

Users of coresight via sysfs will have to know how to use the
coresight infrastructure in order to enable the sources and sinks in
the first place -
e.g
echo 1 > /sys/bus/coresight/devices/tmc_etr0/enable_sink
echo 1 > /sys/bus/coresight/devices/etm0/enable_source

Given that they are aware of which sources and sinks they enabled -
disabling them should be simple.


Preparing the script for test is not easy for users who are not familiar
with the coresight framework.

If there is a genuine use case were a user has opened so many sources
on the command line that they need a simpler way of closing them than
repeating the enabled commands with an
echo 0 > ...
then any script could be shipped as part of kernel/tools/coresight or
kernel/samples/coresight - they would not have to write it themselves,
and just run it from the command line - for example :-
./kernel/tools/coresight/scripts/sysfs_disable_sources_and_sinks.sh

Realistically users will only try out a couple of devices as the
usefulness of the sysfs interface is really limited to testing or
board bring up.
Any complex use with sysfs - as in the coresight tests I mentioned
earlier is really going to be done by scripting.


Regards

Mike

There is also requirement that reset all the sources and sinks in an user space daemon.
For such requirement, I think it is better to use only once sysfs node instead of iterating through coresight/device folder in an user space daemon.

Thanks
Jinlong Mao

Thanks
Jinlong Mao