OSDN Git Service

drm/i915: Pin the pages first in shmem prepare read/write
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 16:16:50 +0000 (17:16 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 18 Aug 2016 21:36:45 +0000 (22:36 +0100)
commit9764951e7f517717bc7ecc3f1a9711816646ebf7
tree8b1c971efc4773effa1fe21ba31ac49dd9334ef9
parent3b5724d702ef24ee41ca008a1fab1cf94f3d31b5
drm/i915: Pin the pages first in shmem prepare read/write

There is an improbable, but not impossible, case that if we leave the
pages unpin as we operate on the object, then somebody via the shrinker
may steal the lock (which lock? right now, it is struct_mutex, THE lock)
and change the cache domains after we have already inspected them.

(Whilst here, avail ourselves of the opportunity to take a couple of
steps to make the two functions look more similar.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-11-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c