drm/i915: Assert mutex_is_locked on context lookup
authorBen Widawsky <ben@bwidawsk.net>
Wed, 24 Apr 2013 06:15:29 +0000 (23:15 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 6 May 2013 09:30:29 +0000 (11:30 +0200)
commit186507e9e8e89d5920305fdffd8cbba6366da795
tree0cffd6274ac181055dcc5c2242f40473afcfddfc
parenta1520318a51d6c21b1d9229a9c35b4fcb890b175
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>
drivers/gpu/drm/i915/i915_gem_context.c