[PATCH] drm/kfd: fix ttm_bo_release warning

Christian König christian.koenig at amd.com
Fri Sep 24 05:54:09 UTC 2021


Am 24.09.21 um 07:50 schrieb Yu, Lang:
> [AMD Official Use Only]
>> [SNIP]
>>>>> Hi Christian,
>>>>>
>>>>> Thanks for your explanation and advice. I got your point.
>>>>> Actually, these BOs are allocated and pinned during a kfd process lifecycle.
>>>>> I will try to add a flag into struct kgd_mem to indicate which BO is
>>>>> pined and should be unpinned. Which will make
>>>>> amdgpu_bo_pin/amdgpu_bo_unpin calls balanced. Thanks!
>>>> That isn't to much better. The real solution would be to unpin them
>>>> when the kfd process is destroyed.
>>> Yes, will unpin them when the kfd process is destroyed.
>>> But we should indicate which BO is pinned and should be unpinned. Right?
>> Well not with a flag or something like that.
>>
>> The knowledge which BO is pinned and needs to be unpinned should come from
>> the control logic and not be papered over by some general handling.
>> That's the background why we have removed the general handling for this from
>> TTM in the first place.
>>
>> In other words when you need to pin a BO because it is kmapped it should be
>> unpinned when it is kunmapped and if you don't kunmap at all then there is
>> something wrong with the code structure from a higher level point of view.
> Yes, this function "amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel" did a kmap,
> but without a kunmap when the kfd process is destroyed. The flag actually indicates kmap/kunmap.

Well that's the wrong approach then. I mean you need to have the BO 
reference and the mapped pointer somewhere, don't you?

How do you clean those up?

Regards,
Christian.


More information about the amd-gfx mailing list