[Intel-gfx] [PATCH 3/9] intel_gpu_top: ignore out of range ring pointers

Robert Bragg robert.bragg at intel.com
Fri Jul 18 17:38:47 CEST 2014


---
 tools/intel_gpu_top.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index f60e58b..7574ef0 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -344,6 +344,15 @@ static void ring_sample(struct ring *ring)
 	ring->head = ring_read(ring, RING_HEAD) & HEAD_ADDR;
 	ring->tail = ring_read(ring, RING_TAIL) & TAIL_ADDR;
 
+	/* We sometimes read spurious, out of range pointers which
+	 * we want to ignore. We treat them as idle for now... */
+	if (ring->head > ring->size || ring->tail > ring->size)
+	{
+	    fprintf(stderr, "Ignoring spurious ring pointer\n");
+	    ring->idle++;
+	    return;
+	}
+
 	if (ring->tail == ring->head)
 		ring->idle++;
 
-- 
2.0.1

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the Intel-gfx mailing list