drm/msm: Remove struct_mutex usage
The remaining struct_mutex usage is just to serialize various gpu related things (submit/retire/recover/fault/etc), so replace struct_mutex with gpu->lock. Signed-off-by: Rob Clark <robdclark@chromium.org> Link: https://lore.kernel.org/r/20211109181117.591148-4-robdclark@gmail.com Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
@@ -86,7 +86,7 @@ struct msm_rd_state {
|
||||
struct msm_gem_submit *submit;
|
||||
|
||||
/* fifo access is synchronized on the producer side by
|
||||
* struct_mutex held by submit code (otherwise we could
|
||||
* gpu->lock held by submit code (otherwise we could
|
||||
* end up w/ cmds logged in different order than they
|
||||
* were executed). And read_lock synchronizes the reads
|
||||
*/
|
||||
@@ -181,9 +181,12 @@ static int rd_open(struct inode *inode, struct file *file)
|
||||
uint32_t gpu_id;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
if (!gpu)
|
||||
return -ENODEV;
|
||||
|
||||
if (rd->open || !gpu) {
|
||||
mutex_lock(&gpu->lock);
|
||||
|
||||
if (rd->open) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
@@ -200,7 +203,7 @@ static int rd_open(struct inode *inode, struct file *file)
|
||||
rd_write_section(rd, RD_GPU_ID, &gpu_id, sizeof(gpu_id));
|
||||
|
||||
out:
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
mutex_unlock(&gpu->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -340,11 +343,10 @@ out_unlock:
|
||||
msm_gem_unlock(&obj->base);
|
||||
}
|
||||
|
||||
/* called under struct_mutex */
|
||||
/* called under gpu->lock */
|
||||
void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
struct drm_device *dev = submit->dev;
|
||||
struct task_struct *task;
|
||||
char msg[256];
|
||||
int i, n;
|
||||
@@ -355,7 +357,7 @@ void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
|
||||
/* writing into fifo is serialized by caller, and
|
||||
* rd->read_lock is used to serialize the reads
|
||||
*/
|
||||
WARN_ON(!mutex_is_locked(&dev->struct_mutex));
|
||||
WARN_ON(!mutex_is_locked(&submit->gpu->lock));
|
||||
|
||||
if (fmt) {
|
||||
va_list args;
|
||||
|
||||
Reference in New Issue
Block a user