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] [day] [month] [year] [list]
Message-ID: <20210412001727.GB6012@leoy-ThinkPad-X240s>
Date:   Mon, 12 Apr 2021 08:17:27 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Al Grant <Al.Grant@....com>,
        John Garry <john.garry@...wei.com>,
        Will Deacon <will@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.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@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Dave Martin <Dave.Martin@....com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        James Clark <James.Clark@....com>
Subject: Re: [PATCH v3 2/6] perf arm-spe: Save clock parameters from
 TIME_CONV event

On Sat, Apr 10, 2021 at 01:00:42PM +0800, Leo Yan wrote:
> During the recording phase, "perf record" tool synthesizes event
> PERF_RECORD_TIME_CONV for the hardware clock parameters and saves the
> event into the data file.
> 
> Afterwards, when processing the data file, the event TIME_CONV will be
> processed at the very early time and is stored into session context.
> 
> This patch extracts these parameters from the session context and saves
> into the structure "spe->tc" with the type perf_tsc_conversion, so that
> the parameters are ready for conversion between clock counter and time
> stamp.
> 
> Signed-off-by: Leo Yan <leo.yan@...aro.org>

[...]

> ---
>  tools/perf/util/arm-spe.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 2539d4baec44..b48816d5c0b4 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -26,6 +26,7 @@
>  #include "symbol.h"
>  #include "thread.h"
>  #include "thread-stack.h"
> +#include "tsc.h"
>  #include "tool.h"
>  #include "util/synthetic-events.h"
>  
> @@ -45,6 +46,8 @@ struct arm_spe {
>  	struct machine			*machine;
>  	u32				pmu_type;
>  
> +	struct perf_tsc_conversion	tc;
> +
>  	u8				timeless_decoding;
>  	u8				data_queued;
>  
> @@ -1027,6 +1030,22 @@ int arm_spe_process_auxtrace_info(union perf_event *event,
>  	spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE];
>  
>  	spe->timeless_decoding = arm_spe__is_timeless_decoding(spe);
> +
> +	/*
> +	 * The synthesized event PERF_RECORD_TIME_CONV has been handled
> +	 * ahead and the parameters for hardware clock are stored in
> +	 * the session context.  Passes these parameters to the structure
> +	 * perf_tsc_conversion in "spe->tc", which is used for later
> +	 * conversion between clock counter and timestamp.
> +	 */
> +	spe->tc.time_shift = session->time_conv.time_shift;
> +	spe->tc.time_mult = session->time_conv.time_mult;
> +	spe->tc.time_zero = session->time_conv.time_zero;
> +	spe->tc.time_cycles = session->time_conv.time_cycles;
> +	spe->tc.time_mask = session->time_conv.time_mask;
> +	spe->tc.cap_user_time_zero = session->time_conv.cap_user_time_zero;
> +	spe->tc.cap_user_time_short = session->time_conv.cap_user_time_short;

As Adrain suggested, this patch also should check the size of event
PERF_RECORD_TIME_CONV for backwards-compability.   I will send a new
patch set for this.

Thanks,
Leo

>  	spe->auxtrace.process_event = arm_spe_process_event;
>  	spe->auxtrace.process_auxtrace_event = arm_spe_process_auxtrace_event;
>  	spe->auxtrace.flush_events = arm_spe_flush;
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ