All of lore.kernel.org
 help / color / mirror / Atom feed
* Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed?
@ 2019-04-07 11:44 易林
  2019-04-08  7:34 ` Koenig, Christian
  0 siblings, 1 reply; 4+ messages in thread
From: 易林 @ 2019-04-07 11:44 UTC (permalink / raw)
  To: dri-devel
  Cc: csong, jian liu, zhiyunq, ray.huang, yiqiuping, jerry.zhang,
	christian.koenig

Hi, all:
    when analyzing v5.1 source code, I notice that in ttm_bo_add_move_fence,
when reservation_object_reserve_shared failed and return ENOMEM, 
the fence's refcount increased without a pair decrement even after return to ttm_bo_add_move_fence's caller ttm_bo_mem_force_space:

static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
				 struct ttm_mem_type_manager *man,
				 struct ttm_mem_reg *mem)
{
        ......
	fence = dma_fence_get(man->move);
	spin_unlock(&man->move_lock);

	if (fence) {
		reservation_object_add_shared_fence(bo->resv, fence);

		ret = reservation_object_reserve_shared(bo->resv, 1);
		if (unlikely(ret))
			return ret;

		dma_fence_put(bo->moving);
		bo->moving = fence;
	}

	return 0;
}

can this lead to the imbalance of the fence's refcount? though the ENOMEN almost won't be trigger.

Best Regards

Lin Yi
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed?
  2019-04-07 11:44 Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed? 易林
@ 2019-04-08  7:34 ` Koenig, Christian
  2019-04-09  8:21   ` 易林
  0 siblings, 1 reply; 4+ messages in thread
From: Koenig, Christian @ 2019-04-08  7:34 UTC (permalink / raw)
  To: 易林, dri-devel
  Cc: csong, jian liu, zhiyunq, Huang, Ray, yiqiuping, Zhang, Jerry

Am 07.04.19 um 13:44 schrieb 易林:
> Hi, all:
>      when analyzing v5.1 source code, I notice that in ttm_bo_add_move_fence,
> when reservation_object_reserve_shared failed and return ENOMEM,
> the fence's refcount increased without a pair decrement even after return to ttm_bo_add_move_fence's caller ttm_bo_mem_force_space:
>
> static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
> 				 struct ttm_mem_type_manager *man,
> 				 struct ttm_mem_reg *mem)
> {
>          ......
> 	fence = dma_fence_get(man->move);
> 	spin_unlock(&man->move_lock);
>
> 	if (fence) {
> 		reservation_object_add_shared_fence(bo->resv, fence);
>
> 		ret = reservation_object_reserve_shared(bo->resv, 1);
> 		if (unlikely(ret))
> 			return ret;
>
> 		dma_fence_put(bo->moving);
> 		bo->moving = fence;
> 	}
>
> 	return 0;
> }
>
> can this lead to the imbalance of the fence's refcount? though the ENOMEN almost won't be trigger.

Yeah, the fence is leaked in the error path. Feel free to provide a 
patch to fix this.

Otherwise I will provide one in the next merge window.

Thanks,
Christian.

>
> Best Regards
>
> Lin Yi

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: Re: Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed?
  2019-04-08  7:34 ` Koenig, Christian
@ 2019-04-09  8:21   ` 易林
  2019-04-09 11:53     ` Koenig, Christian
  0 siblings, 1 reply; 4+ messages in thread
From: 易林 @ 2019-04-09  8:21 UTC (permalink / raw)
  To: koenig, christian; +Cc: csong, zhiyunq, jian liu, yiqiuping, dri-devel





> Am 07.04.19 um 13:44 schrieb 易林:
> > Hi, all:
> >      when analyzing v5.1 source code, I notice that in ttm_bo_add_move_fence,
> > when reservation_object_reserve_shared failed and return ENOMEM,
> > the fence's refcount increased without a pair decrement even after return to ttm_bo_add_move_fence's caller ttm_bo_mem_force_space:
> >
> > static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
> > 				 struct ttm_mem_type_manager *man,
> > 				 struct ttm_mem_reg *mem)
> > {
> >          ......
> > 	fence = dma_fence_get(man->move);
> > 	spin_unlock(&man->move_lock);
> >
> > 	if (fence) {
> > 		reservation_object_add_shared_fence(bo->resv, fence);
> >
> > 		ret = reservation_object_reserve_shared(bo->resv, 1);
> > 		if (unlikely(ret))
> > 			return ret;
> >
> > 		dma_fence_put(bo->moving);
> > 		bo->moving = fence;
> > 	}
> >
> > 	return 0;
> > }
> >
> > can this lead to the imbalance of the fence's refcount? though the ENOMEN almost won't be trigger.
> 
> Yeah, the fence is leaked in the error path. Feel free to provide a 
> patch to fix this.
> 
> Otherwise I will provide one in the next merge window.
> 
> Thanks,
> Christian.
> 
> >
> > Best Regards
> >
> > Lin Yi
> 

when I git clone your maintained subsystem from 'git://people.freedesktop.org/~agd5f/linux' provided on Maintainer list, why all the commits is below 2011?

so where can I get the newest subsystem version?

Thanks,
Lin Yi.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed?
  2019-04-09  8:21   ` 易林
@ 2019-04-09 11:53     ` Koenig, Christian
  0 siblings, 0 replies; 4+ messages in thread
From: Koenig, Christian @ 2019-04-09 11:53 UTC (permalink / raw)
  To: 易林; +Cc: csong, zhiyunq, jian liu, yiqiuping, dri-devel

Am 09.04.19 um 10:21 schrieb 易林:
>
>
>
>> Am 07.04.19 um 13:44 schrieb 易林:
>>> Hi, all:
>>>       when analyzing v5.1 source code, I notice that in ttm_bo_add_move_fence,
>>> when reservation_object_reserve_shared failed and return ENOMEM,
>>> the fence's refcount increased without a pair decrement even after return to ttm_bo_add_move_fence's caller ttm_bo_mem_force_space:
>>>
>>> static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
>>> 				 struct ttm_mem_type_manager *man,
>>> 				 struct ttm_mem_reg *mem)
>>> {
>>>           ......
>>> 	fence = dma_fence_get(man->move);
>>> 	spin_unlock(&man->move_lock);
>>>
>>> 	if (fence) {
>>> 		reservation_object_add_shared_fence(bo->resv, fence);
>>>
>>> 		ret = reservation_object_reserve_shared(bo->resv, 1);
>>> 		if (unlikely(ret))
>>> 			return ret;
>>>
>>> 		dma_fence_put(bo->moving);
>>> 		bo->moving = fence;
>>> 	}
>>>
>>> 	return 0;
>>> }
>>>
>>> can this lead to the imbalance of the fence's refcount? though the ENOMEN almost won't be trigger.
>> Yeah, the fence is leaked in the error path. Feel free to provide a
>> patch to fix this.
>>
>> Otherwise I will provide one in the next merge window.
>>
>> Thanks,
>> Christian.
>>
>>> Best Regards
>>>
>>> Lin Yi
> when I git clone your maintained subsystem from 'git://people.freedesktop.org/~agd5f/linux' provided on Maintainer list, why all the commits is below 2011?
>
> so where can I get the newest subsystem version?

That URL looks correct to me. Our development branch is 
amd-staging-drm-next. No idea why you only see old commits.

See here for example: 
https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next

Alex updates that one from an internal server every few days.

Regards,
Christian.

>
> Thanks,
> Lin Yi.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-04-09 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-07 11:44 Need a pair decrement for fence's refcount if ttm_bo_add_move_fence failed? 易林
2019-04-08  7:34 ` Koenig, Christian
2019-04-09  8:21   ` 易林
2019-04-09 11:53     ` Koenig, Christian

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.