File perf-intel-pt-Fix-missing-instruction-events-with-q-option.patch of Package perf
63
1
From: Adrian Hunter <adrian.hunter@intel.com>
2
Date: Fri, 10 Dec 2021 18:23:02 +0200
3
Subject: perf intel-pt: Fix missing 'instruction' events with 'q' option
4
Git-commit: a882cc94971093e146ffa1163b140ad956236754
5
Patch-mainline: v5.16-rc5
6
References: git-fixes
7
8
FUP packets contain IP information, which makes them also an 'instruction'
9
event in 'hop' mode i.e. the itrace 'q' option. That wasn't happening, so
10
restructure the logic so that FUP events are added along with appropriate
11
'instruction' and 'branch' events.
12
13
Fixes: 7c1b16ba0e26e6 ("perf intel-pt: Add support for decoding FUP/TIP only")
14
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
15
Cc: Jiri Olsa <jolsa@redhat.com>
16
Cc: stable@vger.kernel.org # v5.15+
17
Link: https://lore.kernel.org/r/20211210162303.2288710-7-adrian.hunter@intel.com
18
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
19
Signed-off-by: Tony Jones <tonyj@suse.de>
20
---
21
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 11 ++++++++---
22
1 file changed, 8 insertions(+), 3 deletions(-)
23
24
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
25
index 75b504aed7f4..0e013c2d9eb4 100644
26
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
27
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
28
29
/* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */
30
static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err)
31
{
32
+ *err = 0;
33
+
34
/* Leap from PSB to PSB, getting ip from FUP within PSB+ */
35
if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) {
36
*err = intel_pt_scan_for_psb(decoder);
37
38
if (!decoder->packet.count)
39
return HOP_IGNORE;
40
intel_pt_set_ip(decoder);
41
- if (intel_pt_fup_event(decoder))
42
- return HOP_RETURN;
43
+ if (decoder->set_fup_mwait || decoder->set_fup_pwre)
44
+ *no_tip = true;
45
if (!decoder->branch_enable || !decoder->pge)
46
*no_tip = true;
47
if (*no_tip) {
48
decoder->state.type = INTEL_PT_INSTRUCTION;
49
decoder->state.from_ip = decoder->ip;
50
decoder->state.to_ip = 0;
51
+ intel_pt_fup_event(decoder);
52
return HOP_RETURN;
53
}
54
+ intel_pt_fup_event(decoder);
55
+ decoder->state.type |= INTEL_PT_INSTRUCTION | INTEL_PT_BRANCH;
56
*err = intel_pt_walk_fup_tip(decoder);
57
- if (!*err)
58
+ if (!*err && decoder->state.to_ip)
59
decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
60
return HOP_RETURN;
61
62
63