lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd55c313-632e-cf18-161a-50ac6632feb4@arm.com>
Date:   Thu, 19 Oct 2023 11:38:57 +0100
From:   James Clark <james.clark@....com>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>
Subject: Re: [PATCH v1 2/2] perf cs-etm: Enable itrace option 'T'



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@...aro.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@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ