Skip to content

Commit a882cc9

Browse files
ahunter6acmel
authored andcommitted
perf intel-pt: Fix missing 'instruction' events with 'q' option
FUP packets contain IP information, which makes them also an 'instruction' event in 'hop' mode i.e. the itrace 'q' option. That wasn't happening, so restructure the logic so that FUP events are added along with appropriate 'instruction' and 'branch' events. Fixes: 7c1b16b ("perf intel-pt: Add support for decoding FUP/TIP only") Signed-off-by: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: [email protected] # v5.15+ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a32e6c5 commit a882cc9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/perf/util/intel-pt-decoder/intel-pt-decoder.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,8 @@ static int intel_pt_scan_for_psb(struct intel_pt_decoder *decoder);
26832683
/* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */
26842684
static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err)
26852685
{
2686+
*err = 0;
2687+
26862688
/* Leap from PSB to PSB, getting ip from FUP within PSB+ */
26872689
if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) {
26882690
*err = intel_pt_scan_for_psb(decoder);
@@ -2723,18 +2725,21 @@ static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, in
27232725
if (!decoder->packet.count)
27242726
return HOP_IGNORE;
27252727
intel_pt_set_ip(decoder);
2726-
if (intel_pt_fup_event(decoder))
2727-
return HOP_RETURN;
2728+
if (decoder->set_fup_mwait || decoder->set_fup_pwre)
2729+
*no_tip = true;
27282730
if (!decoder->branch_enable || !decoder->pge)
27292731
*no_tip = true;
27302732
if (*no_tip) {
27312733
decoder->state.type = INTEL_PT_INSTRUCTION;
27322734
decoder->state.from_ip = decoder->ip;
27332735
decoder->state.to_ip = 0;
2736+
intel_pt_fup_event(decoder);
27342737
return HOP_RETURN;
27352738
}
2739+
intel_pt_fup_event(decoder);
2740+
decoder->state.type |= INTEL_PT_INSTRUCTION | INTEL_PT_BRANCH;
27362741
*err = intel_pt_walk_fup_tip(decoder);
2737-
if (!*err)
2742+
if (!*err && decoder->state.to_ip)
27382743
decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
27392744
return HOP_RETURN;
27402745

0 commit comments

Comments
 (0)