mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 09:28:44 -04:00
drm/etnaviv: remove FOLL_FORCE usage
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 cd5297b085 ("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.
Link: https://lkml.kernel.org/r/20221116102659.70287-15-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: David Airlie <airlied@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
3298de2c66
commit
7d96eb6a91
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user