* [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
@ 2023-06-14 12:35 Sumitra Sharma
2023-06-14 13:22 ` Tvrtko Ursulin
0 siblings, 1 reply; 4+ messages in thread
From: Sumitra Sharma @ 2023-06-14 12:35 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
David Airlie, Daniel Vetter, intel-gfx, dri-devel, linux-kernel
Cc: Deepak R Varma, Fabio, Ira Weiny, Sumitra Sharma
Pages allocated with GFP_KERNEL cannot come from Highmem.
That is why there is no need to call kmap() on them.
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@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);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
2023-06-14 12:35 [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag Sumitra Sharma
@ 2023-06-14 13:22 ` Tvrtko Ursulin
2023-06-14 15:30 ` [Intel-gfx] " Thomas Hellström (Intel)
0 siblings, 1 reply; 4+ messages in thread
From: Tvrtko Ursulin @ 2023-06-14 13:22 UTC (permalink / raw)
To: Sumitra Sharma, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, intel-gfx, dri-devel, linux-kernel
Cc: Deepak R Varma, Fabio, Thomas Hellstrom, Ira Weiny, Matthew Auld
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.
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@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);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
2023-06-14 13:22 ` Tvrtko Ursulin
@ 2023-06-14 15:30 ` Thomas Hellström (Intel)
2023-06-17 18:26 ` Sumitra Sharma
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Hellström (Intel) @ 2023-06-14 15:30 UTC (permalink / raw)
To: Tvrtko Ursulin, Sumitra Sharma, Jani Nikula, Joonas Lahtinen,
Rodrigo Vivi, David Airlie, Daniel Vetter, intel-gfx, dri-devel,
linux-kernel
Cc: Deepak R Varma, Ira Weiny, Thomas Hellstrom, Fabio, Matthew Auld
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@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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
2023-06-14 15:30 ` [Intel-gfx] " Thomas Hellström (Intel)
@ 2023-06-17 18:26 ` Sumitra Sharma
0 siblings, 0 replies; 4+ messages in thread
From: Sumitra Sharma @ 2023-06-17 18:26 UTC (permalink / raw)
To: Thomas Hellström (Intel)
Cc: Tvrtko Ursulin, Sumitra Sharma, Ira Weiny, Deepak R Varma, Fabio,
intel-gfx, linux-kernel, Thomas Hellstrom, dri-devel,
Rodrigo Vivi, Matthew Auld
On Wed, Jun 14, 2023 at 05:30:25PM +0200, Thomas Hellström (Intel) wrote:
>
> 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.
>
Hello,
Yes it is true that the pages have not been acquired using the GFP_KERNEL.
I confused the allocation of the struct 'i915_vma_resource' tracking the
pages with the allocation of the pages themselves.
This was noted by my mentor Ira Weiny <ira.weiny@intel.com>.
> It looks to me these are shmem pages or TTM pages. Both could be highmem. So
> I think kmap is the correct choice here.
>
However, the kmap() will not be the correct choice here and kmap_local_page()
must be used instead. I have created a v2 patch for the same
https://lore.kernel.org/lkml/20230617180420.GA410966@sumitra.com/
Thank you for helping me.
Regards
Sumitra
> /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@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);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-18 8:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 12:35 [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag Sumitra Sharma
2023-06-14 13:22 ` Tvrtko Ursulin
2023-06-14 15:30 ` [Intel-gfx] " Thomas Hellström (Intel)
2023-06-17 18:26 ` Sumitra Sharma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).