* Patch "perf intel-pt: Fix last_ip usage" has been added to the 4.4-stable tree
@ 2017-08-03 21:56 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-08-03 21:56 UTC (permalink / raw)
To: adrian.hunter, acme, ak, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
perf intel-pt: Fix last_ip usage
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-intel-pt-fix-last_ip-usage.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From ee14ac0ef6827cd6f9a572cc83dd0191ea17812c Mon Sep 17 00:00:00 2001
From: Adrian Hunter <adrian.hunter@intel.com>
Date: Fri, 26 May 2017 11:17:06 +0300
Subject: perf intel-pt: Fix last_ip usage
From: Adrian Hunter <adrian.hunter@intel.com>
commit ee14ac0ef6827cd6f9a572cc83dd0191ea17812c upstream.
Intel PT uses IP compression based on the last IP. For decoding
purposes, 'last IP' is considered to be reset to zero whenever there is
a synchronization packet (PSB). The decoder wasn't doing that, and was
treating the zero value to mean that there was no last IP, whereas
compression can be done against the zero value. Fix by setting last_ip
to zero when a PSB is received and keep track of have_last_ip.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-6-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -110,6 +110,7 @@ struct intel_pt_decoder {
bool have_tma;
bool have_cyc;
bool fixup_last_mtc;
+ bool have_last_ip;
uint64_t pos;
uint64_t last_ip;
uint64_t ip;
@@ -417,6 +418,7 @@ static uint64_t intel_pt_calc_ip(const s
static inline void intel_pt_set_last_ip(struct intel_pt_decoder *decoder)
{
decoder->last_ip = intel_pt_calc_ip(&decoder->packet, decoder->last_ip);
+ decoder->have_last_ip = true;
}
static inline void intel_pt_set_ip(struct intel_pt_decoder *decoder)
@@ -1640,6 +1642,8 @@ next:
break;
case INTEL_PT_PSB:
+ decoder->last_ip = 0;
+ decoder->have_last_ip = true;
intel_pt_clear_stack(&decoder->stack);
err = intel_pt_walk_psbend(decoder);
if (err == -EAGAIN)
@@ -1720,7 +1724,7 @@ next:
static inline bool intel_pt_have_ip(struct intel_pt_decoder *decoder)
{
- return decoder->last_ip || decoder->packet.count == 0 ||
+ return decoder->have_last_ip || decoder->packet.count == 0 ||
decoder->packet.count == 3 || decoder->packet.count == 6;
}
@@ -1850,7 +1854,7 @@ static int intel_pt_walk_to_ip(struct in
if (decoder->ip)
return 0;
}
- if (decoder->packet.count)
+ if (decoder->packet.count && decoder->have_last_ip)
intel_pt_set_last_ip(decoder);
break;
@@ -1900,6 +1904,8 @@ static int intel_pt_walk_to_ip(struct in
break;
case INTEL_PT_PSB:
+ decoder->last_ip = 0;
+ decoder->have_last_ip = true;
intel_pt_clear_stack(&decoder->stack);
err = intel_pt_walk_psb(decoder);
if (err)
@@ -2036,6 +2042,7 @@ static int intel_pt_sync(struct intel_pt
decoder->pge = false;
decoder->continuous_period = false;
+ decoder->have_last_ip = false;
decoder->last_ip = 0;
decoder->ip = 0;
intel_pt_clear_stack(&decoder->stack);
@@ -2044,6 +2051,7 @@ static int intel_pt_sync(struct intel_pt
if (err)
return err;
+ decoder->have_last_ip = true;
decoder->pkt_state = INTEL_PT_STATE_NO_IP;
err = intel_pt_walk_psb(decoder);
@@ -2086,6 +2094,7 @@ const struct intel_pt_state *intel_pt_de
err = intel_pt_sync(decoder);
break;
case INTEL_PT_STATE_NO_IP:
+ decoder->have_last_ip = false;
decoder->last_ip = 0;
decoder->ip = 0;
/* Fall through */
Patches currently in stable-queue which might be from adrian.hunter@intel.com are
queue-4.4/perf-intel-pt-ensure-never-to-set-last_ip-when-packet-count-is-zero.patch
queue-4.4/perf-intel-pt-use-fup-always-when-scanning-for-an-ip.patch
queue-4.4/perf-intel-pt-fix-last_ip-usage.patch
queue-4.4/perf-intel-pt-fix-ip-compression.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-03 21:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03 21:56 Patch "perf intel-pt: Fix last_ip usage" has been added to the 4.4-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).