As I asked before, please include the coresight mailing list when discussing coresight.
On Mon, 16 Dec 2019 at 15:20, zied guermazi guermazi_zied@yahoo.com wrote:
hi Mike, hi Mathieu last few weeks I was able to spend some time on implementing this feature, and I want to share the status with you and get your recommendation on organizational and technical level. so far I was able to use perf events to configure the drivers for etm and collect the traces. the code was tested successfully on an STM32MP157A discovery kit (arm v7).
Perfect, I happen to have one like that as well.
I would like to push this on git, first for review and second for integration and creating traction . Do you think it is ok to push it in this status (feature partially achieved) ? is linaro gdb git the correct one? who is > the maintainer of this part of gdb? I do not have an ARMv8 platform to test. who can support here?
Mike's reply on the above was correct. You can use a personal git repository and get a dragonboard 410c. They are inexpensive and it is one of our reference platforms.
during the implementation few technical question raised:
- etm tracing collection requires selecting a trace sink. and I have two alternatives: either extending the "record btrace etm" command (used to start tracing) with a sink as an argument or extending the command "set record btrace" (general configuration of tracing) with etm sink sub-command? (I have hard-coded it currently to be able to progress)
- currently I am hardcoding the path "/sys/bus/event_source/devices/cs_etm/" as the default etm source, is this guaranteed to be unique? can we have a system with many etm sources enumerated in the sysfs.
This question worries me a lot... There is one ETM per CPU.
for parsing the traces I will need some configuration parameters like the content of registers ETMCR, ETMIDR, ETMCCER, ETMTRACEIDR. if my understanding of the implementation of perf is correct, it is collecting them from the sysfs files located in /sys/bus/event_source/devices/cs_etm/cpu0/mgmt/. which are global for the system. my question is what will happen if two process are requesting tracing at the same time? how to differentiate between traces going to one session from the second one? is it possible to get the parameters of a given session by some kind of ioctl request to the file descriptor we get out of sys_perf_open call?
To complement Mike's reply HW specifics related to the implementation are fetched from sysfs because, in user space, there is no other way to get that information. Event specific configuration are dynamically taken from the command line. As such the configuration for each event is unique and doesn't trample one another.
I will publish those queries in the linaro coresight and gdb forums, I wanted first to align with you especially on the organizational issues, before going to a bigger round.
I advise you to take the time needed to really understand how the coresight subsystem works before moving forward. More specifically process and CPU wide trace scenarios differ along with how trace configuration are handled from the perf command line all the way to the decoding phase.
Thanks for your support Zied Guermazi