]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.31/perf-intel-pt-fix-divide-by-zero-when-tsc-is-not-available.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / perf-intel-pt-fix-divide-by-zero-when-tsc-is-not-available.patch
1 From 076333870c2f5bdd9b6d31e7ca1909cf0c84cbfa Mon Sep 17 00:00:00 2001
2 From: Adrian Hunter <adrian.hunter@intel.com>
3 Date: Fri, 1 Mar 2019 12:35:36 +0200
4 Subject: perf intel-pt: Fix divide by zero when TSC is not available
5
6 From: Adrian Hunter <adrian.hunter@intel.com>
7
8 commit 076333870c2f5bdd9b6d31e7ca1909cf0c84cbfa upstream.
9
10 When TSC is not available, "timeless" decoding is used but a divide by
11 zero occurs if perf_time_to_tsc() is called.
12
13 Ensure the divisor is not zero.
14
15 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
16 Cc: Jiri Olsa <jolsa@redhat.com>
17 Cc: stable@vger.kernel.org # v4.9+
18 Link: https://lkml.kernel.org/n/tip-1i4j0wqoc8vlbkcizqqxpsf4@git.kernel.org
19 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 tools/perf/util/intel-pt.c | 2 ++
24 1 file changed, 2 insertions(+)
25
26 --- a/tools/perf/util/intel-pt.c
27 +++ b/tools/perf/util/intel-pt.c
28 @@ -2507,6 +2507,8 @@ int intel_pt_process_auxtrace_info(union
29 }
30
31 pt->timeless_decoding = intel_pt_timeless_decoding(pt);
32 + if (pt->timeless_decoding && !pt->tc.time_mult)
33 + pt->tc.time_mult = 1;
34 pt->have_tsc = intel_pt_have_tsc(pt);
35 pt->sampling_mode = false;
36 pt->est_tsc = !pt->timeless_decoding;