public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 4/7] drm/i915: no hangcheck when reset is in progress
Date: Tue, 16 Jul 2013 10:45:59 +0200	[thread overview]
Message-ID: <20130716084559.GO5784@phenom.ffwll.local> (raw)
In-Reply-To: <1372861332-6308-5-git-send-email-mika.kuoppala@intel.com>

On Wed, Jul 03, 2013 at 05:22:09PM +0300, Mika Kuoppala wrote:
> From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> 
> The timer for hangchecking can run again before the previous
> reset it has triggered has been handled. This can corrupt
> the hangcheck state as reset handling will access and write to
> the hangcheck data. To prevent this, avoid running the hangcheck
> logic while reset is in progress.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_irq.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index dc1b878..b0fec7f 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -2447,6 +2447,9 @@ void i915_hangcheck_elapsed(unsigned long data)
>  	if (!i915_enable_hangcheck)
>  		return;
>  
> +	if (i915_reset_in_progress(&dev_priv->gpu_error))
> +		return;

atomic_t are weakly-ordered (I know, we're on x86 here ...) and I think
we're missing the requisite amount of barriers to keep races at bay.

I think wrapping up all access to the hangcheck stats (both from the
hangcheck timer and in the reset code and eventually in the readout code)
with an irq-save spinlock is the simpler and much more obviously correct
(and hence safer) option. Note that you can't optimize away the irq
save/restore stuff in the timer since we call the hangcheck stuff also
from hardirq context.

So I'll punt on this patch here for now, merged all the others leading up
to this one here.

Thanks, Daniel

> +
>  	for_each_ring(ring, dev_priv, i) {
>  		u32 seqno, acthd;
>  		bool busy = true;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2013-07-16  8:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03 14:22 [PATCH 0/7] Hangcheck and arb robustness Mika Kuoppala
2013-07-03 14:22 ` [PATCH 1/7] drm/i915: Fix retrieval of hangcheck stats Mika Kuoppala
2013-07-03 14:22 ` [PATCH 2/7] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID Mika Kuoppala
2013-07-03 14:22 ` [PATCH 3/7] drm/i915: introduce i915_queue_hangcheck Mika Kuoppala
2013-07-03 14:22 ` [PATCH 4/7] drm/i915: no hangcheck when reset is in progress Mika Kuoppala
2013-07-16  8:45   ` Daniel Vetter [this message]
2013-07-03 14:22 ` [PATCH 5/7] drm/i915: queue hangcheck on reset Mika Kuoppala
2013-07-16  8:49   ` Daniel Vetter
2013-07-16  9:16     ` Chris Wilson
2013-07-03 14:22 ` [PATCH 6/7] drm/i915: add i915_reset_count Mika Kuoppala
2013-07-03 14:22 ` [PATCH 7/7] drm/i915: add i915_get_reset_stats_ioctl Mika Kuoppala
2013-07-03 15:14   ` Chris Wilson
2013-07-03 21:23     ` Ben Widawsky
2013-07-03 21:41       ` Chris Wilson
2013-07-03 21:44         ` Ben Widawsky
2013-07-03 21:58           ` Daniel Vetter
2013-07-03 22:00             ` Ben Widawsky
2013-07-04  7:54               ` Ville Syrjälä
2013-07-04 16:39                 ` Ben Widawsky
2013-10-26  1:42   ` Ian Romanick
2013-10-27 12:30     ` Daniel Vetter
2013-10-29 22:29       ` Ian Romanick
2013-10-30  8:21         ` Daniel Vetter
2013-11-08  5:48           ` Dave Airlie
2013-11-08  6:32             ` Daniel Vetter
2013-11-08 17:21               ` Ian Romanick
2013-11-08 19:00                 ` Dave Airlie
2013-11-08 21:20                   ` Ian Romanick
2013-11-08 19:22               ` Jesse Barnes

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=20130716084559.GO5784@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    /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