linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: linux-perf-users@vger.kernel.org
Cc: James Clark <james.clark@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>,
	John Garry <john.g.garry@oracle.com>,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org, coresight@lists.linaro.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] perf cs-etm: Handle per-thread mode on EL1 host kernel case
Date: Mon, 26 Jun 2023 17:10:57 +0100	[thread overview]
Message-ID: <20230626161059.324046-2-james.clark@arm.com> (raw)
In-Reply-To: <20230626161059.324046-1-james.clark@arm.com>

In per-thread mode there are no context packets so no way to determine
which type of context packets exist. But because it's only possible to
trace host processes in per-thread mode without context packets then
assume host in this case.

This fixes the per-thread test case failures when running on nVHE:

  98: Check Arm CoreSight trace data recording and synthesized samples:
  --- start ---
  ...
  Recording trace with '-e cs_etm/timestamp=0/ --per-thread'
  Looking at perf.data file for dumping branch samples:
  CoreSight basic testing with '-e cs_etm/timestamp=0/ --per-thread': FAIL
  Recording trace with '-e cs_etm/timestamp=1/ --per-thread'
  Looking at perf.data file for dumping branch samples:
  CoreSight basic testing with '-e cs_etm/timestamp=1/ --per-thread': FAIL
  ...

Fixes: 8d3031d39fe8 ("perf cs-etm: Track exception level")
Signed-off-by: James Clark <james.clark@arm.com>
---
 tools/perf/util/cs-etm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 1419b40dfbe8..85821cc5650e 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -900,10 +900,17 @@ static struct machine *cs_etm__get_machine(struct cs_etm_queue *etmq,
 
 	/*
 	 * For any virtualisation based on nVHE (e.g. pKVM), or host kernels
-	 * running at EL1 assume everything is the host.
+	 * running at EL1, or no context IDs (per-thread mode) assume everything
+	 * is the host.
 	 */
-	if (pid_fmt == CS_ETM_PIDFMT_CTXTID)
+	switch (pid_fmt) {
+	case CS_ETM_PIDFMT_CTXTID:
+	case CS_ETM_PIDFMT_NONE:
 		return &etmq->etm->session->machines.host;
+	case CS_ETM_PIDFMT_CTXTID2:
+	default:
+		break;
+	}
 
 	/*
 	 * Not perfect, but otherwise assume anything in EL1 is the default
-- 
2.34.1


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

  reply	other threads:[~2023-06-26 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 16:10 [PATCH 0/2] perf cs-etm: Track exception level fixups James Clark
2023-06-26 16:10 ` James Clark [this message]
2023-06-26 16:10 ` [PATCH 2/2] perf report: Don't add to histogram when there is no thread found James Clark
2023-06-27  0:02   ` Namhyung Kim
2023-06-27 16:42     ` Ian Rogers
2023-06-27 16:57       ` Namhyung Kim
2023-06-27 17:19         ` Ian Rogers
2023-06-28 10:34           ` James Clark
2023-06-28 20:06             ` Namhyung Kim
2023-06-30 21:02               ` Namhyung Kim
2023-07-03  8:18                 ` James Clark

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=20230626161059.324046-2-james.clark@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=irogers@google.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).