diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-04 09:12:07 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-09-04 11:01:14 -0400 |
commit | a167b1e1319cac8894a88e9ea05a13be05b46d87 (patch) | |
tree | e86a367f0af8fafe401c754c994d170285157ff6 | |
parent | b212f0a470eeb62a8eaa95f51b3cdbc457f687a8 (diff) |
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: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intelcom>
Link: https://patchwork.freedesktop.org/patch/msgid/20180904131207.17563-1-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/i915/intel_uncore.c | 13 |
1 files 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) | |||
2283 | bool | 2283 | bool |
2284 | intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv) | 2284 | intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv) |
2285 | { | 2285 | { |
2286 | bool ret = false; | ||
2287 | |||
2288 | spin_lock_irq(&dev_priv->uncore.lock); | ||
2289 | |||
2286 | if (unlikely(dev_priv->uncore.unclaimed_mmio_check <= 0)) | 2290 | if (unlikely(dev_priv->uncore.unclaimed_mmio_check <= 0)) |
2287 | return false; | 2291 | goto out; |
2288 | 2292 | ||
2289 | if (unlikely(intel_uncore_unclaimed_mmio(dev_priv))) { | 2293 | if (unlikely(intel_uncore_unclaimed_mmio(dev_priv))) { |
2290 | if (!i915_modparams.mmio_debug) { | 2294 | if (!i915_modparams.mmio_debug) { |
@@ -2294,10 +2298,13 @@ intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv) | |||
2294 | i915_modparams.mmio_debug++; | 2298 | i915_modparams.mmio_debug++; |
2295 | } | 2299 | } |
2296 | dev_priv->uncore.unclaimed_mmio_check--; | 2300 | dev_priv->uncore.unclaimed_mmio_check--; |
2297 | return true; | 2301 | ret = true; |
2298 | } | 2302 | } |
2299 | 2303 | ||
2300 | return false; | 2304 | out: |
2305 | spin_unlock_irq(&dev_priv->uncore.lock); | ||
2306 | |||
2307 | return ret; | ||
2301 | } | 2308 | } |
2302 | 2309 | ||
2303 | static enum forcewake_domains | 2310 | static enum forcewake_domains |