Re: [PATCH 01/10] drm/ttm: allocate resource object instead of embedding it v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 6/2/21 12:09 PM, Christian König wrote:
To improve the handling we want the establish the resource object as base
class for the backend allocations.

v2: add missing error handling

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  4 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 54 +++++++-------
  drivers/gpu/drm/nouveau/nouveau_bo.c       |  2 +-
  drivers/gpu/drm/radeon/radeon_ttm.c        |  2 +-
  drivers/gpu/drm/ttm/ttm_bo.c               | 83 ++++++++--------------
  drivers/gpu/drm/ttm/ttm_bo_util.c          | 43 ++++++-----
  drivers/gpu/drm/ttm/ttm_resource.c         | 31 +++++---
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c |  2 +-
  include/drm/ttm/ttm_bo_api.h               |  1 -
  include/drm/ttm/ttm_bo_driver.h            | 10 ++-
  include/drm/ttm/ttm_resource.h             |  4 +-
  11 files changed, 110 insertions(+), 126 deletions(-)
...
@@ -629,7 +628,7 @@ static void ttm_bo_move_pipeline_evict(struct ttm_buffer_object *bo,
  	}
  	spin_unlock(&from->move_lock);
- ttm_resource_free(bo, bo->resource);
+	ttm_resource_free(bo, &bo->resource);
dma_fence_put(bo->moving);
  	bo->moving = dma_fence_get(fence);
@@ -678,11 +677,11 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
  	if (ret)
  		ttm_bo_wait(bo, false, false);
- ttm_resource_alloc(bo, &sys_mem, bo->resource);
+	ret = ttm_resource_alloc(bo, &sys_mem, &bo->resource);
  	bo->ttm = NULL;
dma_resv_unlock(&ghost->base._resv);
  	ttm_bo_put(ghost);
- return 0;
+	return ret;

Here we re-introduce a late point of failure, which I guess leaves the bo in an undefined state? Same thing with my optimization for the idle case. Needs fixing as soon as possible.

/Thomas





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux