diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2013-04-24 10:15:29 +0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-06 13:30:29 +0400 |
commit | 186507e9e8e89d5920305fdffd8cbba6366da795 (patch) | |
tree | 0cffd6274ac181055dcc5c2242f40473afcfddfc /drivers | |
parent | a1520318a51d6c21b1d9229a9c35b4fcb890b175 (diff) | |
download | linux-186507e9e8e89d5920305fdffd8cbba6366da795.tar.xz |
drm/i915: Assert mutex_is_locked on context lookup
Because our context refcounting doesn't grab a ref at lookup time, it is
unsafe to do so without the lock.
NOTE: We don't have an easy way to put the assertion in the lookup
function which is where this really belongs. Context switching is good
enough because it actually asserts even more correctness by protecting
the default_context.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[danvet: s/BUG/WARN/]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index efa0ede5c679..c81ae52c8c2e 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -463,6 +463,8 @@ int i915_switch_context(struct intel_ring_buffer *ring, if (dev_priv->hw_contexts_disabled) return 0; + WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + if (ring != &dev_priv->ring[RCS]) return 0; |