This is internal only patch, please send to internal mail list.

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of 
Junwei Zhang
Sent: Friday, May 12, 2017 2:54 PM
To: [email protected]
Cc: Zhang, Jerry <[email protected]>
Subject: [PATCH] drm/amdgpu: fix sem list soft lockup issue

sem should be delete from the previous sem list then add to the new sem list.

If adding sem to the list which is same as previous one, it will cause endless 
loop when traverses the sem list.

[  264.133878] NMI watchdog: BUG: soft lockup - CPU#5 stuck for 22s!
...
[  264.133928] task: ffffa216ffbfbd00 task.stack: ffffa216f4220000 [  
264.133929] RIP: 0010:[<ffffffffc0584523>]  [<ffffffffc0584523>]
amdgpu_sem_put+0x13/0x30 [amdgpu]
[  264.133983] RSP: 0018:ffffa216f4223cb0  EFLAGS: 00200286

Signed-off-by: Junwei Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 +++-  
drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index ff20e11..aac43c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -84,8 +84,10 @@ static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
 
                mutex_lock(&ctx->rings[i].sem_lock);
                /* release all the reset inserted SEM here */
-               list_for_each_entry_safe(sem, tmp, &ctx->rings[i].sem_list, 
list)
+               list_for_each_entry_safe(sem, tmp, &ctx->rings[i].sem_list, 
list) {
+                       list_del_init(&sem->list);
                        amdgpu_sem_put(sem);
+               }
 
                mutex_unlock(&ctx->rings[i].sem_lock);
                mutex_destroy(&ctx->rings[i].sem_lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c
index 0302ea6..a7149ac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c
@@ -371,6 +371,7 @@ static int amdgpu_sem_cring_add(struct amdgpu_fpriv *fpriv,
        if (r)
                goto err;
        mutex_lock(&ctx->rings[out_ring->idx].sem_lock);
+       list_del_init(&sem->list);
        list_add(&sem->list, &ctx->rings[out_ring->idx].sem_list);
        mutex_unlock(&ctx->rings[out_ring->idx].sem_lock);
        amdgpu_sem_get(sem);
--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to