[PATCH] drm/amdgpu: use new HMM APIs and helpers

Yang, Philip Philip.Yang at amd.com
Fri May 31 17:28:29 UTC 2019



On 2019-05-30 6:36 p.m., Kuehling, Felix wrote:
>>    
>>    #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
>> -	if (gtt->ranges &&
>> -	    ttm->pages[0] == hmm_pfn_to_page(&gtt->ranges[0],
>> -					     gtt->ranges[0].pfns[0]))
>> +	if (gtt->range &&
>> +	    ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
>> +						      gtt->range->pfns[0]))
> I think just checking gtt->range here is enough. If gtt->range is not
> NULL here, we're leaking memory.
> 
If just checking gtt->range, there is a false warning in amdgpu_test 
userptr case in amdgpu_cs_list_validate path. If userptr is invalidated, 
then ttm->pages[0] is outdated pages, lobj->user_pages is new pages, it 
goes to ttm_tt_unbind first to unpin old pages (this causes false 
warning) then call amdgpu_ttm_tt_set_user_pages.

I will submit patch v2, to add retry if hmm_range_fault returns -EAGAIN. 
use kzalloc to allocate small size range.

Thanks,
Philip

> Regards,
>     Felix
> 
> 


More information about the amd-gfx mailing list