]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf intel-pt: Fix CYC timestamps after standalone CBR
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 3 Apr 2023 15:48:31 +0000 (18:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:56 +0000 (11:35 +0200)
commit 430635a0ef1ce958b7b4311f172694ece2c692b8 upstream.

After a standalone CBR (not associated with TSC), update the cycles
reference timestamp and reset the cycle count, so that CYC timestamps
are calculated relative to that point with the new frequency.

Fixes: ae97ce70a4b230bc ("perf tools: Add Intel PT support for decoding CYC packets")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230403154831.8651-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c

index eab7e8ef67899b05716e324c17ae519232069c70..52474e44fb28e02efed8b15a1e5406f068d339d6 100644 (file)
@@ -1592,6 +1592,8 @@ static void intel_pt_calc_cbr(struct intel_pt_decoder *decoder)
 
        decoder->cbr = cbr;
        decoder->cbr_cyc_to_tsc = decoder->max_non_turbo_ratio_fp / cbr;
+       decoder->cyc_ref_timestamp = decoder->timestamp;
+       decoder->cycle_cnt = 0;
 
        intel_pt_mtc_cyc_cnt_cbr(decoder);
 }