Skip to contentSkip to conversation

Patch "perf intel-pt: Fix snapshot overlap detection decoder errors" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Oct 26, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

perf intel-pt: Fix snapshot overlap detection decoder errors

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-snapshot-overlap-detection-decoder-errors.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 <[email protected]> know about it.

Quoted 1 line

From 810c398bc09b2f2dfde52a7d2483a710612c5fb8 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Fri, 23 Sep 2016 17:38:41 +0300
Subject: perf intel-pt: Fix snapshot overlap detection decoder errors

From: Adrian Hunter <[email protected]>

commit 810c398bc09b2f2dfde52a7d2483a710612c5fb8 upstream.

Fix occasional decoder errors decoding trace data collected in snapshot mode.

Snapshot mode can take successive snapshots of trace which might overlap. The decoder checks whether there is an overlap but only looks at the current and previous buffer. However buffers that do not contain synchronization (i.e. PSB) packets cannot be decoded or used for overlap checking. That means the decoder actually needs to check overlaps between the current buffer and the previous buffer that contained usable data. Make that change.

---
 tools/perf/util/intel-pt.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/perf/util/intel-pt.c +11 -4
@@ -238,7 +238,7 @@ static int intel_pt_get_trace(struct int
 	}
 
 	queue = &ptq->pt->queues.queue_array[ptq->queue_nr];
-
+next:
 	buffer = auxtrace_buffer__next(queue, buffer);
 	if (!buffer) {
 		if (old_buffer)
@@ -261,9 +261,6 @@ static int intel_pt_get_trace(struct int
 	    intel_pt_do_fix_overlap(ptq->pt, old_buffer, buffer))
 		return -ENOMEM;
 
-	if (old_buffer)
-		auxtrace_buffer__drop_data(old_buffer);
-
 	if (buffer->use_data) {
 		b->len = buffer->use_size;
 		b->buf = buffer->use_data;
@@ -273,6 +270,16 @@ static int intel_pt_get_trace(struct int
 	}
 	b->ref_timestamp = buffer->reference;
 
+	/*
+	 * If in snapshot mode and the buffer has no usable data, get next
+	 * buffer and again check overlap against old_buffer.
+	 */
+	if (ptq->pt->snapshot_mode && !b->len)
+		goto next;
+
+	if (old_buffer)
+		auxtrace_buffer__drop_data(old_buffer);
+
 	if (!old_buffer || ptq->pt->sampling_mode || (ptq->pt->snapshot_mode &&
 						      !buffer->consecutive)) {
 		b->consecutive = false;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/mmc-sdhci-cast-unsigned-int-to-unsigned-long-long-to-avoid-unexpeted-error.patch queue-4.4/perf-intel-pt-fix-estimated-timestamps-for-cycle-accurate-mode.patch queue-4.4/perf-intel-pt-fix-mtc-timestamp-calculation-for-large-mtc-periods.patch queue-4.4/perf-intel-pt-fix-snapshot-overlap-detection-decoder-errors.patch