]>
Commit | Line | Data |
---|---|---|
53722911 GKH |
1 | From 1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 Mon Sep 17 00:00:00 2001 |
2 | From: Adrian Hunter <adrian.hunter@intel.com> | |
3 | Date: Fri, 10 May 2019 15:41:43 +0300 | |
4 | Subject: perf intel-pt: Fix sample timestamp wrt non-taken branches | |
5 | ||
6 | From: Adrian Hunter <adrian.hunter@intel.com> | |
7 | ||
8 | commit 1b6599a9d8e6c9f7e9b0476012383b1777f7fc93 upstream. | |
9 | ||
10 | The sample timestamp is updated to ensure that the timestamp represents | |
11 | the time of the sample and not a branch that the decoder is still | |
12 | walking towards. The sample timestamp is updated when the decoder | |
13 | returns, but the decoder does not return for non-taken branches. Update | |
14 | the sample timestamp then also. | |
15 | ||
16 | Note that commit 3f04d98e972b5 ("perf intel-pt: Improve sample | |
17 | timestamp") was also a stable fix and appears, for example, in v4.4 | |
18 | stable tree as commit a4ebb58fd124 ("perf intel-pt: Improve sample | |
19 | timestamp"). | |
20 | ||
21 | Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> | |
22 | Cc: Jiri Olsa <jolsa@redhat.com> | |
23 | Cc: stable@vger.kernel.org # v4.4+ | |
24 | Fixes: 3f04d98e972b ("perf intel-pt: Improve sample timestamp") | |
25 | Link: http://lkml.kernel.org/r/20190510124143.27054-4-adrian.hunter@intel.com | |
26 | Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> | |
27 | Signed-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 | } |