1 From 1eba33023a05b04c591b212fbd5d3f19115c49b3 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 19 Oct 2015 08:44:35 -0700
4 Subject: [PATCH 096/156] drm/vc4: Drop struct_mutex around CL validation.
6 We were using it so that we could make sure that shader validation
7 state didn't change while we were validating, but now shader
8 validation state is immutable. The bcl/rcl generation doesn't do any
9 other BO dereferencing, and seems to have no other global state
10 dependency not covered by job_lock / bo_lock.
12 Fixes a lock order reversal between mmap_sem and struct_mutex.
14 Signed-off-by: Eric Anholt <eric@anholt.net>
16 drivers/gpu/drm/vc4/vc4_gem.c | 12 ++++--------
17 1 file changed, 4 insertions(+), 8 deletions(-)
19 --- a/drivers/gpu/drm/vc4/vc4_gem.c
20 +++ b/drivers/gpu/drm/vc4/vc4_gem.c
21 @@ -244,13 +244,15 @@ static void
22 vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec)
24 struct vc4_dev *vc4 = to_vc4_dev(dev);
25 - uint64_t seqno = ++vc4->emit_seqno;
27 unsigned long irqflags;
29 + spin_lock_irqsave(&vc4->job_lock, irqflags);
31 + seqno = ++vc4->emit_seqno;
33 vc4_update_bo_seqnos(exec, seqno);
35 - spin_lock_irqsave(&vc4->job_lock, irqflags);
36 list_add_tail(&exec->head, &vc4->job_list);
38 /* If no job was executing, kick ours off. Otherwise, it'll
39 @@ -608,8 +610,6 @@ vc4_submit_cl_ioctl(struct drm_device *d
41 INIT_LIST_HEAD(&exec->unref_list);
43 - mutex_lock(&dev->struct_mutex);
45 ret = vc4_cl_lookup_bos(dev, file_priv, exec);
48 @@ -636,15 +636,11 @@ vc4_submit_cl_ioctl(struct drm_device *d
49 /* Return the seqno for our job. */
50 args->seqno = vc4->emit_seqno;
52 - mutex_unlock(&dev->struct_mutex);
57 vc4_complete_exec(exec);
59 - mutex_unlock(&dev->struct_mutex);