drm/ttm: use reservation_object_trylock in ttm_bo_individualize_resv v2

Submitted by Christian König on Aug. 18, 2017, 1:31 p.m.

Details

Message ID 1503063097-2542-1-git-send-email-deathsimple@vodafone.de
State New
Headers show
Series "drm/ttm: use reservation_object_trylock in ttm_bo_individualize_resv" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Christian König Aug. 18, 2017, 1:31 p.m.
From: Christian König <christian.koenig@amd.com>

Fixes a false positive from might_sleep(). The reservation object is freshly
initialized, so nobody else can hold the mutex but the function is
called from atomic context.

v2: Correctly invert the check as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 58e7fce..cba11f1 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -403,7 +403,7 @@  static int ttm_bo_individualize_resv(struct ttm_buffer_object *bo)
 		return 0;
 
 	reservation_object_init(&bo->ttm_resv);
-	BUG_ON(reservation_object_lock(&bo->ttm_resv, NULL));
+	BUG_ON(!reservation_object_trylock(&bo->ttm_resv));
 
 	r = reservation_object_copy_fences(&bo->ttm_resv, bo->resv);
 	if (r) {

Comments

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Christian König

> Sent: Friday, August 18, 2017 9:32 AM

> To: dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org

> Subject: [PATCH] drm/ttm: use reservation_object_trylock in

> ttm_bo_individualize_resv v2

> 

> From: Christian König <christian.koenig@amd.com>

> 

> Fixes a false positive from might_sleep(). The reservation object is freshly

> initialized, so nobody else can hold the mutex but the function is

> called from atomic context.

> 

> v2: Correctly invert the check as well.

> 

> Signed-off-by: Christian König <christian.koenig@amd.com>


Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


> ---

>  drivers/gpu/drm/ttm/ttm_bo.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c

> index 58e7fce..cba11f1 100644

> --- a/drivers/gpu/drm/ttm/ttm_bo.c

> +++ b/drivers/gpu/drm/ttm/ttm_bo.c

> @@ -403,7 +403,7 @@ static int ttm_bo_individualize_resv(struct

> ttm_buffer_object *bo)

>  		return 0;

> 

>  	reservation_object_init(&bo->ttm_resv);

> -	BUG_ON(reservation_object_lock(&bo->ttm_resv, NULL));

> +	BUG_ON(!reservation_object_trylock(&bo->ttm_resv));

> 

>  	r = reservation_object_copy_fences(&bo->ttm_resv, bo->resv);

>  	if (r) {

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx