On Tue, 21 Apr 2020 at 12:19, zied guermazi guermazi_zied@yahoo.com wrote:
Hi Al, coresight tracing support is also being integrated into gdb, this is done by using
perf events at the system level. if my understanding is correct, with this patch, the default sink selection is done at the kernel level.
- how can the application get this info back (current/default sink)?
The selection of a default sink will only occur if the user space perf / command line does not select a sink. The mechanisms for selecting a specific sink remain unchanged. So assuming GDB is currently specifying a sink for the perf event, then this will continue to work, the sink will be passed to the kernel drivers and that is the sink used.
Right... the point of specifying the sink, is, firstly, to tell the kernel how to find a sink if it doesn't know how, and secondly, to influence whether it uses ETB or ETR (and perhaps the size of the ETR memory buffer) if it wants to trade off probe effect vs. buffer size. It should not affect the data returned and the client should not be sensitive to which sink was used. There should be no need for the client to know what sink was used.
An expert using ETM for performance analysis might be interested in which sinks were used, so it might be something to return in AUXTRACE_INFO... but that's just a bonus. It should never be necessary to know this, and the kernel might even want to withhold the information.
What would be reasonable is to have something in each AUX buffer that says the set of CPUs that the AUX buffer is for... this might be useful for decode, and is generic rather than exposing details of trace topology.
My understanding is that a sink is chosen by perf on a per session basis - so again, this should continue to work in cases where a sink is specified for an application.
That's my understanding too.
Al
Regards
Mike
thanks Zied Guermazi
On Tuesday, April 21, 2020, 12:41:40 PM GMT+2, Mike Leach
mike.leach@linaro.org wrote:
Hi Al,
On Thu, 16 Apr 2020 at 22:03, Al Grant Al.Grant@arm.com wrote:
This patchset provides a proposed infrastructure to allow for the automatic selection of a sink during CoreSight tracing operations.
Currently starting tracing using perf requires a sink selection on the command line:-
sudo ./perf record -e cs_etm/@tmc_etr0/ --per-thread uname -a
After this set the infrastructure will be able to select a default sink:-
sudo ./perf record -e cs_etm// --per-thread uname -a
This matches with the default operation provided with perf and intelpt.
The CoreSight infrastructure is updated to allow the concept of a "principal
sink".
For any given source there could be multiple possible sinks available for selection. However, there are no good programmatic ways to determine the optimal sink for a given topolgy. For any given rule (e.g. first sink found, first ETR, last ETR), there exists a possible
platform / topology that will not be suitable.
While "first ETR" may not be optimal or even possible, it nearly always is both optimal and possible. So it's a good default rule and it would be useful to have a default rule. That would allow -e cs_etm// to immediately do something useful with most devices and with ACPI, in advance of an ACPI binding for the "principal_sink" flag.
That's certainly feasible - and would potentially benefit any system without updated bindings, not just ACPI
Regards
Mike
Therefore, we select the principal sink using a property in the device tree. This allows the routine to select the best possible for the situation.
The only rule for selecting such sinks, is that there should only be one principal sink marked for any given source, across all possible paths from that source to any sinks. (if this rule is violated then the first found will be used)
Therefore to select a sink, we start with the source, and walk the child connections until a sink marked as a principal sink is found.
Applied to Linux 5.7-rc1 (with dts updates 1,2), tested on Juno / DB410
Note A: Moving forward to topologies which have groups of sources going to dedicated sinks e.g. multisocket / multicluster where each socket / cluster has a sink, then multiple sinks can be marked as
principal sink, one for each cluster.
The same applies to 1:1 ETM:sink topolgy were each sink will be marked.
Note B: The current set does not auto-select when using sysfs, but I believe this could easily be added.
[1] https://lists.linaro.org/pipermail/coresight/2020-April/003819.htm l [2] https://lists.linaro.org/pipermail/coresight/2020-April/003821.htm l
Mike Leach (5): coresight: Add principal sink handling to CoreSight base coresight: tmc: Add principal sink attribute detection coresight: etm: perf: Add default sink selection to etm perf perf: cs-etm: Allow no CoreSight sink to be specified on command line dt-bindings: arm: qcom: Add CoreSight principal sink select parameters
arch/arm64/boot/dts/arm/juno-base.dtsi | 1 + arch/arm64/boot/dts/qcom/msm8916.dtsi | 1 + .../hwtracing/coresight/coresight-etm-perf.c | 20 +++++++++-- drivers/hwtracing/coresight/coresight-priv.h | 2 ++ drivers/hwtracing/coresight/coresight-tmc.c | 9 +++++ drivers/hwtracing/coresight/coresight.c | 34 +++++++++++++++++++ include/linux/coresight.h | 7 ++++ tools/perf/arch/arm/util/cs-etm.c | 6 ++-- 8 files changed, 74 insertions(+), 6 deletions(-)
-- 2.17.1
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight
-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.