[Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag

Thomas Hellström (Intel) thomas_os at shipmail.org
Wed Jun 14 15:30:25 UTC 2023


On 6/14/23 15:22, Tvrtko Ursulin wrote:
>
> On 14/06/2023 13:35, Sumitra Sharma wrote:
>> Pages allocated with GFP_KERNEL cannot come from Highmem.
>> That is why there is no need to call kmap() on them.
>
> Are you sure it is GFP_KERNEL backed and not tmpfs? I am not sure 
> myself so let me copy Matt and Thomas if they happen to know off hand.

It looks to me these are shmem pages or TTM pages. Both could be 
highmem. So I think kmap is the correct choice here.

/Thomas




>
> Regards,
>
> Tvrtko
>
>> Therefore, don't call kmap() on the page coming from
>> vma_res->bi.pages using for_each_sgt_page() in
>> i915_vma_coredump_create().
>>
>> Use a plain page_address() to get the kernel address instead.
>>
>> Signed-off-by: Sumitra Sharma <sumitraartsy at gmail.com>
>> ---
>>   drivers/gpu/drm/i915/i915_gpu_error.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
>> b/drivers/gpu/drm/i915/i915_gpu_error.c
>> index f020c0086fbc..6f51cb4fc55c 100644
>> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
>> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
>> @@ -1164,9 +1164,8 @@ i915_vma_coredump_create(const struct intel_gt 
>> *gt,
>>                 drm_clflush_pages(&page, 1);
>>   -            s = kmap(page);
>> +            s = page_address(page);
>>               ret = compress_page(compress, s, dst, false);
>> -            kunmap(page);
>>                 drm_clflush_pages(&page, 1);


More information about the dri-devel mailing list