drm/radeon: fix bo creation retry path
Subsystems (2)
PATCH 1/1 drm/radeon: fix bo creation retry path
From: Jerome Glisse <[email protected]>
Retry label was at wrong place in function leading to memory leak.
--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_object.c +2 -1
@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_device *rdev, acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo )); -retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;
@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ down_read (&rdev->pm.mclk_lock);
Signature · 1 line
1.7.10.4
Quoted 24 lines · On Don, 2012-07-12 at 18:23 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
Retry label was at wrong place in function leading to memory leak.
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_object.c +0
-1@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_device *rdev, acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo )); -retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;
drivers/gpu/drm/radeon/radeon_object.c retry: · line 158
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_object.c +2
-0@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ down_read (&rdev->pm.mclk_lock);
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer
Quoted 20 lines · Michel Dänzer
Quoted 19 lines · On Don, 2012-07-12 at 18:23 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
Retry label was at wrong place in function leading to memory leak.
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_object.c +0
-0@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_device *rdev, acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo ));
Quoted 15 lines
drivers/gpu/drm/radeon/radeon_object.c retry: · line 158
Quoted 13 lines
drivers/gpu/drm/radeon/radeon_object.c +2
-1-retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ down_read (&rdev->pm.mclk_lock);Reviewed-by Michel Dänzer <[email protected]>
Actually, this is wrong: ttm_bo_init() destroys the BO on failure. So this patch makes the retry path work with freed memory. I see on IRC that this is causing panics with some piglit tests for several people, please submit a patch to revert this.
Sorry I didn't remember this when reviewing the patch. :(
Signature · 2 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer
Quoted 37 lines · Michel Dänzer
Quoted 20 lines · Michel Dänzer
Quoted 19 lines · On Don, 2012-07-12 at 18:23 -0400, [email protected] wrote:
From: Jerome Glisse <[email protected]>
Retry label was at wrong place in function leading to memory leak.
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_object.c +0
-0@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_device *rdev, acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo ));Quoted 15 lines
drivers/gpu/drm/radeon/radeon_object.c retry: · line 158
Quoted 13 lines
drivers/gpu/drm/radeon/radeon_object.c +2
-1-retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ down_read (&rdev->pm.mclk_lock);Reviewed-by Michel Dänzer <[email protected]>
Quoted 6 lines
Actually, this is wrong:
ttm_bo_init()destroys the BO on failure. So this patch makes the retry path work with freed memory. I see on IRC that this is causing panics with some piglit tests for several people, please submit a patch to revert this.Sorry I didn't remember this when reviewing the patch. :(
Reverted in my -fixes queue.
Alex
Quoted 7 lines · On 13.07.2012 00:23, [email protected] wrote:
From: Jerome Glisse <[email protected]>
Retry label was at wrong place in function leading to memory leak.
Cc <[email protected]>Signed-off-by Jerome Glisse <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon_object.c +2
-1@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_device *rdev, acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo )); -retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ down_read (&rdev->pm.mclk_lock);