]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/msm: Switch idr_lock to spinlock
authorRob Clark <robdclark@chromium.org>
Mon, 20 Mar 2023 14:43:32 +0000 (07:43 -0700)
committerRob Clark <robdclark@chromium.org>
Sat, 25 Mar 2023 23:31:44 +0000 (16:31 -0700)
Needed to idr_preload() which returns with preemption disabled.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/527846/
Link: https://lore.kernel.org/r/20230320144356.803762-11-robdclark@gmail.com
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_gem_submit.c
drivers/gpu/drm/msm/msm_gpu.h
drivers/gpu/drm/msm/msm_submitqueue.c

index aca48c868c14d4046963d5c8de6df1c474c8e69b..ce1a77b607d1be92ef259e0a0e3942be0d19cfa2 100644 (file)
@@ -918,13 +918,11 @@ static int wait_fence(struct msm_gpu_submitqueue *queue, uint32_t fence_id,
         * retired, so if the fence is not found it means there is nothing
         * to wait for
         */
-       ret = mutex_lock_interruptible(&queue->idr_lock);
-       if (ret)
-               return ret;
+       spin_lock(&queue->idr_lock);
        fence = idr_find(&queue->fence_idr, fence_id);
        if (fence)
                fence = dma_fence_get_rcu(fence);
-       mutex_unlock(&queue->idr_lock);
+       spin_unlock(&queue->idr_lock);
 
        if (!fence)
                return 0;
index 115a5547118ed64116cc2ce7a5cac86e2094c933..513c5d57079226c014716cd79544696ea3dca710 100644 (file)
@@ -80,9 +80,9 @@ void __msm_gem_submit_destroy(struct kref *kref)
        unsigned i;
 
        if (submit->fence_id) {
-               mutex_lock(&submit->queue->idr_lock);
+               spin_lock(&submit->queue->idr_lock);
                idr_remove(&submit->queue->fence_idr, submit->fence_id);
-               mutex_unlock(&submit->queue->idr_lock);
+               spin_unlock(&submit->queue->idr_lock);
        }
 
        dma_fence_put(submit->user_fence);
@@ -882,7 +882,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 
        submit->nr_cmds = i;
 
-       mutex_lock(&queue->idr_lock);
+       spin_lock(&queue->idr_lock);
 
        /*
         * If using userspace provided seqno fence, validate that the id
@@ -892,7 +892,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
         */
        if ((args->flags & MSM_SUBMIT_FENCE_SN_IN) &&
                        idr_find(&queue->fence_idr, args->fence)) {
-               mutex_unlock(&queue->idr_lock);
+               spin_unlock(&queue->idr_lock);
                ret = -EINVAL;
                goto out;
        }
@@ -926,7 +926,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
                                                    INT_MAX, GFP_KERNEL);
        }
 
-       mutex_unlock(&queue->idr_lock);
+       spin_unlock(&queue->idr_lock);
 
        if (submit->fence_id < 0) {
                ret = submit->fence_id;
index 0d261bbc09d4d630a249398f529e8ac894f6fcfd..84c616b1ebc0e6705a12747f55b7e5f3702d11c2 100644 (file)
@@ -495,7 +495,7 @@ struct msm_gpu_submitqueue {
        struct msm_file_private *ctx;
        struct list_head node;
        struct idr fence_idr;
-       struct mutex idr_lock;
+       struct spinlock idr_lock;
        struct mutex lock;
        struct kref ref;
        struct drm_sched_entity *entity;
index c6929e205b511e923e122e88e6fa32eabce9ab0a..0e803125a325aa67639406ef413aaeb6a9f08cee 100644 (file)
@@ -200,7 +200,7 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx,
                *id = queue->id;
 
        idr_init(&queue->fence_idr);
-       mutex_init(&queue->idr_lock);
+       spin_lock_init(&queue->idr_lock);
        mutex_init(&queue->lock);
 
        list_add_tail(&queue->node, &ctx->submitqueues);