Commit ecbec53b authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

drm/i915: more struct_mutex locking

When auditing the locking in i915_gem.c (for a prospective change which
I then abandoned), I noticed two places where struct_mutex is not held
across GEM object manipulations that would usually require it.

Since one is in initial setup and the other in driver unload, I'm
guessing the mutex is not required for either; but post a patch in case
it is.
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e2377fe0
...@@ -2182,9 +2182,8 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -2182,9 +2182,8 @@ int i915_driver_unload(struct drm_device *dev)
/* Flush any outstanding unpin_work. */ /* Flush any outstanding unpin_work. */
flush_workqueue(dev_priv->wq); flush_workqueue(dev_priv->wq);
i915_gem_free_all_phys_object(dev);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
i915_gem_free_all_phys_object(dev);
i915_gem_cleanup_ringbuffer(dev); i915_gem_cleanup_ringbuffer(dev);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (I915_HAS_FBC(dev) && i915_powersave) if (I915_HAS_FBC(dev) && i915_powersave)
......
...@@ -1416,6 +1416,8 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1416,6 +1416,8 @@ void intel_setup_overlay(struct drm_device *dev)
goto out_free; goto out_free;
overlay->reg_bo = reg_bo; overlay->reg_bo = reg_bo;
mutex_lock(&dev->struct_mutex);
if (OVERLAY_NEEDS_PHYSICAL(dev)) { if (OVERLAY_NEEDS_PHYSICAL(dev)) {
ret = i915_gem_attach_phys_object(dev, reg_bo, ret = i915_gem_attach_phys_object(dev, reg_bo,
I915_GEM_PHYS_OVERLAY_REGS, I915_GEM_PHYS_OVERLAY_REGS,
...@@ -1440,6 +1442,8 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1440,6 +1442,8 @@ void intel_setup_overlay(struct drm_device *dev)
} }
} }
mutex_unlock(&dev->struct_mutex);
/* init all values */ /* init all values */
overlay->color_key = 0x0101fe; overlay->color_key = 0x0101fe;
overlay->brightness = -19; overlay->brightness = -19;
...@@ -1464,6 +1468,7 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1464,6 +1468,7 @@ void intel_setup_overlay(struct drm_device *dev)
i915_gem_object_unpin(reg_bo); i915_gem_object_unpin(reg_bo);
out_free_bo: out_free_bo:
drm_gem_object_unreference(&reg_bo->base); drm_gem_object_unreference(&reg_bo->base);
mutex_unlock(&dev->struct_mutex);
out_free: out_free:
kfree(overlay); kfree(overlay);
return; return;
......
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