From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Bragg Subject: [PATCH 3/9] intel_gpu_top: ignore out of range ring pointers Date: Fri, 18 Jul 2014 16:38:47 +0100 Message-ID: <1405697933-30152-4-git-send-email-robert.bragg@intel.com> References: <1405697933-30152-1-git-send-email-robert.bragg@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F6F56E798 for ; Fri, 18 Jul 2014 08:37:22 -0700 (PDT) In-Reply-To: <1405697933-30152-1-git-send-email-robert.bragg@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --- 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.