]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/perf-intel-pt-fix-sample-timestamp-wrt-non-taken-branches.patch
drop drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch from 4.4.y and 4.9.y
[thirdparty/kernel/stable-queue.git] / queue-4.4 / perf-intel-pt-fix-sample-timestamp-wrt-non-taken-branches.patch
CommitLineData
53722911
GKH
1From 1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 Mon Sep 17 00:00:00 2001
2From: Adrian Hunter <adrian.hunter@intel.com>
3Date: Fri, 10 May 2019 15:41:43 +0300
4Subject: perf intel-pt: Fix sample timestamp wrt non-taken branches
5
6From: Adrian Hunter <adrian.hunter@intel.com>
7
8commit 1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 upstream.
9
10The sample timestamp is updated to ensure that the timestamp represents
11the time of the sample and not a branch that the decoder is still
12walking towards. The sample timestamp is updated when the decoder
13returns, but the decoder does not return for non-taken branches. Update
14the sample timestamp then also.
15
16Note that commit 3f04d98e972b5 ("perf intel-pt: Improve sample
17timestamp") was also a stable fix and appears, for example, in v4.4
18stable tree as commit a4ebb58fd124 ("perf intel-pt: Improve sample
19timestamp").
20
21Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
22Cc: Jiri Olsa <jolsa@redhat.com>
23Cc: stable@vger.kernel.org # v4.4+
24Fixes: 3f04d98e972b ("perf intel-pt: Improve sample timestamp")
25Link: http://lkml.kernel.org/r/20190510124143.27054-4-adrian.hunter@intel.com
26Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
27Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29---
30 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 ++++-
31 1 file changed, 4 insertions(+), 1 deletion(-)
32
33--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
34+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
35@@ -1205,8 +1205,11 @@ static int intel_pt_walk_tnt(struct inte
36 return 0;
37 }
38 decoder->ip += intel_pt_insn.length;
39- if (!decoder->tnt.count)
40+ if (!decoder->tnt.count) {
41+ decoder->sample_timestamp = decoder->timestamp;
42+ decoder->sample_insn_cnt = decoder->timestamp_insn_cnt;
43 return -EAGAIN;
44+ }
45 decoder->tnt.payload <<= 1;
46 continue;
47 }