]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: relative_constants_mode race fix
authorBen Widawsky <ben@bwidawsk.net>
Tue, 13 Dec 2011 03:21:57 +0000 (19:21 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 3 Jan 2012 17:09:44 +0000 (09:09 -0800)
commit26c1605b03852b9355e53d0037ebf11855a352bb
treee85a6591108ae7a5aa0cf0bb2bb6a1bc85b1ae5e
parent02112d1d80933b849cc4354c8d2135b482a93a28
drm/i915: relative_constants_mode race fix

dev_priv keeps track of the current addressing mode that gets set at
execbuffer time. Unfortunately the existing code was doing this before
acquiring struct_mutex which leaves a race with another thread also
doing an execbuffer. If that wasn't bad enough, relocate_slow drops
struct_mutex which opens a much more likely error where another thread
comes in and modifies the state while relocate_slow is being slow.

The solution here is to just defer setting this state until we
absolutely need it, and we know we'll have struct_mutex for the
remainder of our code path.

v2: Keith noticed a bug in the original patch.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/i915_gem_execbuffer.c