Re: [Intel-gfx] [PATCH 07/10] drm/i915/bdw: collect semaphore error state

2014-07-14 Thread Damien Lespiau
On Mon, Jun 30, 2014 at 09:53:41AM -0700, Rodrigo Vivi wrote:
 + for_each_ring(useless, dev_priv, i) {
 + u16 signal_offset =
 + (GEN8_SIGNAL_OFFSET(ring, i)  PAGE_MASK) / 4;
 + u32 *tmp = error-semaphore_obj-pages[0];
 +
 + ering-semaphore_mboxes[i] = tmp[signal_offset];
 + ering-semaphore_seqno[i] = ring-semaphore.sync_seqno[i];
 + }
 +}

This loops around all the rings, but semaphore_mboxes[] and
semaphore_seqno[] are of size (I915_NUM_RINGS - 1).

-- 
Damien
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 07/10] drm/i915/bdw: collect semaphore error state

2014-07-14 Thread Ben Widawsky
On Mon, Jul 14, 2014 at 11:04:22AM +0100, Damien Lespiau wrote:
 On Mon, Jun 30, 2014 at 09:53:41AM -0700, Rodrigo Vivi wrote:
  +   for_each_ring(useless, dev_priv, i) {
  +   u16 signal_offset =
  +   (GEN8_SIGNAL_OFFSET(ring, i)  PAGE_MASK) / 4;
  +   u32 *tmp = error-semaphore_obj-pages[0];
  +
  +   ering-semaphore_mboxes[i] = tmp[signal_offset];
  +   ering-semaphore_seqno[i] = ring-semaphore.sync_seqno[i];
  +   }
  +}
 
 This loops around all the rings, but semaphore_mboxes[] and
 semaphore_seqno[] are of size (I915_NUM_RINGS - 1).
 
 -- 
 Damien

Dan Carpenter has already reported this to us. I was expecting a patch
from Rodrigo.

-- 
Ben Widawsky, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 07/10] drm/i915/bdw: collect semaphore error state

2014-06-30 Thread Rodrigo Vivi
From: Ben Widawsky b...@bwidawsk.net

Since the semaphore information is in an object, just dump it, and let
the user parse it later.

NOTE: The page being used for the semaphores are incoherent with the
CPU. No matter what I do, I cannot figure out a way to read anything but
0s. Note that the semaphore waits are indeed working.

v2: Don't print signal, and wait (they should be the same). Instead,
print sync_seqno (Chris)

v3: Free the semaphore error object (Chris)

v4: Fix semaphore offset calculation during error state collection
(Ville)

v5: VCS2 rebase
Make semaphore object error capture coding style consistent (Ville)
Do the proper math for the signal offset (Ville)

v6: Fix small conflicts on rebase and s/ring_buffer/engine_cs (Rodrigo)

Reviewed-by: Rodrigo Vivi rodrigo.v...@intel.com
Signed-off-by: Ben Widawsky b...@bwidawsk.net
Signed-off-by: Rodrigo Vivi rodrigo.v...@intel.com
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/i915_gpu_error.c | 51 ---
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 61e43fc..f50ae5d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -324,6 +324,7 @@ struct drm_i915_error_state {
u64 fence[I915_MAX_NUM_FENCES];
struct intel_overlay_error_state *overlay;
struct intel_display_error_state *display;
+   struct drm_i915_error_object *semaphore_obj;
 
struct drm_i915_error_ring {
bool valid;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9d42b6a..45b6191 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -327,6 +327,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf 
*m,
struct drm_device *dev = error_priv-dev;
struct drm_i915_private *dev_priv = dev-dev_private;
struct drm_i915_error_state *error = error_priv-error;
+   struct drm_i915_error_object *obj;
int i, j, offset, elt;
int max_hangcheck_score;
 
@@ -395,8 +396,6 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf 
*m,
error-pinned_bo_count[0]);
 
for (i = 0; i  ARRAY_SIZE(error-ring); i++) {
-   struct drm_i915_error_object *obj;
-
obj = error-ring[i].batchbuffer;
if (obj) {
err_puts(m, dev_priv-ring[i].name);
@@ -459,6 +458,18 @@ int i915_error_state_to_str(struct 
drm_i915_error_state_buf *m,
}
}
 
+   if ((obj = error-semaphore_obj)) {
+   err_printf(m, Semaphore page = 0x%08x\n, obj-gtt_offset);
+   for (elt = 0; elt  PAGE_SIZE/16; elt += 4) {
+   err_printf(m, [%04x] %08x %08x %08x %08x\n,
+  elt * 4,
+  obj-pages[0][elt],
+  obj-pages[0][elt+1],
+  obj-pages[0][elt+2],
+  obj-pages[0][elt+3]);
+   }
+   }
+
if (error-overlay)
intel_overlay_print_error_state(m, error-overlay);
 
@@ -529,6 +540,7 @@ static void i915_error_state_free(struct kref *error_ref)
kfree(error-ring[i].requests);
}
 
+   i915_error_object_free(error-semaphore_obj);
kfree(error-active_bo);
kfree(error-overlay);
kfree(error-display);
@@ -747,6 +759,33 @@ static void i915_gem_record_fences(struct drm_device *dev,
 }
 
 
+static void gen8_record_semaphore_state(struct drm_i915_private *dev_priv,
+   struct drm_i915_error_state *error,
+   struct intel_engine_cs *ring,
+   struct drm_i915_error_ring *ering)
+{
+   struct intel_engine_cs *useless;
+   int i;
+
+   if (!i915_semaphore_is_enabled(dev_priv-dev))
+   return;
+
+   if (!error-semaphore_obj)
+   error-semaphore_obj =
+   i915_error_object_create(dev_priv,
+dev_priv-semaphore_obj,
+dev_priv-gtt.base);
+
+   for_each_ring(useless, dev_priv, i) {
+   u16 signal_offset =
+   (GEN8_SIGNAL_OFFSET(ring, i)  PAGE_MASK) / 4;
+   u32 *tmp = error-semaphore_obj-pages[0];
+
+   ering-semaphore_mboxes[i] = tmp[signal_offset];
+   ering-semaphore_seqno[i] = ring-semaphore.sync_seqno[i];
+   }
+}
+
 static void gen6_record_semaphore_state(struct drm_i915_private *dev_priv,
struct intel_engine_cs *ring,
struct drm_i915_error_ring *ering)
@@ -764,6 +803,7 @@ static