diff options
author | Kan Liang <kan.liang@linux.intel.com> | 2023-01-25 12:49:25 -0800 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-02-11 11:18:12 +0100 |
commit | 89e97eb8cec0f1af5ebf2380308913256ca7915a (patch) | |
tree | 9eebd90207fce9623af3d3cf6dee623578dc4e26 /arch/arm64/boot/dts/qcom/sm6125.dtsi | |
parent | 5d515ee40cb57ea5331998f27df7946a69f14dc3 (diff) |
perf/x86/intel/ds: Fix the conversion from TSC to perf time
The time order is incorrect when the TSC in a PEBS record is used.
$perf record -e cycles:upp dd if=/dev/zero of=/dev/null
count=10000
$ perf script --show-task-events
perf-exec 0 0.000000: PERF_RECORD_COMM: perf-exec:915/915
dd 915 106.479872: PERF_RECORD_COMM exec: dd:915/915
dd 915 106.483270: PERF_RECORD_EXIT(915:915):(914:914)
dd 915 106.512429: 1 cycles:upp:
ffffffff96c011b7 [unknown] ([unknown])
... ...
The perf time is from sched_clock_cpu(). The current PEBS code
unconditionally convert the TSC to native_sched_clock(). There is a
shift between the two clocks. If the TSC is stable, the shift is
consistent, __sched_clock_offset. If the TSC is unstable, the shift has
to be calculated at runtime.
This patch doesn't support the conversion when the TSC is unstable. The
TSC unstable case is a corner case and very unlikely to happen. If it
happens, the TSC in a PEBS record will be dropped and fall back to
perf_event_clock().
Fixes: 47a3aeb39e8d ("perf/x86/intel/pebs: Fix PEBS timestamps overwritten")
Reported-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/CAM9d7cgWDVAq8-11RbJ2uGfwkKD6fA-OMwOKDrNUrU_=8MgEjg@mail.gmail.com/
Diffstat (limited to 'arch/arm64/boot/dts/qcom/sm6125.dtsi')
0 files changed, 0 insertions, 0 deletions