All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Report to userspace if we have a (presumed) working GPU reset
Date: Mon, 15 Jun 2015 14:53:41 +0100	[thread overview]
Message-ID: <20150615135341.GA28462@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <20150615134538.GV8341@phenom.ffwll.local>

On Mon, Jun 15, 2015 at 03:45:38PM +0200, Daniel Vetter wrote:
> On Mon, Jun 15, 2015 at 12:23:48PM +0100, Chris Wilson wrote:
> > In igt, we want to test handling of GPU hangs, both for recovery
> > purposes and for reporting. However, we don't want to inject a genuine
> > GPU hang onto a machine that cannot recover and so be permenantly
> > wedged. Rather than embed heuristics into igt, have the kernel report
> > exactly when it expects the GPU reset to work.
> > 
> > This can also be usefully extended in future to indicate different
> > levels of fine-grained resets.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Tim Gore <tim.gore@intel.com>
> > Cc: Tomas Elf <tomas.elf@intel.com>
> 
> Yeah makes sense. Will merge as soon as someone smashes a t-b with a few
> igt patches using this on top.

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index deb5560..8a1ffb2 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
 #include <fcntl.h>
 
 #include "drmtest.h"
@@ -47,6 +48,21 @@
  * engines.
  */
 
+static bool has_gpu_reset(int fd)
+{
+       struct drm_i915_getparam gp;
+       int val = 0;
+
+       memset(&gp, 0, sizeof(gp));
+       gp.param = 35; /* HAS_GPU_RESET */
+       gp.value = &val;
+
+       if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
+               return intel_gen(intel_get_drm_devid(fd)) >= 5;
+
+       return val > 0;
+}
 
 /**
  * igt_require_hang_ring:
@@ -60,7 +76,7 @@
 void igt_require_hang_ring(int fd, int ring)
 {
        gem_context_require_ban_period(fd);
-       igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
+       igt_require(has_gpu_reset(fd));
 }
 
 /**


-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-06-15 13:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 11:23 [PATCH] drm/i915: Report to userspace if we have a (presumed) working GPU reset Chris Wilson
2015-06-15 13:45 ` Daniel Vetter
2015-06-15 13:53   ` Chris Wilson [this message]
2015-06-15 13:58     ` Chris Wilson
2015-06-15 15:01       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150615135341.GA28462@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.