2016-06-08 09:59:37 +00:00
|
|
|
From 4b137e2962b14c62089f4368391fa1ed03cac391 Mon Sep 17 00:00:00 2001
|
2016-01-17 10:42:23 +00:00
|
|
|
From: Eric Anholt <eric@anholt.net>
|
|
|
|
Date: Mon, 19 Oct 2015 08:44:35 -0700
|
2016-06-08 09:59:37 +00:00
|
|
|
Subject: [PATCH 096/381] drm/vc4: Drop struct_mutex around CL validation.
|
2016-01-17 10:42:23 +00:00
|
|
|
|
|
|
|
We were using it so that we could make sure that shader validation
|
|
|
|
state didn't change while we were validating, but now shader
|
|
|
|
validation state is immutable. The bcl/rcl generation doesn't do any
|
|
|
|
other BO dereferencing, and seems to have no other global state
|
2016-04-07 19:25:10 +00:00
|
|
|
dependency not covered by job_lock / bo_lock. We only need to hold
|
|
|
|
struct_mutex for object unreferencing.
|
2016-01-17 10:42:23 +00:00
|
|
|
|
|
|
|
Fixes a lock order reversal between mmap_sem and struct_mutex.
|
|
|
|
|
|
|
|
Signed-off-by: Eric Anholt <eric@anholt.net>
|
|
|
|
---
|
2016-04-07 19:25:10 +00:00
|
|
|
drivers/gpu/drm/vc4/vc4_gem.c | 13 ++++++-------
|
|
|
|
1 file changed, 6 insertions(+), 7 deletions(-)
|
2016-01-17 10:42:23 +00:00
|
|
|
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_gem.c
|
|
|
|
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
|
2016-04-07 19:25:10 +00:00
|
|
|
@@ -439,10 +439,12 @@ fail:
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
-vc4_complete_exec(struct vc4_exec_info *exec)
|
|
|
|
+vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)
|
2016-01-17 10:42:23 +00:00
|
|
|
{
|
2016-04-07 19:25:10 +00:00
|
|
|
unsigned i;
|
2016-01-17 10:42:23 +00:00
|
|
|
|
2016-04-07 19:25:10 +00:00
|
|
|
+ /* Need the struct lock for drm_gem_object_unreference(). */
|
|
|
|
+ mutex_lock(&dev->struct_mutex);
|
|
|
|
if (exec->bo) {
|
|
|
|
for (i = 0; i < exec->bo_count; i++)
|
|
|
|
drm_gem_object_unreference(&exec->bo[i].bo->base);
|
|
|
|
@@ -455,6 +457,7 @@ vc4_complete_exec(struct vc4_exec_info *
|
|
|
|
list_del(&bo->unref_head);
|
|
|
|
drm_gem_object_unreference(&bo->base.base);
|
|
|
|
}
|
|
|
|
+ mutex_unlock(&dev->struct_mutex);
|
2016-01-17 10:42:23 +00:00
|
|
|
|
2016-04-07 19:25:10 +00:00
|
|
|
kfree(exec);
|
|
|
|
}
|
|
|
|
@@ -473,7 +476,7 @@ vc4_job_handle_completed(struct vc4_dev
|
|
|
|
list_del(&exec->head);
|
2016-01-17 10:42:23 +00:00
|
|
|
|
2016-04-07 19:25:10 +00:00
|
|
|
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
|
|
|
|
- vc4_complete_exec(exec);
|
|
|
|
+ vc4_complete_exec(vc4->dev, exec);
|
|
|
|
spin_lock_irqsave(&vc4->job_lock, irqflags);
|
|
|
|
}
|
2016-01-17 10:42:23 +00:00
|
|
|
|
2016-04-07 19:25:10 +00:00
|
|
|
@@ -525,12 +528,8 @@ vc4_job_done_work(struct work_struct *wo
|
|
|
|
{
|
|
|
|
struct vc4_dev *vc4 =
|
|
|
|
container_of(work, struct vc4_dev, job_done_work);
|
|
|
|
- struct drm_device *dev = vc4->dev;
|
2016-01-17 10:42:23 +00:00
|
|
|
|
2016-04-07 19:25:10 +00:00
|
|
|
- /* Need the struct lock for drm_gem_object_unreference(). */
|
|
|
|
- mutex_lock(&dev->struct_mutex);
|
|
|
|
vc4_job_handle_completed(vc4);
|
2016-01-17 10:42:23 +00:00
|
|
|
- mutex_unlock(&dev->struct_mutex);
|
2016-04-07 19:25:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
@@ -639,7 +638,7 @@ vc4_submit_cl_ioctl(struct drm_device *d
|
2016-01-17 10:42:23 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
fail:
|
2016-04-07 19:25:10 +00:00
|
|
|
- vc4_complete_exec(exec);
|
|
|
|
+ vc4_complete_exec(vc4->dev, exec);
|
2016-01-17 10:42:23 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|