From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/i915: add interface to simulate gpu hangs
Date: Sat, 03 Dec 2011 01:33:59 +0000 [thread overview]
Message-ID: <e0d58a$2f04f7@orsmga002.jf.intel.com> (raw)
In-Reply-To: <1322864509-4130-1-git-send-email-daniel.vetter@ffwll.ch>
On Fri, 2 Dec 2011 23:21:49 +0100, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> gpu reset is a very important piece of our infrastructure.
> Unfortunately we only really it test by actually hanging the gpu,
> which often has bad side-effects for the entire system. And the gpu
> hang handling code is one of the rather complicated pieces of code we
> have, consisting of
> - hang detection
> - error capture
> - actual gpu reset
> - reset of all the gem bookkeeping
> - reinitialition of the entire gpu
>
> This patch adds a debugfs to selectively stopping rings by ceasing to
> update the hw tail pointer, which will result in the gpu no longer
> updating it's head pointer and eventually to the hangcheck firing.
> This way we can exercise the gpu hang code under controlled conditions
> without a dying gpu taking down the entire systems.
>
> Patch motivated by me forgetting to properly reinitialize ppgtt after
> a gpu reset.
>
> Usage:
>
> echo $((1 << $ringnum)) > i915_ring_stop # stops one ring
>
> echo 0xffffffff > i915_ring_stop # stops all, future-proof version
>
> then run whatever testload is desired. i915_ring_stop automatically
> resets after a gpu hang is detected to avoid hanging the gpu to fast
> and declaring it wedged.
>
> v2: Incorporate feedback from Chris Wilson.
>
> v3: Add the missing cleanup.
I think I've made my peace with this patch. I'm still not completely
sold on its value, but if Daniel found it useful then it has merit.
>
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 65 +++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/i915_drv.c | 2 +
> drivers/gpu/drm/i915/i915_drv.h | 2 +
> drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++
> 4 files changed, 73 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index db83552..85328f7 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1397,6 +1397,64 @@ static const struct file_operations i915_wedged_fops = {
> };
>
> static ssize_t
> +i915_ring_stop_read(struct file *filp,
> + char __user *ubuf,
> + size_t max,
> + loff_t *ppos)
> +{
> + struct drm_device *dev = filp->private_data;
> + drm_i915_private_t *dev_priv = dev->dev_private;
> + char buf[80];
> + int len;
> +
> + len = snprintf(buf, sizeof(buf),
> + "%d\n", dev_priv->stop_rings);
%08x since it is a flags value, though 8 may be overkill!
> +
> + if (len > sizeof(buf))
> + len = sizeof(buf);
> +
> + return simple_read_from_buffer(ubuf, max, ppos, buf, len);
> +}
> +
> +static ssize_t
> +i915_ring_stop_write(struct file *filp,
> + const char __user *ubuf,
> + size_t cnt,
> + loff_t *ppos)
> +{
> + struct drm_device *dev = filp->private_data;
> + struct drm_i915_private *dev_priv = dev->dev_private;
> + char buf[20];
> + int val = 0;
> +
> + if (cnt > 0) {
> + if (cnt > sizeof(buf) - 1)
> + return -EINVAL;
> +
> + if (copy_from_user(buf, ubuf, cnt))
> + return -EFAULT;
> + buf[cnt] = 0;
> +
> + val = simple_strtoul(buf, NULL, 0);
> + }
> +
> + DRM_DEBUG_DRIVER("Stopping rings %u\n", val);
%x here as well
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2011-12-03 1:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 13:17 [PATCH 0/9] gpu hang and swizzle patches Daniel Vetter
2011-11-10 13:17 ` [PATCH 1/9] drm/i915: refactor debugfs open function Daniel Vetter
2011-11-10 19:25 ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 2/9] drm/i915: refactor debugfs create functions Daniel Vetter
2011-11-10 19:26 ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 3/9] drm/i915: add interface to simulate gpu hangs Daniel Vetter
2011-11-10 16:34 ` [PATCH] " Daniel Vetter
2011-12-02 22:21 ` Daniel Vetter
2011-12-03 1:33 ` Chris Wilson [this message]
2011-12-05 23:20 ` Ben Widawsky
2011-11-10 13:18 ` [PATCH 4/9] drm/i915: rework dev->first_error locking Daniel Vetter
2011-11-27 19:31 ` [PATCH] " Daniel Vetter
2011-11-10 13:18 ` [PATCH 5/9] drm/i915: destroy existing error_state when simulating a gpu hang Daniel Vetter
2011-11-10 13:18 ` [PATCH 6/9] drm/i915: fix swizzle detection for gen3 Daniel Vetter
2011-11-10 16:36 ` [PATCH] " Daniel Vetter
2011-11-10 13:18 ` [PATCH 7/9] drm/i915: add debugfs file for swizzling information Daniel Vetter
2011-11-10 16:39 ` [PATCH] " Daniel Vetter
2011-11-10 13:18 ` [PATCH 8/9] drm/i915: add gen6+ registers to i915_swizzle_info Daniel Vetter
2011-11-10 13:18 ` [PATCH 9/9] drm/i915: swizzling support for snb/ivb Daniel Vetter
2011-11-11 16:50 ` Eric Anholt
2011-11-11 17:22 ` Daniel Vetter
2011-11-11 19:37 ` Eric Anholt
2011-11-11 19:51 ` Daniel Vetter
2011-11-11 19:58 ` Eric Anholt
2011-11-11 20:18 ` Daniel Vetter
2011-11-14 16:19 ` Eric Anholt
2011-11-11 0:15 ` [PATCH 0/9] gpu hang and swizzle patches Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2012-04-27 13:17 [PATCH 01/10] drm/i915: add interface to simulate gpu hangs Daniel Vetter
2012-05-03 12:48 ` [PATCH] " Daniel Vetter
2012-05-03 19:00 ` Eugeni Dodonov
2012-05-05 19:13 ` 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='e0d58a$2f04f7@orsmga002.jf.intel.com' \
--to=chris@chris-wilson.co.uk \
--cc=daniel.vetter@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox