Skip to content

Commit 401136b

Browse files
ahunter6acmel
authored andcommitted
perf intel-pt: Fix FUP packet state
While walking code towards a FUP ip, the packet state is INTEL_PT_STATE_FUP or INTEL_PT_STATE_FUP_NO_TIP. That was mishandled resulting in the state becoming INTEL_PT_STATE_IN_SYNC prematurely. The result was an occasional lost EXSTOP event. Signed-off-by: Adrian Hunter <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 94fb1af commit 401136b

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,7 @@ static int intel_pt_walk_fup(struct intel_pt_decoder *decoder)
11641164
return 0;
11651165
if (err == -EAGAIN ||
11661166
intel_pt_fup_with_nlip(decoder, &intel_pt_insn, ip, err)) {
1167+
decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
11671168
if (intel_pt_fup_event(decoder))
11681169
return 0;
11691170
return -EAGAIN;
@@ -1942,17 +1943,13 @@ static int intel_pt_walk_trace(struct intel_pt_decoder *decoder)
19421943
}
19431944
if (decoder->set_fup_mwait)
19441945
no_tip = true;
1946+
if (no_tip)
1947+
decoder->pkt_state = INTEL_PT_STATE_FUP_NO_TIP;
1948+
else
1949+
decoder->pkt_state = INTEL_PT_STATE_FUP;
19451950
err = intel_pt_walk_fup(decoder);
1946-
if (err != -EAGAIN) {
1947-
if (err)
1948-
return err;
1949-
if (no_tip)
1950-
decoder->pkt_state =
1951-
INTEL_PT_STATE_FUP_NO_TIP;
1952-
else
1953-
decoder->pkt_state = INTEL_PT_STATE_FUP;
1954-
return 0;
1955-
}
1951+
if (err != -EAGAIN)
1952+
return err;
19561953
if (no_tip) {
19571954
no_tip = false;
19581955
break;
@@ -2599,15 +2596,11 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
25992596
err = intel_pt_walk_tip(decoder);
26002597
break;
26012598
case INTEL_PT_STATE_FUP:
2602-
decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
26032599
err = intel_pt_walk_fup(decoder);
26042600
if (err == -EAGAIN)
26052601
err = intel_pt_walk_fup_tip(decoder);
2606-
else if (!err)
2607-
decoder->pkt_state = INTEL_PT_STATE_FUP;
26082602
break;
26092603
case INTEL_PT_STATE_FUP_NO_TIP:
2610-
decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
26112604
err = intel_pt_walk_fup(decoder);
26122605
if (err == -EAGAIN)
26132606
err = intel_pt_walk_trace(decoder);

0 commit comments

Comments
 (0)