mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: fix double lock on glob->lru_lock
@ 2017-12-22 18:03 Colin King
  2017-12-22 18:58 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-12-22 18:03 UTC (permalink / raw)
  To: Christian Koenig, Roger He, David Airlie, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Lock glob->lru_lock is locked before the while loop and also
locked again at the end of the while loop; it appears that the
lock at the end of the while loop is a double lock that should
be removed.  CoverityScan picked this up with the introduction
of the referenced commit inthe Fixes tag, however, it may have
existed before this.  I've not been able to test this, but it
does look incorrect to me.

Detected by CoverityScan, CID#1268846 ("Double lock")

Fixes: 827ed2b06b05 ("drm/ttm: use try_lock in ttm_bo_delayed_delete again")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 60bb5c12b568..fb8d13a4bc94 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -595,7 +595,6 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)
 		}
 
 		kref_put(&bo->list_kref, ttm_bo_release_list);
-		spin_lock(&glob->lru_lock);
 	}
 	list_splice_tail(&removed, &bdev->ddestroy);
 	empty = list_empty(&bdev->ddestroy);
-- 
2.14.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/ttm: fix double lock on glob->lru_lock
  2017-12-22 18:03 [PATCH] drm/ttm: fix double lock on glob->lru_lock Colin King
@ 2017-12-22 18:58 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2017-12-22 18:58 UTC (permalink / raw)
  To: Colin King, Roger He, David Airlie, dri-devel
  Cc: kernel-janitors, linux-kernel

NAK,  ttm_bo_cleanup_refs() is dropping the lock.

Your backtrace is cause by an issue I've fixed this morning on 
amd-staging-drm-next.

Regards,
Christian.

Am 22.12.2017 um 19:03 schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> Lock glob->lru_lock is locked before the while loop and also
> locked again at the end of the while loop; it appears that the
> lock at the end of the while loop is a double lock that should
> be removed.  CoverityScan picked this up with the introduction
> of the referenced commit inthe Fixes tag, however, it may have
> existed before this.  I've not been able to test this, but it
> does look incorrect to me.
>
> Detected by CoverityScan, CID#1268846 ("Double lock")
>
> Fixes: 827ed2b06b05 ("drm/ttm: use try_lock in ttm_bo_delayed_delete again")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 60bb5c12b568..fb8d13a4bc94 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -595,7 +595,6 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)
>   		}
>   
>   		kref_put(&bo->list_kref, ttm_bo_release_list);
> -		spin_lock(&glob->lru_lock);
>   	}
>   	list_splice_tail(&removed, &bdev->ddestroy);
>   	empty = list_empty(&bdev->ddestroy);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-22 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 18:03 [PATCH] drm/ttm: fix double lock on glob->lru_lock Colin King
2017-12-22 18:58 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome