From: James Clark <james.clark@arm.com>
To: Leo Yan <leo.yan@linaro.org>
Cc: John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
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>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH v1 2/2] perf cs-etm: Enable itrace option 'T'
Date: Thu, 19 Oct 2023 11:38:57 +0100 [thread overview]
Message-ID: <dd55c313-632e-cf18-161a-50ac6632feb4@arm.com> (raw)
In-Reply-To: <20231014074513.1668000-3-leo.yan@linaro.org>
On 14/10/2023 08:45, Leo Yan wrote:
> Prior to Armv8.4, the feature FEAT_TRF is not supported by Arm CPUs.
> Consequently, the sysfs node 'ts_source' will not be set as 1 by the
> CoreSight ETM driver. On the other hand, the perf tool relies on the
> 'ts_source' node to determine whether the kernel timestamp is traced.
> Since the 'ts_source' is not set for Arm CPUs prior to Armv8.4,
> platforms in this case cannot utilize the traced timestamp as the kernel
> time.
>
> This patch enables the 'T' itrace option, which forcibly utilizes the
> traced timestamp as the kernel time. If users are aware that their
> working platform's Arm CoreSight shares the same counter with the kernel
> time, they can specify 'T' option to decode the traced timestamp as the
> kernel time.
>
> An usage example is:
>
> # perf record -e cs_etm// -- test_program
> # perf script --itrace=i10ibT
> # perf report --itrace=i10ibT
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
> tools/perf/util/cs-etm.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 9729d006550d..4a37fdeb1795 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -3322,12 +3322,27 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
> etm->metadata = metadata;
> etm->auxtrace_type = auxtrace_info->type;
>
> - /* Use virtual timestamps if all ETMs report ts_source = 1 */
> - etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, num_cpu);
> + if (etm->synth_opts.use_timestamp)
> + /*
> + * Prior to Armv8.4, Arm CPUs don't support FEAT_TRF feature,
> + * therefore the decoder cannot know if the timestamp trace is
> + * same with the kernel time.
> + *
> + * If a user has knowledge for the working platform and can
> + * specify itrace option 'T' to tell decoder to forcely use the
> + * traced timestamp as the kernel time.
> + */
> + etm->has_virtual_ts = true;
> + else
> + /* Use virtual timestamps if all ETMs report ts_source = 1 */
> + etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, num_cpu);
>
> if (!etm->has_virtual_ts)
> ui__warning("Virtual timestamps are not enabled, or not supported by the traced system.\n"
> - "The time field of the samples will not be set accurately.\n\n");
> + "The time field of the samples will not be set accurately.\n"
> + "For Arm CPUs prior to Armv8.4 or without support FEAT_TRF,\n"
> + "you can specify the itrace option 'T' for timestamp decoding\n"
> + "if the Coresight timestamp on the platform is same with the kernel time.\n\n");
>
> etm->auxtrace.process_event = cs_etm__process_event;
> etm->auxtrace.process_auxtrace_event = cs_etm__process_auxtrace_event;
Reviewed-by: James Clark <james.clark@arm.com>
prev parent reply other threads:[~2023-10-19 10:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-14 7:45 [PATCH v1 0/2] perf cs-etm: Add support for " Leo Yan
2023-10-14 7:45 ` [PATCH v1 1/2] perf auxtrace: Add 'T' itrace option for timestamp trace Leo Yan
2023-10-19 10:31 ` James Clark
2023-10-19 11:52 ` Leo Yan
2023-10-19 10:47 ` Adrian Hunter
2023-10-19 11:17 ` James Clark
2023-11-06 21:52 ` Arnaldo Carvalho de Melo
2023-11-07 7:19 ` Adrian Hunter
2023-11-07 9:36 ` James Clark
2023-11-07 9:48 ` Leo Yan
2023-11-07 10:16 ` Adrian Hunter
2023-11-07 14:18 ` Leo Yan
2023-11-23 14:42 ` Arnaldo Carvalho de Melo
2023-10-14 7:45 ` [PATCH v1 2/2] perf cs-etm: Enable itrace option 'T' Leo Yan
2023-10-19 10:38 ` James Clark [this message]
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=dd55c313-632e-cf18-161a-50ac6632feb4@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
all inboxes | Powered by JetHome®