public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: al.grant@arm.com, mathieu.poirier@linaro.org,
	anshuman.khandual@arm.com, coresight@lists.linaro.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	leo.yan@linaro.org, mike.leach@linaro.org
Subject: [PATCH 3/3] rfc: perf: cs_etm: Detect pid in VMID for kernel running at EL2
Date: Tue, 10 Nov 2020 18:33:13 +0000	[thread overview]
Message-ID: <20201110183313.1823760-4-suzuki.poulose@arm.com> (raw)
In-Reply-To: <20201110183313.1823760-1-suzuki.poulose@arm.com>

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@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-10 18:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 18:33 [PATCH 0/3] coresight: etm-perf: Fix pid tracing with VHE Suzuki K Poulose
2020-11-10 18:33 ` [PATCH 1/3] coresight: etm-perf: Add support for PID tracing for kernel at EL2 Suzuki K Poulose
2020-11-12 10:27   ` Leo Yan
2020-11-12 12:41     ` Suzuki K Poulose
2020-11-10 18:33 ` [PATCH 2/3] perf: cs_etm: Use pid tracing explicitly instead of contextid Suzuki K Poulose
2020-11-12 10:00   ` Leo Yan
2020-11-12 10:54     ` Suzuki K Poulose
2020-11-12 12:24       ` Leo Yan
2020-11-10 18:33 ` Suzuki K Poulose [this message]
2020-11-10 22:57   ` [PATCH 3/3] rfc: perf: cs_etm: Detect pid in VMID for kernel running at EL2 Suzuki K Poulose
2020-11-11 11:03   ` Al Grant
2020-11-11 11:40     ` Suzuki K Poulose
2020-11-13  0:11       ` Leo Yan
2020-11-13  9:47         ` Suzuki K Poulose
2020-11-13 10:42           ` Leo Yan
2020-11-16  9:46           ` Leo Yan
2020-12-18 10:46             ` Daniel Kiss
     [not found]               ` <CADDJ8CVqz8Gdkx42H+TjdBOS-Vjk4MAVV7PhAaeBNq9Ejh=usA@mail.gmail.com>
2020-12-23  8:05                 ` Leo Yan
2021-01-04 17:33                   ` Suzuki K Poulose
2021-01-04 18:06                     ` Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201110183313.1823760-4-suzuki.poulose@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=al.grant@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox