brcm2708: update linux 4.4 patches to latest version
[openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0096-drm-vc4-Drop-struct_mutex-around-CL-validation.patch
1 From 4dc15a296586679d5b014011e44a093cf962123e 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/170] drm/vc4: Drop struct_mutex around CL validation.
5
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.
11
12 Fixes a lock order reversal between mmap_sem and struct_mutex.
13
14 Signed-off-by: Eric Anholt <eric@anholt.net>
15 ---
16  drivers/gpu/drm/vc4/vc4_gem.c | 12 ++++--------
17  1 file changed, 4 insertions(+), 8 deletions(-)
18
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)
23  {
24         struct vc4_dev *vc4 = to_vc4_dev(dev);
25 -       uint64_t seqno = ++vc4->emit_seqno;
26 +       uint64_t seqno;
27         unsigned long irqflags;
28  
29 +       spin_lock_irqsave(&vc4->job_lock, irqflags);
30 +
31 +       seqno = ++vc4->emit_seqno;
32         exec->seqno = seqno;
33         vc4_update_bo_seqnos(exec, seqno);
34  
35 -       spin_lock_irqsave(&vc4->job_lock, irqflags);
36         list_add_tail(&exec->head, &vc4->job_list);
37  
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
40         exec->args = args;
41         INIT_LIST_HEAD(&exec->unref_list);
42  
43 -       mutex_lock(&dev->struct_mutex);
44 -
45         ret = vc4_cl_lookup_bos(dev, file_priv, exec);
46         if (ret)
47                 goto fail;
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;
51  
52 -       mutex_unlock(&dev->struct_mutex);
53 -
54         return 0;
55  
56  fail:
57         vc4_complete_exec(exec);
58  
59 -       mutex_unlock(&dev->struct_mutex);
60 -
61         return ret;
62  }
63