[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 17:57:05 EST 2020
Mike,
Related to this patch, I have a question about the print decoder
in OpenCSD. Withe TRCCONFIGR.VMIDOPT, we have CONTEXTIDR_EL2 in
VMID instead of the real VMID. Does it make sense to change the
print decoder to reflect this in the o/p ?
i.e, instead of :
Idx:530; ID:14; I_ADDR_CTXT_L_64IS0 .. Ctxt: AArch64,EL0, NS; VMID=0xAA;
Could this be
Idx:530; ID:14; I_ADDR_CTXT_L_64IS0 .. Ctxt: AArch64,EL0, NS; CID2=0xAA;
with VMIDOPT ?
I understand it is a bit naive, and there are widespread users of
OpenCSD and it could potentially break any existing users. But worth
checking.
Cheers
Suzuki
On 11/10/20 6:33 PM, Suzuki K Poulose wrote:
> 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;
> }
>
More information about the linux-arm-kernel
mailing list