[PATCH 3.16 227/346] drm/msm: use mutex_lock_interruptible for submit ioctl

From: Ben Hutchings
Date: Sun Nov 13 2016 - 21:33:21 EST


3.16.39-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Rob Clark <robdclark@xxxxxxxxx>

commit b5b4c264df4d270819676b290cef9a11d04c35f0 upstream.

Be kinder to things that do lots of signal handling (ie. Xorg)

Signed-off-by: Rob Clark <robdclark@xxxxxxxxx>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -339,12 +339,14 @@ int msm_ioctl_gem_submit(struct drm_devi
if (args->nr_cmds > MAX_CMDS)
return -EINVAL;

- mutex_lock(&dev->struct_mutex);
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;

submit = submit_create(dev, gpu, args->nr_bos);
if (!submit) {
ret = -ENOMEM;
- goto out;
+ goto out_unlock;
}

ret = submit_lookup_objects(submit, args, file);
@@ -422,6 +424,7 @@ int msm_ioctl_gem_submit(struct drm_devi
out:
if (submit)
submit_cleanup(submit, !!ret);
+out_unlock:
mutex_unlock(&dev->struct_mutex);
return ret;
}