From: John Hubbard Subject: Re: [PATCH v2 09/18] drm/via: set FOLL_PIN via pin_user_pages_fast() Date: Mon, 4 Nov 2019 10:22:23 -0800 Message-ID: <880dbf76-ba9d-2555-27e4-a656c7cd3296@nvidia.com> References: <20191103211813.213227-1-jhubbard@nvidia.com> <20191103211813.213227-10-jhubbard@nvidia.com> <20191104174445.GF5134@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20191104174445.GF5134@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Jerome Glisse Cc: Andrew Morton , Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , Magnus Karlsson , Mauro Carvalho Chehab , Michael Ellerman , Michal Hocko List-Id: dri-devel@lists.freedesktop.org On 11/4/19 9:44 AM, Jerome Glisse wrote: > On Sun, Nov 03, 2019 at 01:18:04PM -0800, John Hubbard wrote: >> Convert drm/via to use the new pin_user_pages_fast() call, which sets >> FOLL_PIN. Setting FOLL_PIN is now required for code that requires >> tracking of pinned pages, and therefore for any code that calls >> put_user_page(). >> >> Reviewed-by: Ira Weiny >> Signed-off-by: John Hubbard >=20 > Please be more explicit that via_dmablit.c is already using put_user_page= () > as i am expecting that any conversion to pin_user_pages*() must be pair w= ith > a put_user_page(). I find above commit message bit unclear from that POV. >=20 OK. This one, and the fs/io_uring (patch 9) and net/xdp (patch 10) were all cases that had put_user_page() pre-existing. I will add something like the= =20 following to each commit description, for v3: In partial anticipation of this work, the drm/via driver was already=20 calling put_user_page() instead of put_page(). Therefore, in order to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required is to change get_user_pages() to pin_user_pages(). thanks, John Hubbard NVIDIA > Reviewed-by: J=E9r=F4me Glisse >=20 >=20 >> --- >> drivers/gpu/drm/via/via_dmablit.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via= _dmablit.c >> index 3db000aacd26..37c5e572993a 100644 >> --- a/drivers/gpu/drm/via/via_dmablit.c >> +++ b/drivers/gpu/drm/via/via_dmablit.c >> @@ -239,7 +239,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_= via_dmablit_t *xfer) >> vsg->pages =3D vzalloc(array_size(sizeof(struct page *), vsg->num_page= s)); >> if (NULL =3D=3D vsg->pages) >> return -ENOMEM; >> - ret =3D get_user_pages_fast((unsigned long)xfer->mem_addr, >> + ret =3D pin_user_pages_fast((unsigned long)xfer->mem_addr, >> vsg->num_pages, >> vsg->direction =3D=3D DMA_FROM_DEVICE ? FOLL_WRITE : 0, >> vsg->pages); >> --=20 >> 2.23.0 >> >=20 >=20