All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Pull intel_uncore_arm_unclaimed_mmio_detection() under the spinlock
Date: Tue, 04 Sep 2018 16:29:47 +0300	[thread overview]
Message-ID: <87d0tt5r1w.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180904131207.17563-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Elsewhere we manipulate uncore.unclaimed_mmio_check and
> i915_param.mmio_debug under the irq lock (e.g. preserving the current
> value across a user forcewake grab), but do not protect the manipulation
> inside intel_uncore_arm_unclaimed_mmio_detection() from concurrent
> access, even from itself. This is an issue as we do call
> arm_unclaimed_mmio_detection from multiple threads without coordination.
>
> Suggested-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_uncore.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 05f0cda18501..3ad302c66254 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -2283,8 +2283,12 @@ bool intel_uncore_unclaimed_mmio(struct drm_i915_private *dev_priv)
>  bool
>  intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv)
>  {
> +	bool ret = false;
> +
> +	spin_lock_irq(&dev_priv->uncore.lock);
> +
>  	if (unlikely(dev_priv->uncore.unclaimed_mmio_check <= 0))
> -		return false;
> +		goto out;
>  
>  	if (unlikely(intel_uncore_unclaimed_mmio(dev_priv))) {
>  		if (!i915_modparams.mmio_debug) {
> @@ -2294,10 +2298,13 @@ intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv)
>  			i915_modparams.mmio_debug++;
>  		}
>  		dev_priv->uncore.unclaimed_mmio_check--;
> -		return true;
> +		ret = true;
>  	}
>  
> -	return false;
> +out:
> +	spin_unlock_irq(&dev_priv->uncore.lock);
> +
> +	return ret;

Patchbot didn't see how the future will unfold. I did.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intelcom>

>  }
>  
>  static enum forcewake_domains
> -- 
> 2.19.0.rc1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-09-04 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 13:12 [PATCH] drm/i915: Pull intel_uncore_arm_unclaimed_mmio_detection() under the spinlock Chris Wilson
2018-09-04 13:13 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-09-04 13:29 ` Mika Kuoppala [this message]
2018-09-04 14:57 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-04 20:22 ` ✓ Fi.CI.IGT: " Patchwork

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=87d0tt5r1w.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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.