From: John Hubbard <jhubbard@nvidia.com>
To: Souptick Joarder <jrdr.linux@gmail.com>,
<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
<David1.Zhou@amd.com>, <daniel@ffwll.ch>
Cc: <amd-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/radeon: Convert get_user_pages() --> pin_user_pages()
Date: Tue, 26 May 2020 15:57:45 -0700 [thread overview]
Message-ID: <69a033cf-63b2-7da6-6a5e-a5bbc94b8afb@nvidia.com> (raw)
In-Reply-To: <1590526802-3008-1-git-send-email-jrdr.linux@gmail.com>
On 2020-05-26 14:00, Souptick Joarder wrote:
> This code was using get_user_pages(), in a "Case 2" scenario
> (DMA/RDMA), using the categorization from [1]. That means that it's
> time to convert the get_user_pages() + release_pages() calls to
> pin_user_pages() + unpin_user_pages() calls.
>
> There is some helpful background in [2]: basically, this is a small
> part of fixing a long-standing disconnect between pinning pages, and
> file systems' use of those pages.
>
> [1] Documentation/core-api/pin_user_pages.rst
>
> [2] "Explicit pinning of user-space pages":
> https://lwn.net/Articles/807108/
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
>
> Hi,
>
> I'm compile tested this, but unable to run-time test, so any testing
> help is much appriciated.
> ---
> drivers/gpu/drm/radeon/radeon_ttm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
> index 5d50c9e..e927de2 100644
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c
> @@ -506,7 +506,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)
> uint64_t userptr = gtt->userptr + pinned * PAGE_SIZE;
> struct page **pages = ttm->pages + pinned;
>
> - r = get_user_pages(userptr, num_pages, write ? FOLL_WRITE : 0,
> + r = pin_user_pages(userptr, num_pages, write ? FOLL_WRITE : 0,
> pages, NULL);
> if (r < 0)
> goto release_pages;
> @@ -535,7 +535,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)
> kfree(ttm->sg);
>
> release_pages:
> - release_pages(ttm->pages, pinned);
> + unpin_user_pages(ttm->pages, pinned);
> return r;
> }
>
> @@ -562,7 +562,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
> set_page_dirty(page);
Maybe we also need a preceding patch, to fix the above? It should be
set_page_dirty_lock(), rather than set_page_dirty(), unless I'm overlooking
something (which is very possible!).
Either way, from a tunnel vision perspective of changing gup to pup, this
looks good to me, so
Acked-by: John Hubbard <jhubbard@nvidia.com>
thanks,
--
John Hubbard
NVIDIA
>
> mark_page_accessed(page);
> - put_page(page);
> + unpin_user_page(page);
> }
>
> sg_free_table(ttm->sg);
>
next prev parent reply other threads:[~2020-05-26 22:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 21:00 Souptick Joarder
2020-05-26 22:57 ` John Hubbard [this message]
2020-05-27 8:48 ` Daniel Vetter
2020-05-27 8:51 ` Daniel Vetter
2020-05-27 19:07 ` John Hubbard
2020-05-29 6:49 ` Souptick Joarder
2020-05-29 7:28 ` John Hubbard
2020-06-08 19:38 ` Souptick Joarder
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=69a033cf-63b2-7da6-6a5e-a5bbc94b8afb@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=David1.Zhou@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jrdr.linux@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome