[PATCH 3/3] rfc: perf: cs_etm: Detect pid in VMID for kernel running at EL2
Suzuki K Poulose
suzuki.poulose at arm.com
Tue Nov 10 13:33:13 EST 2020
The pid of the task could be traced as VMID when the kernel is
running at EL2. Teach the decoder to look for vmid when the
context_id is invalid but we have a valid VMID.
Cc: Mike Leach <mike.leach at linaro.org>
Cc: Leo Yan <leo.yan at linaro.org>
Cc: Mathieu Poirier <mathieu.poirier at linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose at arm.com>
---
Ideally, we should also confirm that the VMID_OPT is also set
in the trcconfigr for choosing the VMID. Hence the RFC. May be
that is something we could cache in the "decoder" instance ?
---
.../perf/util/cs-etm-decoder/cs-etm-decoder.c | 28 +++++++++++--------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index cd007cc9c283..31ba7ff57914 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -502,19 +502,25 @@ cs_etm_decoder__set_tid(struct cs_etm_queue *etmq,
{
pid_t tid;
- /* Ignore PE_CONTEXT packets that don't have a valid contextID */
- if (!elem->context.ctxt_id_valid)
- return OCSD_RESP_CONT;
-
- tid = elem->context.context_id;
- if (cs_etm__etmq_set_tid(etmq, tid, trace_chan_id))
- return OCSD_RESP_FATAL_SYS_ERR;
-
/*
- * A timestamp is generated after a PE_CONTEXT element so make sure
- * to rely on that coming one.
+ * Process the PE_CONTEXT packets if we have a valid
+ * contextID or VMID.
+ * If the kernel is running at EL2, the PID is traced
+ * in contextidr_el2 as VMID.
*/
- cs_etm_decoder__reset_timestamp(packet_queue);
+ if (elem->context.ctxt_id_valid || elem->context.vmid_valid) {
+ if (elem->context.ctxt_id_valid)
+ tid = elem->context.context_id;
+ else
+ tid = elem->context.vmid;
+ if (cs_etm__etmq_set_tid(etmq, tid, trace_chan_id))
+ return OCSD_RESP_FATAL_SYS_ERR;
+ /*
+ * A timestamp is generated after a PE_CONTEXT element so make sure
+ * to rely on that coming one.
+ */
+ cs_etm_decoder__reset_timestamp(packet_queue);
+ }
return OCSD_RESP_CONT;
}
--
2.24.1
More information about the linux-arm-kernel
mailing list