drm/i915: Use uninterruptible mutex_lock for userptr bo creation

Mika encountered one pathological scenario under X where acquiring all
the mm locks (required to insert a mmu notifier) was very slow, so slow
that by the time we tried to lock the struct_mutex with the usual call
to i915_mutex_lock_interruptible(), X's signal timer had fired causing
us to restart the ioctl (and so looped indefinitely).

While I suspect this is the result of another bug (something leaking mm
perhaps?) we can forgo the error checking and interuptible nature of the
lock here so we only have to pay the expense once and get on with it.
This does expose the userptr creation routine to a driver livelock
though by not being interruptible.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
[danvet: Init ret to avoid issues reported by PRTS.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Chris Wilson 2015-05-15 11:42:21 +01:00 committed by Daniel Vetter
parent 8504c74c7a
commit 281400ff0f

View File

@ -219,11 +219,14 @@ i915_mmu_notifier_add(struct drm_device *dev,
struct i915_mmu_object *mo) struct i915_mmu_object *mo)
{ {
struct interval_tree_node *it; struct interval_tree_node *it;
int ret; int ret = 0;
ret = i915_mutex_lock_interruptible(dev); /* By this point we have already done a lot of expensive setup that
if (ret) * we do not want to repeat just because the caller (e.g. X) has a
return ret; * signal pending (and partly because of that expensive setup, X
* using an interrupt timer is likely to get stuck in an EINTR loop).
*/
mutex_lock(&dev->struct_mutex);
/* Make sure we drop the final active reference (and thereby /* Make sure we drop the final active reference (and thereby
* remove the objects from the interval tree) before we do * remove the objects from the interval tree) before we do