* [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-18 11:58 Christian König
2019-10-24 10:25 ` Christian König
0 siblings, 1 reply; 9+ messages in thread
From: Christian König @ 2019-10-18 11:58 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
This way the TTM is destroyed with the correct dma_resv object
locked and we can even pipeline imported BO evictions.
v2: Limit this to only cases when the parent object uses a separate
reservation object as well. This fixes another OOM problem.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index e030c27f53cf..45e440f80b7b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
kref_init(&fbo->base.kref);
fbo->base.destroy = &ttm_transfered_destroy;
fbo->base.acc_size = 0;
- fbo->base.base.resv = &fbo->base.base._resv;
+ if (bo->base.resv == &bo->base._resv)
+ fbo->base.base.resv = &fbo->base.base._resv;
+
dma_resv_init(fbo->base.base.resv);
ret = dma_resv_trylock(fbo->base.base.resv);
WARN_ON(!ret);
@@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret)
return ret;
- dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
+ dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
/**
* If we're not moving to fixed memory, the TTM object
@@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
else
bo->ttm = NULL;
- ttm_bo_unreserve(ghost_obj);
+ dma_resv_unlock(&ghost_obj->base._resv);
ttm_bo_put(ghost_obj);
}
@@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
if (ret)
return ret;
- dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
+ dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
/**
* If we're not moving to fixed memory, the TTM object
@@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
else
bo->ttm = NULL;
- ttm_bo_unreserve(ghost_obj);
+ dma_resv_unlock(&ghost_obj->base._resv);
ttm_bo_put(ghost_obj);
} else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
@@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
if (ret)
return ret;
- ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
+ ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
/* Last resort, wait for the BO to be idle when we are OOM */
if (ret)
ttm_bo_wait(bo, false, false);
@@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
bo->mem.mem_type = TTM_PL_SYSTEM;
bo->ttm = NULL;
- ttm_bo_unreserve(ghost);
+ dma_resv_unlock(&ghost->base._resv);
ttm_bo_put(ghost);
return 0;
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:25 ` Christian König
0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2019-10-24 10:25 UTC (permalink / raw)
To: dri-devel, amd-gfx, Zhou, David(ChunMing), Huang Rui
Ping?
Am 18.10.19 um 13:58 schrieb Christian König:
> This way the TTM is destroyed with the correct dma_resv object
> locked and we can even pipeline imported BO evictions.
>
> v2: Limit this to only cases when the parent object uses a separate
> reservation object as well. This fixes another OOM problem.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index e030c27f53cf..45e440f80b7b 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
> kref_init(&fbo->base.kref);
> fbo->base.destroy = &ttm_transfered_destroy;
> fbo->base.acc_size = 0;
> - fbo->base.base.resv = &fbo->base.base._resv;
> + if (bo->base.resv == &bo->base._resv)
> + fbo->base.base.resv = &fbo->base.base._resv;
> +
> dma_resv_init(fbo->base.base.resv);
> ret = dma_resv_trylock(fbo->base.base.resv);
> WARN_ON(!ret);
> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
> if (ret)
> return ret;
>
> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>
> /**
> * If we're not moving to fixed memory, the TTM object
> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
> else
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost_obj);
> + dma_resv_unlock(&ghost_obj->base._resv);
> ttm_bo_put(ghost_obj);
> }
>
> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
> if (ret)
> return ret;
>
> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>
> /**
> * If we're not moving to fixed memory, the TTM object
> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
> else
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost_obj);
> + dma_resv_unlock(&ghost_obj->base._resv);
> ttm_bo_put(ghost_obj);
>
> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
> if (ret)
> return ret;
>
> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
> /* Last resort, wait for the BO to be idle when we are OOM */
> if (ret)
> ttm_bo_wait(bo, false, false);
> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
> bo->mem.mem_type = TTM_PL_SYSTEM;
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost);
> + dma_resv_unlock(&ghost->base._resv);
> ttm_bo_put(ghost);
>
> return 0;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:25 ` Christian König
0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2019-10-24 10:25 UTC (permalink / raw)
To: dri-devel, amd-gfx, Zhou, David(ChunMing), Huang Rui
Ping?
Am 18.10.19 um 13:58 schrieb Christian König:
> This way the TTM is destroyed with the correct dma_resv object
> locked and we can even pipeline imported BO evictions.
>
> v2: Limit this to only cases when the parent object uses a separate
> reservation object as well. This fixes another OOM problem.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index e030c27f53cf..45e440f80b7b 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
> kref_init(&fbo->base.kref);
> fbo->base.destroy = &ttm_transfered_destroy;
> fbo->base.acc_size = 0;
> - fbo->base.base.resv = &fbo->base.base._resv;
> + if (bo->base.resv == &bo->base._resv)
> + fbo->base.base.resv = &fbo->base.base._resv;
> +
> dma_resv_init(fbo->base.base.resv);
> ret = dma_resv_trylock(fbo->base.base.resv);
> WARN_ON(!ret);
> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
> if (ret)
> return ret;
>
> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>
> /**
> * If we're not moving to fixed memory, the TTM object
> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
> else
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost_obj);
> + dma_resv_unlock(&ghost_obj->base._resv);
> ttm_bo_put(ghost_obj);
> }
>
> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
> if (ret)
> return ret;
>
> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>
> /**
> * If we're not moving to fixed memory, the TTM object
> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
> else
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost_obj);
> + dma_resv_unlock(&ghost_obj->base._resv);
> ttm_bo_put(ghost_obj);
>
> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
> if (ret)
> return ret;
>
> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
> /* Last resort, wait for the BO to be idle when we are OOM */
> if (ret)
> ttm_bo_wait(bo, false, false);
> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
> bo->mem.mem_type = TTM_PL_SYSTEM;
> bo->ttm = NULL;
>
> - ttm_bo_unreserve(ghost);
> + dma_resv_unlock(&ghost->base._resv);
> ttm_bo_put(ghost);
>
> return 0;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <01bf3c2a-e178-6083-01a8-bb06aaef10bf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:51 ` Zhou, David(ChunMing)
0 siblings, 0 replies; 9+ messages in thread
From: Zhou, David(ChunMing) @ 2019-10-24 10:51 UTC (permalink / raw)
To: Christian König,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Huang, Ray
On 2019/10/24 下午6:25, Christian König wrote:
> Ping?
>
> Am 18.10.19 um 13:58 schrieb Christian König:
>> This way the TTM is destroyed with the correct dma_resv object
>> locked and we can even pipeline imported BO evictions.
>>
>> v2: Limit this to only cases when the parent object uses a separate
>> reservation object as well. This fixes another OOM problem.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index e030c27f53cf..45e440f80b7b 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>> ttm_buffer_object *bo,
>> kref_init(&fbo->base.kref);
>> fbo->base.destroy = &ttm_transfered_destroy;
>> fbo->base.acc_size = 0;
>> - fbo->base.base.resv = &fbo->base.base._resv;
>> + if (bo->base.resv == &bo->base._resv)
>> + fbo->base.base.resv = &fbo->base.base._resv;
>> +
>> dma_resv_init(fbo->base.base.resv);
Doesn't this lead to issue if you force to init parent resv? Otherwise
how to deal with if parent->resv is locking?
>> ret = dma_resv_trylock(fbo->base.base.resv);
>> WARN_ON(!ret);
>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
fbo->base.base.resv?
-David
>> ttm_bo_put(ghost_obj);
>> }
>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>> *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
>> ttm_bo_put(ghost_obj);
>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> if (ret)
>> return ret;
>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>> /* Last resort, wait for the BO to be idle when we are OOM */
>> if (ret)
>> ttm_bo_wait(bo, false, false);
>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> bo->mem.mem_type = TTM_PL_SYSTEM;
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost);
>> + dma_resv_unlock(&ghost->base._resv);
>> ttm_bo_put(ghost);
>> return 0;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:51 ` Zhou, David(ChunMing)
0 siblings, 0 replies; 9+ messages in thread
From: Zhou, David(ChunMing) @ 2019-10-24 10:51 UTC (permalink / raw)
To: Christian König, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Huang, Ray
On 2019/10/24 下午6:25, Christian König wrote:
> Ping?
>
> Am 18.10.19 um 13:58 schrieb Christian König:
>> This way the TTM is destroyed with the correct dma_resv object
>> locked and we can even pipeline imported BO evictions.
>>
>> v2: Limit this to only cases when the parent object uses a separate
>> reservation object as well. This fixes another OOM problem.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index e030c27f53cf..45e440f80b7b 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>> ttm_buffer_object *bo,
>> kref_init(&fbo->base.kref);
>> fbo->base.destroy = &ttm_transfered_destroy;
>> fbo->base.acc_size = 0;
>> - fbo->base.base.resv = &fbo->base.base._resv;
>> + if (bo->base.resv == &bo->base._resv)
>> + fbo->base.base.resv = &fbo->base.base._resv;
>> +
>> dma_resv_init(fbo->base.base.resv);
Doesn't this lead to issue if you force to init parent resv? Otherwise
how to deal with if parent->resv is locking?
>> ret = dma_resv_trylock(fbo->base.base.resv);
>> WARN_ON(!ret);
>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
fbo->base.base.resv?
-David
>> ttm_bo_put(ghost_obj);
>> }
>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>> *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
>> ttm_bo_put(ghost_obj);
>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> if (ret)
>> return ret;
>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>> /* Last resort, wait for the BO to be idle when we are OOM */
>> if (ret)
>> ttm_bo_wait(bo, false, false);
>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> bo->mem.mem_type = TTM_PL_SYSTEM;
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost);
>> + dma_resv_unlock(&ghost->base._resv);
>> ttm_bo_put(ghost);
>> return 0;
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:51 ` Zhou, David(ChunMing)
0 siblings, 0 replies; 9+ messages in thread
From: Zhou, David(ChunMing) @ 2019-10-24 10:51 UTC (permalink / raw)
To: Christian König, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Huang, Ray
On 2019/10/24 下午6:25, Christian König wrote:
> Ping?
>
> Am 18.10.19 um 13:58 schrieb Christian König:
>> This way the TTM is destroyed with the correct dma_resv object
>> locked and we can even pipeline imported BO evictions.
>>
>> v2: Limit this to only cases when the parent object uses a separate
>> reservation object as well. This fixes another OOM problem.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> index e030c27f53cf..45e440f80b7b 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>> ttm_buffer_object *bo,
>> kref_init(&fbo->base.kref);
>> fbo->base.destroy = &ttm_transfered_destroy;
>> fbo->base.acc_size = 0;
>> - fbo->base.base.resv = &fbo->base.base._resv;
>> + if (bo->base.resv == &bo->base._resv)
>> + fbo->base.base.resv = &fbo->base.base._resv;
>> +
>> dma_resv_init(fbo->base.base.resv);
Doesn't this lead to issue if you force to init parent resv? Otherwise
how to deal with if parent->resv is locking?
>> ret = dma_resv_trylock(fbo->base.base.resv);
>> WARN_ON(!ret);
>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>> ttm_buffer_object *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
fbo->base.base.resv?
-David
>> ttm_bo_put(ghost_obj);
>> }
>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>> ttm_buffer_object *bo,
>> if (ret)
>> return ret;
>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>> /**
>> * If we're not moving to fixed memory, the TTM object
>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>> *bo,
>> else
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost_obj);
>> + dma_resv_unlock(&ghost_obj->base._resv);
>> ttm_bo_put(ghost_obj);
>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> if (ret)
>> return ret;
>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>> /* Last resort, wait for the BO to be idle when we are OOM */
>> if (ret)
>> ttm_bo_wait(bo, false, false);
>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>> ttm_buffer_object *bo)
>> bo->mem.mem_type = TTM_PL_SYSTEM;
>> bo->ttm = NULL;
>> - ttm_bo_unreserve(ghost);
>> + dma_resv_unlock(&ghost->base._resv);
>> ttm_bo_put(ghost);
>> return 0;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <006ab5ab-fa42-b206-1a40-3f0744689443-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:53 ` Christian König
0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2019-10-24 10:53 UTC (permalink / raw)
To: Zhou, David(ChunMing),
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Huang, Ray
Am 24.10.19 um 12:51 schrieb Zhou, David(ChunMing):
> On 2019/10/24 下午6:25, Christian König wrote:
>> Ping?
>>
>> Am 18.10.19 um 13:58 schrieb Christian König:
>>> This way the TTM is destroyed with the correct dma_resv object
>>> locked and we can even pipeline imported BO evictions.
>>>
>>> v2: Limit this to only cases when the parent object uses a separate
>>> reservation object as well. This fixes another OOM problem.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index e030c27f53cf..45e440f80b7b 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>>> ttm_buffer_object *bo,
>>> kref_init(&fbo->base.kref);
>>> fbo->base.destroy = &ttm_transfered_destroy;
>>> fbo->base.acc_size = 0;
>>> - fbo->base.base.resv = &fbo->base.base._resv;
>>> + if (bo->base.resv == &bo->base._resv)
>>> + fbo->base.base.resv = &fbo->base.base._resv;
>>> +
>>> dma_resv_init(fbo->base.base.resv);
> Doesn't this lead to issue if you force to init parent resv? Otherwise
> how to deal with if parent->resv is locking?
Ups, good point. That is indeed a really bad typo added during the
rebase. Going to fix that.
Thanks,
Christian.
>
>
>>> ret = dma_resv_trylock(fbo->base.base.resv);
>>> WARN_ON(!ret);
>>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
> fbo->base.base.resv?
>
> -David
>
>>> ttm_bo_put(ghost_obj);
>>> }
>>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>>> *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
>>> ttm_bo_put(ghost_obj);
>>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> if (ret)
>>> return ret;
>>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>>> /* Last resort, wait for the BO to be idle when we are OOM */
>>> if (ret)
>>> ttm_bo_wait(bo, false, false);
>>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> bo->mem.mem_type = TTM_PL_SYSTEM;
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost);
>>> + dma_resv_unlock(&ghost->base._resv);
>>> ttm_bo_put(ghost);
>>> return 0;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:53 ` Christian König
0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2019-10-24 10:53 UTC (permalink / raw)
To: Zhou, David(ChunMing), dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Huang, Ray
Am 24.10.19 um 12:51 schrieb Zhou, David(ChunMing):
> On 2019/10/24 下午6:25, Christian König wrote:
>> Ping?
>>
>> Am 18.10.19 um 13:58 schrieb Christian König:
>>> This way the TTM is destroyed with the correct dma_resv object
>>> locked and we can even pipeline imported BO evictions.
>>>
>>> v2: Limit this to only cases when the parent object uses a separate
>>> reservation object as well. This fixes another OOM problem.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index e030c27f53cf..45e440f80b7b 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>>> ttm_buffer_object *bo,
>>> kref_init(&fbo->base.kref);
>>> fbo->base.destroy = &ttm_transfered_destroy;
>>> fbo->base.acc_size = 0;
>>> - fbo->base.base.resv = &fbo->base.base._resv;
>>> + if (bo->base.resv == &bo->base._resv)
>>> + fbo->base.base.resv = &fbo->base.base._resv;
>>> +
>>> dma_resv_init(fbo->base.base.resv);
> Doesn't this lead to issue if you force to init parent resv? Otherwise
> how to deal with if parent->resv is locking?
Ups, good point. That is indeed a really bad typo added during the
rebase. Going to fix that.
Thanks,
Christian.
>
>
>>> ret = dma_resv_trylock(fbo->base.base.resv);
>>> WARN_ON(!ret);
>>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
> fbo->base.base.resv?
>
> -David
>
>>> ttm_bo_put(ghost_obj);
>>> }
>>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>>> *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
>>> ttm_bo_put(ghost_obj);
>>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> if (ret)
>>> return ret;
>>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>>> /* Last resort, wait for the BO to be idle when we are OOM */
>>> if (ret)
>>> ttm_bo_wait(bo, false, false);
>>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> bo->mem.mem_type = TTM_PL_SYSTEM;
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost);
>>> + dma_resv_unlock(&ghost->base._resv);
>>> ttm_bo_put(ghost);
>>> return 0;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drm/ttm: use the parent resv for ghost objects v2
@ 2019-10-24 10:53 ` Christian König
0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2019-10-24 10:53 UTC (permalink / raw)
To: Zhou, David(ChunMing), dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Huang, Ray
Am 24.10.19 um 12:51 schrieb Zhou, David(ChunMing):
> On 2019/10/24 下午6:25, Christian König wrote:
>> Ping?
>>
>> Am 18.10.19 um 13:58 schrieb Christian König:
>>> This way the TTM is destroyed with the correct dma_resv object
>>> locked and we can even pipeline imported BO evictions.
>>>
>>> v2: Limit this to only cases when the parent object uses a separate
>>> reservation object as well. This fixes another OOM problem.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>> drivers/gpu/drm/ttm/ttm_bo_util.c | 16 +++++++++-------
>>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> index e030c27f53cf..45e440f80b7b 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
>>> @@ -512,7 +512,9 @@ static int ttm_buffer_object_transfer(struct
>>> ttm_buffer_object *bo,
>>> kref_init(&fbo->base.kref);
>>> fbo->base.destroy = &ttm_transfered_destroy;
>>> fbo->base.acc_size = 0;
>>> - fbo->base.base.resv = &fbo->base.base._resv;
>>> + if (bo->base.resv == &bo->base._resv)
>>> + fbo->base.base.resv = &fbo->base.base._resv;
>>> +
>>> dma_resv_init(fbo->base.base.resv);
> Doesn't this lead to issue if you force to init parent resv? Otherwise
> how to deal with if parent->resv is locking?
Ups, good point. That is indeed a really bad typo added during the
rebase. Going to fix that.
Thanks,
Christian.
>
>
>>> ret = dma_resv_trylock(fbo->base.base.resv);
>>> WARN_ON(!ret);
>>> @@ -711,7 +713,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -724,7 +726,7 @@ int ttm_bo_move_accel_cleanup(struct
>>> ttm_buffer_object *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
> fbo->base.base.resv?
>
> -David
>
>>> ttm_bo_put(ghost_obj);
>>> }
>>> @@ -767,7 +769,7 @@ int ttm_bo_pipeline_move(struct
>>> ttm_buffer_object *bo,
>>> if (ret)
>>> return ret;
>>> - dma_resv_add_excl_fence(ghost_obj->base.resv, fence);
>>> + dma_resv_add_excl_fence(&ghost_obj->base._resv, fence);
>>> /**
>>> * If we're not moving to fixed memory, the TTM object
>>> @@ -780,7 +782,7 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object
>>> *bo,
>>> else
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost_obj);
>>> + dma_resv_unlock(&ghost_obj->base._resv);
>>> ttm_bo_put(ghost_obj);
>>> } else if (from->flags & TTM_MEMTYPE_FLAG_FIXED) {
>>> @@ -836,7 +838,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> if (ret)
>>> return ret;
>>> - ret = dma_resv_copy_fences(ghost->base.resv, bo->base.resv);
>>> + ret = dma_resv_copy_fences(&ghost->base._resv, bo->base.resv);
>>> /* Last resort, wait for the BO to be idle when we are OOM */
>>> if (ret)
>>> ttm_bo_wait(bo, false, false);
>>> @@ -845,7 +847,7 @@ int ttm_bo_pipeline_gutting(struct
>>> ttm_buffer_object *bo)
>>> bo->mem.mem_type = TTM_PL_SYSTEM;
>>> bo->ttm = NULL;
>>> - ttm_bo_unreserve(ghost);
>>> + dma_resv_unlock(&ghost->base._resv);
>>> ttm_bo_put(ghost);
>>> return 0;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-10-24 10:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-18 11:58 [PATCH] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-10-24 10:25 ` Christian König
2019-10-24 10:25 ` Christian König
[not found] ` <01bf3c2a-e178-6083-01a8-bb06aaef10bf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-24 10:51 ` Zhou, David(ChunMing)
2019-10-24 10:51 ` Zhou, David(ChunMing)
2019-10-24 10:51 ` Zhou, David(ChunMing)
[not found] ` <006ab5ab-fa42-b206-1a40-3f0744689443-5C7GfCeVMHo@public.gmane.org>
2019-10-24 10:53 ` Christian König
2019-10-24 10:53 ` Christian König
2019-10-24 10:53 ` Christian König
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.