Commit a167b1e1 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Pull intel_uncore_arm_unclaimed_mmio_detection() under the spinlock

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: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intelcom>
Link: https://patchwork.freedesktop.org/patch/msgid/20180904131207.17563-1-chris@chris-wilson.co.uk
parent b212f0a4
...@@ -2283,8 +2283,12 @@ bool intel_uncore_unclaimed_mmio(struct drm_i915_private *dev_priv) ...@@ -2283,8 +2283,12 @@ bool intel_uncore_unclaimed_mmio(struct drm_i915_private *dev_priv)
bool bool
intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv) 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)) if (unlikely(dev_priv->uncore.unclaimed_mmio_check <= 0))
return false; goto out;
if (unlikely(intel_uncore_unclaimed_mmio(dev_priv))) { if (unlikely(intel_uncore_unclaimed_mmio(dev_priv))) {
if (!i915_modparams.mmio_debug) { if (!i915_modparams.mmio_debug) {
...@@ -2294,10 +2298,13 @@ intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv) ...@@ -2294,10 +2298,13 @@ intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv)
i915_modparams.mmio_debug++; i915_modparams.mmio_debug++;
} }
dev_priv->uncore.unclaimed_mmio_check--; dev_priv->uncore.unclaimed_mmio_check--;
return true; ret = true;
} }
return false; out:
spin_unlock_irq(&dev_priv->uncore.lock);
return ret;
} }
static enum forcewake_domains static enum forcewake_domains
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment