Re: [PATCH mm-unstable v1 14/20] drm/etnaviv: remove FOLL_FORCE usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: David Hildenbrand <david@xxxxxxxxxx>
- Subject: Re: [PATCH mm-unstable v1 14/20] drm/etnaviv: remove FOLL_FORCE usage
- From: Daniel Vetter <daniel@xxxxxxxx>
- Date: Wed, 16 Nov 2022 11:49:43 +0100
- Cc: linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, etnaviv@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, linux-kselftest@xxxxxxxxxxxxxxx, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Andrea Arcangeli <aarcange@xxxxxxxxxx>, Hugh Dickins <hughd@xxxxxxxxxx>, Nadav Amit <namit@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Muchun Song <songmuchun@xxxxxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>, Lucas Stach <l.stach@xxxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>, Oded Gabbay <ogabbay@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Daniel Vetter <daniel.vetter@xxxxxxxx>, Russell King <linux+etnaviv@xxxxxxxxxxxxxxx>, Christian Gmeiner <christian.gmeiner@xxxxxxxxx>
- In-reply-to: <20221116102659.70287-15-david@redhat.com>
- Mail-followup-to: David Hildenbrand <david@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, etnaviv@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, linux-security-module@xxxxxxxxxxxxxxx, linux-kselftest@xxxxxxxxxxxxxxx, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>, John Hubbard <jhubbard@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Andrea Arcangeli <aarcange@xxxxxxxxxx>, Hugh Dickins <hughd@xxxxxxxxxx>, Nadav Amit <namit@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Muchun Song <songmuchun@xxxxxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>, Lucas Stach <l.stach@xxxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>, Oded Gabbay <ogabbay@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Russell King <linux+etnaviv@xxxxxxxxxxxxxxx>, Christian Gmeiner <christian.gmeiner@xxxxxxxxx>
- References: <20221116102659.70287-1-david@redhat.com> <20221116102659.70287-15-david@redhat.com>
On Wed, Nov 16, 2022 at 11:26:53AM +0100, David Hildenbrand wrote:
> GUP now supports reliable R/O long-term pinning in COW mappings, such
> that we break COW early. MAP_SHARED VMAs only use the shared zeropage so
> far in one corner case (DAXFS file with holes), which can be ignored
> because GUP does not support long-term pinning in fsdax (see
> check_vma_flags()).
>
> commit cd5297b0855f ("drm/etnaviv: Use FOLL_FORCE for userptr")
> documents that FOLL_FORCE | FOLL_WRITE was really only used for reliable
> R/O pinning.
>
> Consequently, FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM is no longer required
> for reliable R/O long-term pinning: FOLL_LONGTERM is sufficient. So stop
> using FOLL_FORCE, which is really only for ptrace access.
>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> Cc: Russell King <linux+etnaviv@xxxxxxxxxxxxxxx>
> Cc: Christian Gmeiner <christian.gmeiner@xxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxxx>
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
Also ack for merging through whatever tree suits best, since I guess this
should all land together.
-Daniel
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index cc386f8a7116..efe2240945d0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -638,6 +638,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
> struct page **pvec = NULL;
> struct etnaviv_gem_userptr *userptr = &etnaviv_obj->userptr;
> int ret, pinned = 0, npages = etnaviv_obj->base.size >> PAGE_SHIFT;
> + unsigned int gup_flags = FOLL_LONGTERM;
>
> might_lock_read(¤t->mm->mmap_lock);
>
> @@ -648,14 +649,15 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
> if (!pvec)
> return -ENOMEM;
>
> + if (!userptr->ro)
> + gup_flags |= FOLL_WRITE;
> +
> do {
> unsigned num_pages = npages - pinned;
> uint64_t ptr = userptr->ptr + pinned * PAGE_SIZE;
> struct page **pages = pvec + pinned;
>
> - ret = pin_user_pages_fast(ptr, num_pages,
> - FOLL_WRITE | FOLL_FORCE | FOLL_LONGTERM,
> - pages);
> + ret = pin_user_pages_fast(ptr, num_pages, gup_flags, pages);
> if (ret < 0) {
> unpin_user_pages(pvec, pinned);
> kvfree(pvec);
> --
> 2.38.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]