All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sumitra Sharma <sumitraartsy@gmail.com>
To: "Thomas Hellström (Intel)" <thomas_os@shipmail.org>
Cc: Sumitra Sharma <sumitraartsy@gmail.com>,
	Ira Weiny <ira.weiny@intel.com>, Deepak R Varma <drv@mailo.com>,
	Fabio <fmdefrancesco@gmail.com>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Thomas Hellstrom <thomas.hellstrom@intel.com>,
	dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@gmail.com>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
Date: Sat, 17 Jun 2023 11:26:09 -0700	[thread overview]
Message-ID: <20230617182609.GA410998@sumitra.com> (raw)
In-Reply-To: <69d7af2f-f4c2-5a7d-ce69-c38be5660c74@shipmail.org>


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);

WARNING: multiple messages have this Message-ID (diff)
From: Sumitra Sharma <sumitraartsy@gmail.com>
To: "Thomas Hellström (Intel)" <thomas_os@shipmail.org>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Sumitra Sharma <sumitraartsy@gmail.com>,
	Ira Weiny <ira.weiny@intel.com>, Deepak R Varma <drv@mailo.com>,
	Fabio <fmdefrancesco@gmail.com>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Thomas Hellstrom <thomas.hellstrom@intel.com>,
	dri-devel@lists.freedesktop.org,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
Date: Sat, 17 Jun 2023 11:26:09 -0700	[thread overview]
Message-ID: <20230617182609.GA410998@sumitra.com> (raw)
In-Reply-To: <69d7af2f-f4c2-5a7d-ce69-c38be5660c74@shipmail.org>


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);

WARNING: multiple messages have this Message-ID (diff)
From: Sumitra Sharma <sumitraartsy@gmail.com>
To: "Thomas Hellström (Intel)" <thomas_os@shipmail.org>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Deepak R Varma <drv@mailo.com>,
	Fabio <fmdefrancesco@gmail.com>,
	Thomas Hellstrom <thomas.hellstrom@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Matthew Auld <matthew.auld@intel.com>,
	Sumitra Sharma <sumitraartsy@gmail.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag
Date: Sat, 17 Jun 2023 11:26:09 -0700	[thread overview]
Message-ID: <20230617182609.GA410998@sumitra.com> (raw)
In-Reply-To: <69d7af2f-f4c2-5a7d-ce69-c38be5660c74@shipmail.org>


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);

  reply	other threads:[~2023-06-20 18:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 12:35 [Intel-gfx] [PATCH] drm/i915: Call page_address() on page acquired with GFP_KERNEL flag Sumitra Sharma
2023-06-14 12:35 ` Sumitra Sharma
2023-06-14 12:35 ` Sumitra Sharma
2023-06-14 13:22 ` [Intel-gfx] " Tvrtko Ursulin
2023-06-14 13:22   ` Tvrtko Ursulin
2023-06-14 13:22   ` Tvrtko Ursulin
2023-06-14 15:30   ` [Intel-gfx] " Thomas Hellström (Intel)
2023-06-14 15:30     ` Thomas Hellström (Intel)
2023-06-17 18:26     ` Sumitra Sharma [this message]
2023-06-17 18:26       ` Sumitra Sharma
2023-06-17 18:26       ` Sumitra Sharma
2023-06-21  2:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-06-21 12:45 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230617182609.GA410998@sumitra.com \
    --to=sumitraartsy@gmail.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=drv@mailo.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@intel.com \
    --cc=thomas_os@shipmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.