From patchwork Mon Jul 16 18:51:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 1201711 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 97BE0E0038 for ; Mon, 16 Jul 2012 18:56:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CA7F9EE99 for ; Mon, 16 Jul 2012 11:56:34 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 41D6D9EB3A for ; Mon, 16 Jul 2012 11:54:07 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cloud01.chad-versace.us (Postfix) with ESMTP id 86BBA18107E; Mon, 16 Jul 2012 18:56:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at static.cloud-ips.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=ham Received: from cloud01.chad-versace.us ([127.0.0.1]) by localhost (cloud01.static.cloud-ips.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VGIXOkNKcVry; Mon, 16 Jul 2012 18:56:44 +0000 (UTC) Received: from seagal.jf.intel.com (jfdmzpr02-ext.jf.intel.com [134.134.137.71]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id E99AD180E61; Mon, 16 Jul 2012 18:56:39 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Mon, 16 Jul 2012 11:51:58 -0700 Message-Id: <1342464719-8790-4-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1342464719-8790-1-git-send-email-ben@bwidawsk.net> References: <1342464719-8790-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Add a breadcrumb X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Getting the watchdog interrupt is great, but knowing the exact batch the watchdog fired on is even better. There are other ways to do this without the watchdog, but having the watchdog makes it quite simple. The idea is to simply emit the seqno before the batchbuffer begins running, and if the watchdog fires we can read back the location where the seqno was emitted to see the batchbuffer which hangs. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++++- drivers/gpu/drm/i915/intel_ringbuffer.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 82bd0cd..39c6f8e 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1332,7 +1332,7 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring, { int ret; - ret = intel_ring_begin(ring, 14); + ret = intel_ring_begin(ring, 18); if (ret) return ret; @@ -1345,6 +1345,10 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring, intel_ring_emit(ring, 0); /* add breadcrumb here */ + intel_ring_emit(ring, MI_STORE_DWORD_INDEX); + intel_ring_emit(ring, (I915_GEM_WATCHDOG_CRUMB_RCS + ring->id) << MI_STORE_DWORD_INDEX_SHIFT); + intel_ring_emit(ring, i915_gem_next_request_seqno(ring)); + intel_ring_emit(ring, MI_NOOP); intel_ring_emit(ring, MI_BATCH_BUFFER_START | MI_BATCH_NON_SECURE_I965); /* bit0-7 is the length on GEN6+ */ diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 1d3c81f..73de086 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -183,6 +183,9 @@ intel_read_status_page(struct intel_ring_buffer *ring, * The area from dword 0x20 to 0x3ff is available for driver usage. */ #define I915_GEM_HWS_INDEX 0x20 +#define I915_GEM_WATCHDOG_CRUMB_RCS 0x21 +#define I915_GEM_WATCHDOG_CRUMB_VCS 0x22 +#define I915_GEM_WATCHDOG_CRUMB_BCS 0x23 void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring);