[PATCH 06/25] drm/amdgpu: Add KFD eviction fence

Christian König ckoenig.leichtzumerken at gmail.com
Wed Jan 31 08:09:31 UTC 2018


Am 31.01.2018 um 00:21 schrieb Felix Kuehling:
> On 2018-01-30 10:35 AM, Christian König wrote:
>> Am 30.01.2018 um 16:28 schrieb Kasiviswanathan, Harish:
>>>>> [+Harish, forgot to acknowledge him in the commit description, will
>>>>> fix
>>>>> that in v2]
>>>>>
>>>>> Harish, please see Christian's question below in amd_kfd_fence_signal.
>>>>> Did I understand this correctly?
>>> [HK]: Yes the lifetime of eviction fences is tied to the lifetime of
>>> the process associated with it. When the process terminates the fence
>>> is signaled and released. For all the BOs that belong to this process
>>> the eviction should be detached from it when the BO is released.
>>> However, this eviction fence could be still attached to shared BOs.
>>> So signaling it frees those BOs.
>>>
>>>
>>> On 2018-01-29 08:43 AM, Christian König wrote:
>>>> Hi Felix & Harish,
>>>>
>>>> maybe explain why I found that odd: dma_fence_add_callback() sets the
>>>> DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT flag before adding the callback.
>>>>
>>>> So the flag should always be set when there are callbacks.
>>>> Did I miss anything?
>>> I don't think we add any callbacks to our eviction fences.
>>>
>>> [HK] Setting DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT is not required. It was
>>> my oversight. Since, dma_fence_signal() function called cb_list
>>> functions only if DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT is set, I thought
>>> it was safe to set it. However, the cb_list would be empty if no
>>> callbacks are added. So setting DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT is
>>> redundant.
>> Ok in this case let's just remove that and also use the
>> dma_fence_signal() function (not the _locked variant) for signaling
>> the DMA fence.
> Sure. Though it makes me wonder why we need to signal the fence at all.
> This is when the reference count of the fence is 0. Doesn't that imply
> that no one is left waiting for the fence?

Good point as well, yeah when the fences reference count becomes zero 
there is no point in signaling it.

So the whole function can be removed.

Regards,
Christian.

>
> Regards,
>    Felix
>



More information about the amd-gfx mailing list