put_user_pages(): miscellaneous call sites
Subsystems (42)
cover put_user_pages(): miscellaneous call sites
From: John Hubbard <[email protected]>
Hi,
These are best characterized as miscellaneous conversions: many (not all) call sites that don't involve biovec or iov_iter, nor mm/. It also leaves out a few call sites that require some more work. These are mostly pretty simple ones.
It's probably best to send all of these via Andrew's -mm tree, assuming that there are no significant merge conflicts with ongoing work in other trees (which I doubt, given that these are small changes).
These patches apply to the latest linux.git. Patch #1 is also already in Andrew's tree, but given the broad non-linux-mm Cc list, I thought it would be more convenient to just include that patch here, so that people can use linux.git as the base--even though these are probably destined for linux-mm.
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). That commit has an extensive description of the problem and the planned steps to solve it, but the highlites are:
1) Provide put_user_page*() routines, intended to be used for releasing pages that were pinned via get_user_pages*().
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of put_page(). This involves dozens of call sites, and will take some time.
3) After (2) is complete, use get_user_pages*() and put_user_page*() to implement tracking of these pages. This tracking will be separate from the existing struct page refcounting.
4) Use the tracking and identification of these pages, to implement special handling (especially in writeback paths) when the pages are backed by a filesystem.
And a few references, also from that commit:
[1] https://lwn.net/Articles/774411/ : "DMA and get_user_pages()"
[2] https://lwn.net/Articles/753027/ : "The Trouble with get_user_pages()"
Ira Weiny (1):
fs/binfmt_elf: convert put_page() to put_user_page*()
John Hubbard (33):
mm/gup: add make_dirty arg to put_user_pages_dirty_lock() net/rds: convert put_page() to put_user_page*() net/ceph: convert put_page() to put_user_page*() x86/kvm: convert put_page() to put_user_page*() drm/etnaviv: convert release_pages() to put_user_pages() drm/i915: convert put_page() to put_user_page*() drm/radeon: convert put_page() to put_user_page*() media/ivtv: convert put_page() to put_user_page*() media/v4l2-core/mm: convert put_page() to put_user_page*()
genwqe: convert put_page() to put_user_page*()
scif: convert put_page() to put_user_page*()
vmci: convert put_page() to put_user_page*()
rapidio: convert put_page() to put_user_page*()
oradax: convert put_page() to put_user_page*() staging/vc04_services: convert put_page() to put_user_page*() drivers/tee: convert put_page() to put_user_page*()
vfio: convert put_page() to put_user_page*() fbdev/pvr2fb: convert put_page() to put_user_page*()
fsl_hypervisor: convert put_page() to put_user_page*()
xen: convert put_page() to put_user_page*() fs/exec.c: convert put_page() to put_user_page*()
orangefs: convert put_page() to put_user_page*()
uprobes: convert put_page() to put_user_page*()
futex: convert put_page() to put_user_page*() mm/frame_vector.c: convert put_page() to put_user_page*() mm/gup_benchmark.c: convert put_page() to put_user_page*() mm/memory.c: convert put_page() to put_user_page*() mm/madvise.c: convert put_page() to put_user_page*() mm/process_vm_access.c: convert put_page() to put_user_page*()
crypt: convert put_page() to put_user_page*()
nfs: convert put_page() to put_user_page*()
goldfish_pipe: convert put_page() to put_user_page*() kernel/events/core.c: convert put_page() to put_user_page*()
arch/x86/kvm/svm.c | 4 +- crypto/af_alg.c | 7 +- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 9 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/infiniband/core/umem.c | 5 +- drivers/infiniband/hw/hfi1/user_pages.c | 5 +- drivers/infiniband/hw/qib/qib_user_pages.c | 5 +- drivers/infiniband/hw/usnic/usnic_uiom.c | 5 +- drivers/infiniband/sw/siw/siw_mem.c | 10 +- drivers/media/pci/ivtv/ivtv-udma.c | 14 +-- drivers/media/pci/ivtv/ivtv-yuv.c | 10 +- drivers/media/v4l2-core/videobuf-dma-sg.c | 3 +- drivers/misc/genwqe/card_utils.c | 17 +-- drivers/misc/mic/scif/scif_rma.c | 17 ++- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_queue_pair.c | 11 +- drivers/platform/goldfish/goldfish_pipe.c | 9 +- drivers/rapidio/devices/rio_mport_cdev.c | 9 +- drivers/sbus/char/oradax.c | 2 +- .../interface/vchiq_arm/vchiq_2835_arm.c | 10 +- drivers/tee/tee_shm.c | 10 +- drivers/vfio/vfio_iommu_type1.c | 8 +- drivers/video/fbdev/pvr2fb.c | 3 +- drivers/virt/fsl_hypervisor.c | 7 +- drivers/xen/gntdev.c | 5 +- drivers/xen/privcmd.c | 7 +- fs/binfmt_elf.c | 2 +- fs/binfmt_elf_fdpic.c | 2 +- fs/exec.c | 2 +- fs/nfs/direct.c | 4 +- fs/orangefs/orangefs-bufmap.c | 7 +- include/linux/mm.h | 5 +- kernel/events/core.c | 2 +- kernel/events/uprobes.c | 6 +- kernel/futex.c | 10 +- mm/frame_vector.c | 4 +- mm/gup.c | 115 ++++++++---------- mm/gup_benchmark.c | 2 +- mm/madvise.c | 2 +- mm/memory.c | 2 +- mm/process_vm_access.c | 18 +-- net/ceph/pagevec.c | 8 +- net/rds/info.c | 5 +- net/rds/message.c | 2 +- net/rds/rdma.c | 15 ++- virt/kvm/kvm_main.c | 4 +- 47 files changed, 151 insertions(+), 266 deletions(-)
Signature · 1 line
2.22.0
PATCH 1/34 mm/gup: add make_dirty arg to put_user_pages_dirty_lock()
From: John Hubbard <[email protected]>
Provide more capable variation of put_user_pages_dirty_lock(), and delete put_user_pages_dirty(). This is based on the following:
1. Lots of call sites become simpler if a bool is passed into put_user_page*(), instead of making the call site choose which put_user_page*() variant to call.
2. Christoph Hellwig's observation that set_page_dirty_lock() is usually correct, and set_page_dirty() is usually a bug, or at least questionable, within a put_user_page*() calling chain.
This leads to the following API choices:
* put_user_pages_dirty_lock(page, npages, make_dirty)
* There is no put_user_pages_dirty(). You have to hand code that, in the rare case that it's required.
--- drivers/infiniband/core/umem.c | 5 +- drivers/infiniband/hw/hfi1/user_pages.c | 5 +- drivers/infiniband/hw/qib/qib_user_pages.c | 5 +- drivers/infiniband/hw/usnic/usnic_uiom.c | 5 +- drivers/infiniband/sw/siw/siw_mem.c | 10 +- include/linux/mm.h | 5 +- mm/gup.c | 115 +++++++++------------ 7 files changed, 58 insertions(+), 92 deletions(-)
drivers/infiniband/core/umem.c +1 -4
@@ -54,10 +54,7 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dfor_each_sg_page (umem->sg_head.sgl, &sg_iter, umem->sg_nents,0 ) { page =sg_page_iter_page (&sg_iter); -if (umem->writable && dirty) -put_user_pages_dirty_lock (&page,1 ); -else -put_user_page (page); +put_user_pages_dirty_lock (&page,1 , umem->writable && dirty); }sg_free_table (&umem->sg_head);
drivers/infiniband/hw/hfi1/user_pages.c +1 -4
@@ -118,10 +118,7 @@ int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t npvoid hfi1_release_user_pages (struct mm_struct *mm,struct page **p,size_t npages,bool dirty) { -if (dirty) -put_user_pages_dirty_lock (p, npages); -else -put_user_pages (p, npages); +put_user_pages_dirty_lock (p, npages, dirty);if (mm) {/* during close after signal, mm can be NULL */ atomic64_sub (npages, &mm->pinned_vm);
drivers/infiniband/hw/qib/qib_user_pages.c +1 -4
@@ -40,10 +40,7 @@static void __qib_release_user_pages (struct page **p,size_t num_pages,int dirty) { -if (dirty) -put_user_pages_dirty_lock (p, num_pages); -else -put_user_pages (p, num_pages); +put_user_pages_dirty_lock (p, num_pages, dirty); }/**
drivers/infiniband/hw/usnic/usnic_uiom.c +1 -4
@@ -75,10 +75,7 @@ static void usnic_uiom_put_pages(struct list_head *chunk_list, int dirty)for_each_sg (chunk->page_list, sg, chunk->nents, i) { page =sg_page (sg); pa =sg_phys (sg); -if (dirty) -put_user_pages_dirty_lock (&page,1 ); -else -put_user_page (page); +put_user_pages_dirty_lock (&page,1 , dirty);usnic_dbg ("pa: %pa\n" , &pa); }kfree (chunk);
drivers/infiniband/sw/siw/siw_mem.c +1 -9
@@ -63,15 +63,7 @@ struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index)static void siw_free_plist (struct siw_page_chunk *chunk,int num_pages,bool dirty) { -struct page **p = chunk->plist; - -while (num_pages--) { -if (!PageDirty (*p) && dirty) -put_user_pages_dirty_lock (p,1 ); -else -put_user_page (*p); - p++; - } +put_user_pages_dirty_lock (chunk->plist, num_pages, dirty); }void siw_umem_release (struct siw_umem *umem,bool dirty)
include/linux/mm.h +3 -2
@@ -1057,8 +1057,9 @@ static inline void put_user_page(struct page *page)put_page (page); } -void put_user_pages_dirty (struct page **pages,unsigned long npages); -void put_user_pages_dirty_lock (struct page **pages,unsigned long npages); +void put_user_pages_dirty_lock (struct page **pages,unsigned long npages, +bool make_dirty); +void put_user_pages (struct page **pages,unsigned long npages);#if defined(CONFIG_SPARSEMEM ) && !defined(CONFIG_SPARSEMEM_VMEMMAP )
mm/gup.c +50 -65
135 lines not on this page · raw message
Signature · 1 line
2.22.0
PATCH 2/34 net/rds: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- net/rds/info.c | 5 ++--- net/rds/message.c | 2 +- net/rds/rdma.c | 15 +++++++-------- 3 files changed, 10 insertions(+), 12 deletions(-)
net/rds/info.c +2 -3
@@ -162,7 +162,6 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval,struct rds_info_lengths lens;unsigned long nr_pages =0 ;unsigned long start; -unsigned long i;rds_info_func func;struct page **pages =NULL ;int ret;
@@ -235,8 +234,8 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, ret = -EFAULT ; out: -for (i =0 ; pages && i < nr_pages; i++) -put_page (pages[i]); +if (pages) +put_user_pages (pages, nr_pages);kfree (pages);return ret;
net/rds/message.c +1 -1
@@ -404,7 +404,7 @@ static int rds_message_zcopy_from_user(struct rds_message *rm, struct iov_iter *int i;for (i =0 ; i < rm->data.op_nents; i++) -put_page (sg_page (&rm->data.op_sg[i])); +put_user_page (sg_page (&rm->data.op_sg[i])); mmp = &rm->data.op_mmp_znotifier->z_mmp;mm_unaccount_pinned_pages (mmp); ret = -EFAULT ;
net/rds/rdma.c +7 -8
@@ -162,8 +162,7 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages, pages);if (ret >=0 && ret < nr_pages) { -while (ret--) -put_page (pages[ret]); +put_user_pages (pages, ret); ret = -EFAULT ; }
@@ -276,7 +275,7 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,if (IS_ERR (trans_private)) {for (i =0 ; i < nents; i++) -put_page (sg_page (&sg[i])); +put_user_page (sg_page (&sg[i]));kfree (sg); ret =PTR_ERR (trans_private); goto out;
@@ -464,9 +463,10 @@ void rds_rdma_free_op(struct rm_rdma_op *ro)* to local memory */ if (!ro->op_write) {WARN_ON (!page->mapping &&irqs_disabled ()); -set_page_dirty (page); +put_user_pages_dirty_lock (&page,1 , true); + }else { +put_user_page (page); } -put_page (page); }kfree (ro->op_notifier);
@@ -481,8 +481,7 @@ void rds_atomic_free_op(struct rm_atomic_op *ao)/* Mark page dirty if it was possibly modified, which * is the case for a RDMA_READ which copies from remote * to local memory */ -set_page_dirty (page); -put_page (page); +put_user_pages_dirty_lock (&page,1 , true);kfree (ao->op_notifier); ao->op_notifier =NULL ;
@@ -867,7 +866,7 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,return ret; err:if (page) -put_page (page); +put_user_page (page); rm->atomic.op_active =0 ;kfree (rm->atomic.op_notifier);
Signature · 1 line
2.22.0
PATCH 3/34 net/ceph: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- net/ceph/pagevec.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
net/ceph/pagevec.c +1 -7
@@ -12,13 +12,7 @@void ceph_put_page_vector (struct page **pages,int num_pages,bool dirty) { -int i; - -for (i =0 ; i < num_pages; i++) { -if (dirty) -set_page_dirty_lock (pages[i]); -put_page (pages[i]); - } +put_user_pages_dirty_lock (pages, num_pages, dirty);kvfree (pages); }EXPORT_SYMBOL (ceph_put_page_vector);
Signature · 1 line
2.22.0
Re: [PATCH 03/34] net/ceph: convert put_page() to put_user_page*()
Quoted 28 lines · On Thu, 2019-08-01 at 19:19 -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Ilya Dryomov <[email protected]>Cc Sage Weil <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by John Hubbard <[email protected]>--- net/ceph/pagevec.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)net/ceph/pagevec.c +0
-1@@ -12,13 +12,7 @@void ceph_put_page_vector (struct page **pages,int num_pages,bool dirty) { -int i;
net/ceph/pagevec.c line 18
Quoted 10 lines
net/ceph/pagevec.c +1
-6- -for (i =0 ; i < num_pages; i++) { -if (dirty) -set_page_dirty_lock (pages[i]); -put_page (pages[i]); - } +put_user_pages_dirty_lock (pages, num_pages, dirty);kvfree (pages); }EXPORT_SYMBOL (ceph_put_page_vector);
This patch looks sane enough. Assuming that the earlier patches are OK:
PATCH 4/34 x86/kvm: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- arch/x86/kvm/svm.c | 4 ++-- virt/kvm/kvm_main.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/svm.c +2 -2
@@ -1827,7 +1827,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, err:if (npinned >0 ) -release_pages (pages, npinned); +put_user_pages (pages, npinned);kvfree (pages);return NULL ;
@@ -1838,7 +1838,7 @@ static void sev_unpin_memory(struct kvm *kvm, struct page **pages, {struct kvm_sev_info *sev = &to_kvm_svm (kvm)->sev_info; -release_pages (pages, npages); +put_user_pages (pages, npages);kvfree (pages); sev->pages_locked -= npages; }
virt/kvm/kvm_main.c +2 -2
@@ -1499,7 +1499,7 @@ static int hva_to_pfn_slow(unsigned long addr, bool *async, bool write_fault,if (__get_user_pages_fast (addr,1 ,1 , &wpage) ==1 ) { *writable = true; -put_page (page); +put_user_page (page); page = wpage; } }
@@ -1831,7 +1831,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean);void kvm_release_pfn_clean (kvm_pfn_t pfn) {if (!is_error_noslot_pfn (pfn) && !kvm_is_reserved_pfn (pfn)) -put_page (pfn_to_page (pfn)); +put_user_page (pfn_to_page (pfn)); }EXPORT_SYMBOL_GPL (kvm_release_pfn_clean);
Signature · 6 lines
2.22.0 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 5/34 drm/etnaviv: convert release_pages() to put_user_pages()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gem.c +2 -2
@@ -686,7 +686,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj) ret =get_user_pages_fast (ptr, num_pages, !userptr->ro ?FOLL_WRITE :0 , pages);if (ret <0 ) { -release_pages (pvec, pinned); +put_user_pages (pvec, pinned);kvfree (pvec);return ret; }
@@ -710,7 +710,7 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj)if (etnaviv_obj->pages) {int npages = etnaviv_obj->base.size >>PAGE_SHIFT ; -release_pages (etnaviv_obj->pages, npages); +put_user_pages (etnaviv_obj->pages, npages);kvfree (etnaviv_obj->pages); } }
Signature · 1 line
2.22.0
PATCH 6/34 drm/i915: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
Note that this effectively changes the code's behavior in i915_gem_userptr_put_pages(): it now calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate.
As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1]
[1] https://lore.kernel.org/r/[email protected]
--- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +3 -6
@@ -527,7 +527,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) }mutex_unlock (&obj->mm.lock); -release_pages (pvec, pinned); +put_user_pages (pvec, pinned);kvfree (pvec);i915_gem_object_put (obj);
@@ -640,7 +640,7 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)__i915_gem_userptr_set_active (obj, true);if (IS_ERR (pages)) -release_pages (pvec, pinned); +put_user_pages (pvec, pinned);kvfree (pvec);return PTR_ERR_OR_ZERO (pages);
@@ -663,11 +663,8 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj,i915_gem_gtt_finish_pages (obj, pages);for_each_sgt_page (page, sgt_iter, pages) { -if (obj->mm.dirty) -set_page_dirty (page); -mark_page_accessed (page); -put_page (page); +put_user_pages_dirty_lock (&page,1 , obj->mm.dirty); } obj->mm.dirty = false;
Signature · 1 line
2.22.0
Joonas Lahtinen
maintainerRe: [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
Quoting [email protected] (2019-08-02 05:19:37)
Quoted 6 lines
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().
Quoted 6 lines
This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Note that this effectively changes the code's behavior in
i915_gem_userptr_put_pages(): it now callsset_page_dirty_lock(), instead ofset_page_dirty(). This is probably more accurate.
We've already fixed this in drm-tip where the current code uses set_page_dirty_lock().
This would conflict with our tree. Rodrigo is handling drm-intel-next for 5.4, so you guys want to coordinate how to merge.
Regards, Joonas
John Hubbard
reviewerRe: [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
Quoted 14 lines · Joonas Lahtinen
Quoting [email protected] (2019-08-02 05:19:37)
Quoted 6 lines
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().Quoted 6 lines
This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Note that this effectively changes the code's behavior in
i915_gem_userptr_put_pages(): it now callsset_page_dirty_lock(), instead ofset_page_dirty(). This is probably more accurate.
Quoted 7 lines
We've already fixed this in drm-tip where the current code uses
set_page_dirty_lock().This would conflict with our tree. Rodrigo is handling drm-intel-next for 5.4, so you guys want to coordinate how to merge.
Hi Joonas, Rodrigo,
First of all, I apologize for the API breakage: put_user_pages_dirty_lock() has an additional "dirty" parameter.
In order to deal with the merge problem, I'll drop this patch from my series, and I'd recommend that the drm-intel-next take the following approach:
1) For now, s/put_page/put_user_page/ in i915_gem_userptr_put_pages(), and fix up the set_page_dirty() --> set_page_dirty_lock() issue, like this (based against linux.git):
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +2 -2
@@ -664,10 +664,10 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj,for_each_sgt_page (page, sgt_iter, pages) {if (obj->mm.dirty) -set_page_dirty (page); +set_page_dirty_lock (page);mark_page_accessed (page); -put_page (page); +put_user_page (page); } obj->mm.dirty = false;
That will leave you with your original set_page_dirty_lock() calls and everything works properly.
2) Next cycle, move to the new put_user_pages_dirty_lock().
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 2 lines
Regards, Joonas
John Hubbard
reviewerRe: [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
Quoted 3 lines · John Hubbard
Quoted 2 lines · Joonas Lahtinen
Quoting [email protected] (2019-08-02 05:19:37)
Quoted 1 line
From: John Hubbard <[email protected]>
...
Quoted 2 lines
In order to deal with the merge problem, I'll drop this patch from my series, and I'd recommend that the drm-intel-next take the following approach:
Actually, I just pulled the latest linux.git, and there are a few changes:
Quoted 10 lines
1) For now, s/put_page/put_user_page/ in
i915_gem_userptr_put_pages(), and fix up theset_page_dirty()-->set_page_dirty_lock()issue, like this (based against linux.git):drivers/gpu/drm/i915/gem/i915_gem_userptr.c +0
-0
drivers/gpu/drm/i915/gem/i915_gem_userptr.c i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, · line 667
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +1
-1@@ -664,10 +664,10 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, for_each_sgt_page(page, sgt_iter, pages) { if (obj->mm.dirty) - set_page_dirty(page); + set_page_dirty_lock(page);
I see you've already applied this fix to your tree, in linux.git already.
drivers/gpu/drm/i915/gem/i915_gem_userptr.c i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, · line 670
Quoted 4 lines
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +1
-1mark_page_accessed(page); - put_page(page); + put_user_page(page);
But this conversion still needs doing. So I'll repost a patch that only does this (plus the other call sites).
That can go in via either your tree, or Andrew's -mm tree, without generating any conflicts.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
PATCH 7/34 drm/radeon: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_ttm.c +1 -1
@@ -540,7 +540,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)kfree (ttm->sg); release_pages: -release_pages (ttm->pages, pinned); +put_user_pages (ttm->pages, pinned);return r; }
Signature · 6 lines
2.22.0 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 8/34 media/ivtv: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/media/pci/ivtv/ivtv-udma.c | 14 ++++---------- drivers/media/pci/ivtv/ivtv-yuv.c | 10 +++------- 2 files changed, 7 insertions(+), 17 deletions(-)
drivers/media/pci/ivtv/ivtv-udma.c +4 -10
@@ -92,7 +92,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr, {struct ivtv_dma_page_info user_dma;struct ivtv_user_dma *dma = &itv->udma; -int i, err; +int err;IVTV_DEBUG_DMA ("ivtv_udma_setup, dst: 0x%08x\n" , (unsigned int )ivtv_dest_addr);
@@ -119,8 +119,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,IVTV_DEBUG_WARN ("failed to map user pages, returned %d instead of %d\n" , err, user_dma.page_count);if (err >=0 ) { -for (i =0 ; i < err; i++) -put_page (dma->map[i]); +put_user_pages (dma->map, err);return -EINVAL ; }return err;
@@ -130,9 +129,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,/* Fill SG List with new values */ if (ivtv_udma_fill_sg_list (dma, &user_dma,0 ) <0 ) { -for (i =0 ; i < dma->page_count; i++) { -put_page (dma->map[i]); - } +put_user_pages (dma->map, dma->page_count); dma->page_count =0 ;return -ENOMEM ; }
@@ -153,7 +150,6 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,void ivtv_udma_unmap (struct ivtv *itv) {struct ivtv_user_dma *dma = &itv->udma; -int i;IVTV_DEBUG_INFO ("ivtv_unmap_user_dma\n" );
@@ -170,9 +166,7 @@ void ivtv_udma_unmap(struct ivtv *itv)ivtv_udma_sync_for_cpu (itv);/* Release User Pages */ -for (i =0 ; i < dma->page_count; i++) { -put_page (dma->map[i]); - } +put_user_pages (dma->map, dma->page_count); dma->page_count =0 ; }
drivers/media/pci/ivtv/ivtv-yuv.c +3 -7
@@ -81,8 +81,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, uv_pages, uv_dma.page_count);if (uv_pages >=0 ) { -for (i =0 ; i < uv_pages; i++) -put_page (dma->map[y_pages + i]); +put_user_pages (&dma->map[y_pages], uv_pages); rc = -EFAULT ; }else { rc = uv_pages;
@@ -93,8 +92,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma, y_pages, y_dma.page_count); }if (y_pages >=0 ) { -for (i =0 ; i < y_pages; i++) -put_page (dma->map[i]); +put_user_pages (dma->map, y_pages);/* * Inherit the -EFAULT from rc's * initialization, but allow it to be
@@ -112,9 +110,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,/* Fill & map SG List */ if (ivtv_udma_fill_sg_list (dma, &uv_dma,ivtv_udma_fill_sg_list (dma, &y_dma,0 )) <0 ) {IVTV_DEBUG_WARN ("could not allocate bounce buffers for highmem userspace buffers\n" ); -for (i =0 ; i < dma->page_count; i++) { -put_page (dma->map[i]); - } +put_user_pages (dma->map, dma->page_count); dma->page_count =0 ;return -ENOMEM ; }
Signature · 1 line
2.22.0
PATCH 9/34 media/v4l2-core/mm: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/media/v4l2-core/videobuf-dma-sg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/v4l2-core/videobuf-dma-sg.c +1 -2
@@ -349,8 +349,7 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)BUG_ON (dma->sglen);if (dma->pages) { -for (i =0 ; i < dma->nr_pages; i++) -put_page (dma->pages[i]); +put_user_pages (dma->pages, dma->nr_pages);kfree (dma->pages); dma->pages =NULL ; }
Signature · 1 line
2.22.0
PATCH 10/34 genwqe: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the get_user_pages() pattern of usage here never allowed for NULL entries within a range of pinned pages.
--- drivers/misc/genwqe/card_utils.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/misc/genwqe/card_utils.c +3 -14
@@ -517,24 +517,13 @@ int genwqe_free_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl)/** * genwqe_free_user_pages() - Give pinned pages back * -* Documentation of get_user_pages is in mm/gup.c: -* -* If the page is written to, set_page_dirty (or set_page_dirty_lock, -* as appropriate) must be called after the page is finished with, and -* before put_page is called. +* The pages may have been written to, so we call put_user_pages_dirty_lock(), +* rather than put_user_pages(). */ static int genwqe_free_user_pages (struct page **page_list,unsigned int nr_pages,int dirty) { -unsigned int i; - -for (i =0 ; i < nr_pages; i++) { -if (page_list[i] !=NULL ) { -if (dirty) -set_page_dirty_lock (page_list[i]); -put_page (page_list[i]); - } - } +put_user_pages_dirty_lock (page_list, nr_pages, dirty);return 0 ; }
Signature · 1 line
2.22.0
Re: [PATCH 10/34] genwqe: convert put_page() to put_user_page*()
Quoted 14 lines · On Thu, Aug 01, 2019 at 07:19:41PM -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the
get_user_pages()pattern of usage here never allowed for NULL entries within a range of pinned pages.
Quoted 8 lines
Cc Frank Haverkamp <[email protected]>Cc "Guilherme G. Piccoli" <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by John Hubbard <[email protected]>--- drivers/misc/genwqe/card_utils.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 11/34 scif: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/misc/mic/scif/scif_rma.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/misc/mic/scif/scif_rma.c +8 -9
@@ -113,13 +113,14 @@ static int scif_destroy_pinned_pages(struct scif_pinned_pages *pin)int writeable = pin->prot &SCIF_PROT_WRITE ;int kernel =SCIF_MAP_KERNEL & pin->map_flags; -for (j =0 ; j < pin->nr_pages; j++) { -if (pin->pages[j] && !kernel) { +if (kernel) { +for (j =0 ; j < pin->nr_pages; j++) {if (writeable) -SetPageDirty (pin->pages[j]); +set_page_dirty_lock (pin->pages[j]);put_page (pin->pages[j]); } - } + }else +put_user_pages_dirty_lock (pin->pages, pin->nr_pages, writeable);scif_free (pin->pages, pin->nr_pages *sizeof (*pin->pages));
@@ -1385,11 +1386,9 @@ int __scif_pin_pages(void *addr, size_t len, int *out_prot,if (ulimit)__scif_dec_pinned_vm_lock (mm, nr_pages);/* Roll back any pinned pages */ -for (i =0 ; i < pinned_pages->nr_pages; i++) { -if (pinned_pages->pages[i]) -put_page ( - pinned_pages->pages[i]); - } +put_user_pages (pinned_pages->pages, + pinned_pages->nr_pages); + prot &= ~SCIF_PROT_WRITE ; try_upgrade = false; goto retry;
Signature · 1 line
2.22.0
PATCH 12/34 vmci: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
Note that this effectively changes the code's behavior in qp_release_pages(): it now ultimately calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate.
As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1]
[1] https://lore.kernel.org/r/[email protected]
--- drivers/misc/vmw_vmci/vmci_context.c | 2 +- drivers/misc/vmw_vmci/vmci_queue_pair.c | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/misc/vmw_vmci/vmci_context.c +1 -1
@@ -587,7 +587,7 @@ void vmci_ctx_unset_notify(struct vmci_ctx *context)if (notify_page) {kunmap (notify_page); -put_page (notify_page); +put_user_page (notify_page); } }
drivers/misc/vmw_vmci/vmci_queue_pair.c +2 -9
@@ -626,15 +626,8 @@ static void qp_release_queue_mutex(struct vmci_queue *queue)static void qp_release_pages (struct page **pages,u64 num_pages,bool dirty) { -int i; - -for (i =0 ; i < num_pages; i++) { -if (dirty) -set_page_dirty (pages[i]); - -put_page (pages[i]); - pages[i] =NULL ; - } +put_user_pages_dirty_lock (pages, num_pages, dirty); +memset (pages,0 , num_pages *sizeof (struct page *)); }/*
Signature · 1 line
2.22.0
PATCH 13/34 rapidio: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/rapidio/devices/rio_mport_cdev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +3 -6
@@ -572,14 +572,12 @@ static void dma_req_free(struct kref *ref) struct mport_dma_req *req = container_of(ref, struct mport_dma_req, refcount);struct mport_cdev_priv *priv = req->priv; -unsigned int i;dma_unmap_sg (req->dmach->device->dev, req->sgt.sgl, req->sgt.nents, req->dir);sg_free_table (&req->sgt);if (req->page_list) { -for (i =0 ; i < req->nr_pages; i++) -put_page (req->page_list[i]); +put_user_pages (req->page_list, req->nr_pages);kfree (req->page_list); }
@@ -815,7 +813,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,struct mport_dma_req *req;struct mport_dev *md = priv->md;struct dma_chan *chan; -int i, ret; +int ret;int nents;if (xfer->length ==0 )
@@ -946,8 +944,7 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, err_pg:if (!req->page_list) { -for (i =0 ; i < nr_pages; i++) -put_page (page_list[i]); +put_user_pages (page_list, nr_pages);kfree (page_list); } err_req:
Signature · 1 line
2.22.0
PATCH 14/34 oradax: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/sbus/char/oradax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sbus/char/oradax.c +1 -1
@@ -412,7 +412,7 @@ static void dax_unlock_pages(struct dax_ctx *ctx, int ccb_index, int nelem)dax_dbg ("freeing page %p" , p);if (j ==OUT )set_page_dirty (p); -put_page (p); +put_user_page (p); ctx->pages[i][j] =NULL ; } }
Signature · 1 line
2.22.0
PATCH 15/34 staging/vc04_services: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +2 -8
@@ -336,10 +336,7 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info *pagelistinfo) }if (pagelistinfo->pages_need_release) { -unsigned int i; - -for (i =0 ; i < pagelistinfo->num_pages; i++) -put_page (pagelistinfo->pages[i]); +put_user_pages (pagelistinfo->pages, pagelistinfo->num_pages); } dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
@@ -454,10 +451,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) __func__, actual_pages, num_pages);/* This is probably due to the process being killed */ -while (actual_pages >0 ) { - actual_pages--; -put_page (pages[actual_pages]); - } +put_user_pages (pages, actual_pages);cleanup_pagelistinfo (pagelistinfo);return NULL ; }
Signature · 1 line
2.22.0
Re: [PATCH 15/34] staging/vc04_services: convert put_page() to put_user_page*()
Quoted 21 lines · On Thu, Aug 01, 2019 at 07:19:46PM -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Eric Anholt <[email protected]>Cc Stefan Wahren <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Mihaela Muraru <[email protected]>Cc Suniel Mahesh <[email protected]>Cc Al Viro <[email protected]>Cc Sidong Yang <[email protected]>Cc Kishore KP <[email protected]>Signed-off-by John Hubbard <[email protected]>
Quoted 3 lines
--- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/34 drivers/tee: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/tee/tee_shm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/tee/tee_shm.c +2 -8
@@ -31,16 +31,13 @@ static void tee_shm_release(struct tee_shm *shm) poolm->ops->free (poolm, shm); }else if (shm->flags &TEE_SHM_REGISTER ) { -size_t n;int rc = teedev->desc->ops->shm_unregister (shm->ctx, shm);if (rc)dev_err (teedev->dev.parent,"unregister shm %p failed: %d" , shm, rc); -for (n =0 ; n < shm->num_pages; n++) -put_page (shm->pages[n]); - +put_user_pages (shm->pages, shm->num_pages);kfree (shm->pages); }
@@ -313,16 +310,13 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,return shm; err:if (shm) { -size_t n; -if (shm->id >=0 ) {mutex_lock (&teedev->mutex);idr_remove (&teedev->idr, shm->id);mutex_unlock (&teedev->mutex); }if (shm->pages) { -for (n =0 ; n < shm->num_pages; n++) -put_page (shm->pages[n]); +put_user_pages (shm->pages, shm->num_pages);kfree (shm->pages); } }
Signature · 1 line
2.22.0
Re: [PATCH 16/34] drivers/tee: convert put_page() to put_user_page*()
Quoted 7 lines · On Fri, Aug 2, 2019 at 4:20 AM <[email protected]> wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().
Quoted 8 lines
This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Jens Wiklander <[email protected]>Signed-off-by John Hubbard <[email protected]>--- drivers/tee/tee_shm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
I suppose you're taking this via your own tree or such.
Thanks,
Jens
Quoted 44 lines
drivers/tee/tee_shm.c +2
-9@@ -31,16 +31,13 @@ static void tee_shm_release(struct tee_shm *shm) poolm->ops->free (poolm, shm); }else if (shm->flags &TEE_SHM_REGISTER ) { -size_t n;int rc = teedev->desc->ops->shm_unregister (shm->ctx, shm);if (rc)dev_err (teedev->dev.parent,"unregister shm %p failed: %d" , shm, rc); -for (n =0 ; n < shm->num_pages; n++) -put_page (shm->pages[n]); - +put_user_pages (shm->pages, shm->num_pages);kfree (shm->pages); }@@ -313,16 +310,13 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,return shm; err:if (shm) { -size_t n; -if (shm->id >=0 ) {mutex_lock (&teedev->mutex);idr_remove (&teedev->idr, shm->id);mutex_unlock (&teedev->mutex); }if (shm->pages) { -for (n =0 ; n < shm->num_pages; n++) -put_page (shm->pages[n]); +put_user_pages (shm->pages, shm->num_pages);kfree (shm->pages); } } --2.22.0
John Hubbard
reviewerRe: [PATCH 16/34] drivers/tee: convert put_page() to put_user_page*()
Quoted 17 lines · Jens Wiklander
Quoted 7 lines · On Fri, Aug 2, 2019 at 4:20 AM <[email protected]> wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().Quoted 8 lines
This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Jens Wiklander <[email protected]>Signed-off-by John Hubbard <[email protected]>--- drivers/tee/tee_shm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
Quoted 4 lines
Acked-by Jens Wiklander <[email protected]>I suppose you're taking this via your own tree or such.
Hi Jens,
Thanks for the ACK! I'm expecting that Andrew will take this through his -mm tree, unless he pops up and says otherwise.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
PATCH 17/34 vfio: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
Note that this effectively changes the code's behavior in qp_release_pages(): it now ultimately calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate.
As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1]
[1] https://lore.kernel.org/r/[email protected]
--- drivers/vfio/vfio_iommu_type1.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/vfio/vfio_iommu_type1.c +4 -4
@@ -320,9 +320,9 @@ static int put_pfn(unsigned long pfn, int prot) {if (!is_invalid_reserved_pfn (pfn)) {struct page *page =pfn_to_page (pfn); -if (prot &IOMMU_WRITE ) -SetPageDirty (page); -put_page (page); +bool dirty = prot &IOMMU_WRITE ; + +put_user_pages_dirty_lock (&page,1 , dirty);return 1 ; }return 0 ;
@@ -356,7 +356,7 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr,*/ if (ret >0 &&vma_is_fsdax (vmas[0 ])) { ret = -EOPNOTSUPP ; -put_page (page[0 ]); +put_user_page (page[0 ]); } }up_read (&mm->mmap_sem);
Signature · 1 line
2.22.0
PATCH 18/34 fbdev/pvr2fb: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/video/fbdev/pvr2fb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/pvr2fb.c +1 -2
@@ -700,8 +700,7 @@ static ssize_t pvr2fb_write(struct fb_info *info, const char *buf, ret = count; out_unmap: -for (i =0 ; i < nr_pages; i++) -put_page (pages[i]); +put_user_pages (pages, nr_pages);kfree (pages);
Signature · 1 line
2.22.0
PATCH 19/34 fsl_hypervisor: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the get_user_pages() pattern of usage here never allowed for NULL entries within a range of pinned pages.
--- drivers/virt/fsl_hypervisor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/virt/fsl_hypervisor.c +2 -5
@@ -292,11 +292,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) virt_to_phys(sg_list), num_pages); exit: -if (pages) { -for (i =0 ; i < num_pages; i++) -if (pages[i]) -put_page (pages[i]); - } +if (pages) +put_user_pages (pages, num_pages);kfree (sg_list_unaligned);kfree (pages);
Signature · 1 line
2.22.0
PATCH 20/34 xen: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- drivers/xen/gntdev.c | 5 +---- drivers/xen/privcmd.c | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-)
drivers/xen/gntdev.c +1 -4
@@ -864,10 +864,7 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,static void gntdev_put_pages (struct gntdev_copy_batch *batch) { -unsigned int i; - -for (i =0 ; i < batch->nr_pages; i++) -put_page (batch->pages[i]); +put_user_pages (batch->pages, batch->nr_pages); batch->nr_pages =0 ; }
drivers/xen/privcmd.c +1 -6
@@ -611,15 +611,10 @@ static int lock_pages(static void unlock_pages (struct page *pages[],unsigned int nr_pages) { -unsigned int i; -if (!pages)return ; -for (i =0 ; i < nr_pages; i++) { -if (pages[i]) -put_page (pages[i]); - } +put_user_pages (pages, nr_pages); }static long privcmd_ioctl_dm_op (struct file *file,void __user *udata)
Signature · 1 line
2.22.0
Juergen Gross
maintainerRe: [PATCH 20/34] xen: convert put_page() to put_user_page*()
Quoted 42 lines · On 02.08.19 04:19, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Signed-off-by John Hubbard <[email protected]>--- drivers/xen/gntdev.c | 5 +---- drivers/xen/privcmd.c | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-)drivers/xen/gntdev.c +1
-4@@ -864,10 +864,7 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,static void gntdev_put_pages (struct gntdev_copy_batch *batch) { -unsigned int i; - -for (i =0 ; i < batch->nr_pages; i++) -put_page (batch->pages[i]); +put_user_pages (batch->pages, batch->nr_pages); batch->nr_pages =0 ; }drivers/xen/privcmd.c +0
-0@@ -611,15 +611,10 @@ static int lock_pages(static void unlock_pages (struct page *pages[],unsigned int nr_pages) {
drivers/xen/privcmd.c static int lock_pages( · line 617
Quoted 10 lines
drivers/xen/privcmd.c +1
-6-unsigned int i; -if (!pages)return ; -for (i =0 ; i < nr_pages; i++) { -if (pages[i]) -put_page (pages[i]); - } +put_user_pages (pages, nr_pages);
You are not handling the case where pages[i] is NULL here. Or am I missing a pending patch to put_user_pages() here?
Juergen
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
John Hubbard
reviewerRe: [PATCH 20/34] xen: convert put_page() to put_user_page*()
Quoted 2 lines · Juergen Gross
Quoted 1 line · On 02.08.19 04:19, [email protected] wrote:
From: John Hubbard <[email protected]>
...
Quoted 11 lines
Quoted 11 lines
drivers/xen/privcmd.c +0
-2@@ -611,15 +611,10 @@ static int lock_pages( static void unlock_pages(struct page *pages[], unsigned int nr_pages) { - unsigned int i; - if (!pages) return;
Quoted 9 lines
drivers/xen/privcmd.c static int lock_pages( · line 617
Quoted 5 lines
drivers/xen/privcmd.c +1
-4- for (i = 0; i < nr_pages; i++) { - if (pages[i]) - put_page(pages[i]); - } + put_user_pages(pages, nr_pages);You are not handling the case where pages[i] is NULL here. Or am I missing a pending patch to
put_user_pages()here?
Hi Juergen,
You are correct--this no longer handles the cases where pages[i] is NULL. It's intentional, though possibly wrong. :)
I see that I should have added my standard blurb to this commit description. I missed this one, but some of the other patches have it. It makes the following, possibly incorrect claim:
"This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the get_user_pages() pattern of usage here never allowed for NULL entries within a range of pinned pages."
The way I've seen these page arrays used with get_user_pages(), things are either done single page, or with a contiguous range. So unless I'm missing a case where someone is either
a) releasing individual pages within a range (and thus likely messing up their count of pages they have), or
b) allocating two gup ranges within the same pages[] array, with a gap between the allocations,
...then it should be correct. If so, then I'll add the above blurb to this patch's commit description.
If that's not the case (both here, and in 3 or 4 other patches in this series, then as you said, I should add NULL checks to put_user_pages() and put_user_pages_dirty_lock().
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Juergen Gross
maintainerRe: [PATCH 20/34] xen: convert put_page() to put_user_page*()
Quoted 49 lines · John Hubbard
Quoted 2 lines · Juergen Gross
Quoted 1 line · On 02.08.19 04:19, [email protected] wrote:
From: John Hubbard <[email protected]>
...
Quoted 11 lines
Quoted 11 lines
drivers/xen/privcmd.c +0
-2@@ -611,15 +611,10 @@ static int lock_pages( static void unlock_pages(struct page *pages[], unsigned int nr_pages) { - unsigned int i; - if (!pages) return;Quoted 9 lines
drivers/xen/privcmd.c static int lock_pages( · line 615
Quoted 5 lines
drivers/xen/privcmd.c +1
-4- for (i = 0; i < nr_pages; i++) { - if (pages[i]) - put_page(pages[i]); - } + put_user_pages(pages, nr_pages);You are not handling the case where pages[i] is NULL here. Or am I missing a pending patch to
put_user_pages()here?Hi Juergen,
You are correct--this no longer handles the cases where pages[i] is NULL. It's intentional, though possibly wrong. :)
I see that I should have added my standard blurb to this commit description. I missed this one, but some of the other patches have it. It makes the following, possibly incorrect claim:
"This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the
get_user_pages()pattern of usage here never allowed for NULL entries within a range of pinned pages."The way I've seen these page arrays used with
get_user_pages(), things are either done single page, or with a contiguous range. So unless I'm missing a case where someone is eithera) releasing individual pages within a range (and thus likely messing up their count of pages they have), or
b) allocating two gup ranges within the same pages[] array, with a gap between the allocations,
Quoted 6 lines
...then it should be correct. If so, then I'll add the above blurb to this patch's commit description.
If that's not the case (both here, and in 3 or 4 other patches in this series, then as you said, I should add NULL checks to
put_user_pages()andput_user_pages_dirty_lock().
In this case it is not correct, but can easily be handled. The NULL case can occur only in an error case with the pages array filled partially or not at all.
I'd prefer something like the attached patch here.
Juergen
drivers/xen/privcmd.c +11 -21
@@ -582,10 +582,11 @@ static long privcmd_ioctl_mmap_batch(static int lock_pages (struct privcmd_dm_op_buf kbufs[],unsigned int num, -struct page *pages[],unsigned int nr_pages) +struct page *pages[],unsigned int *nr_pages) { -unsigned int i; +unsigned int i, free = *nr_pages; + *nr_pages =0 ;for (i =0 ; i < num; i++) {unsigned int requested;int pinned;
@@ -593,35 +594,22 @@ static int lock_pages( requested =DIV_ROUND_UP (offset_in_page (kbufs[i].uptr) + kbufs[i].size,PAGE_SIZE ); -if (requested > nr_pages) +if (requested > free)return -ENOSPC ; pinned =get_user_pages_fast ( (unsigned long ) kbufs[i].uptr, - requested,FOLL_WRITE , pages); + requested,FOLL_WRITE , pages + *nr_pages);if (pinned <0 )return pinned; - nr_pages -= pinned; - pages += pinned; + free -= pinned; + *nr_pages += pinned; }return 0 ; } -static void unlock_pages (struct page *pages[],unsigned int nr_pages) -{ -unsigned int i; - -if (!pages) -return ; - -for (i =0 ; i < nr_pages; i++) { -if (pages[i]) -put_page (pages[i]); - } -} -static long privcmd_ioctl_dm_op (struct file *file,void __user *udata) {struct privcmd_data *data = file->private_data;
@@ -681,11 +669,12 @@ static long privcmd_ioctl_dm_op(struct file *file, void __user *udata) xbufs =kcalloc (kdata.num,sizeof (*xbufs),GFP_KERNEL );if (!xbufs) { + nr_pages =0 ; rc = -ENOMEM ; goto out; } - rc =lock_pages (kbufs, kdata.num, pages, nr_pages); + rc =lock_pages (kbufs, kdata.num, pages, &nr_pages);if (rc) goto out;
@@ -699,7 +688,8 @@ static long privcmd_ioctl_dm_op(struct file *file, void __user *udata)xen_preemptible_hcall_end (); out: -unlock_pages (pages, nr_pages); +if (pages) +put_user_pages (pages, nr_pages);kfree (xbufs);kfree (pages);kfree (kbufs);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RE: [PATCH 20/34] xen: convert put_page() to put_user_page*()
Quoted 55 lines · John Hubbard
Quoted 53 lines · Juergen Gross
Quoted 2 lines · On 02.08.19 04:19, [email protected] wrote:
Quoted 1 line
From: John Hubbard <[email protected]>
...
Quoted 12 lines
Quoted 12 lines
drivers/xen/privcmd.c index renamed from drivers/xen/privcmd.c +0
-0
2f5ce7230a43..29e461dbee2d100644drivers/xen/privcmd.c +0
-0@@ -611,15 +611,10 @@ static int lock_pages(static void
unlock_pages(struct page *pages[], unsigned int nr_pages)
{
- unsigned int i;
-
if (!pages)
return;Quoted 9 lines
Quoted 5 lines
- for (i = 0; i <
nr_pages; i++) {
- if (pages[i])
-put_page(pages[i]);
- }
+put_user_pages(pages, nr_pages);You are not handling the case where pages[i] is NULL here. Or am I missing a pending patch to
put_user_pages()here?Hi Juergen,
You are correct--this no longer handles the cases where pages[i] is NULL. It's intentional, though possibly wrong. :)
I see that I should have added my standard blurb to this commit description. I missed this one, but some of the other patches have it. It makes the following, possibly incorrect claim:
"This changes the release code slightly, because each page slot in the page_list[] array is no longer checked for NULL. However, that check was wrong anyway, because the
get_user_pages()pattern of usage here never allowed for NULL entries within a range of pinned pages."The way I've seen these page arrays used with
get_user_pages(), things are either done single page, or with a contiguous range. So unless I'm missing a case where someone is eithera) releasing individual pages within a range (and thus likely messing up their count of pages they have), or
b) allocating two gup ranges within the same pages[] array, with a gap between the allocations,
...then it should be correct. If so, then I'll add the above blurb to this patch's commit description.
Quoted 8 lines
Quoted 3 lines
If that's not the case (both here, and in 3 or 4 other patches in this series, then as you said, I should add NULL checks to
put_user_pages()andput_user_pages_dirty_lock().In this case it is not correct, but can easily be handled. The NULL case can occur only in an error case with the pages array filled partially or not at all.
I'd prefer something like the attached patch here.
I'm not an expert in this code and have not looked at it carefully but that patch does seem to be the better fix than forcing NULL checks on everyone.
Ira
John Hubbard
reviewerRe: [PATCH 20/34] xen: convert put_page() to put_user_page*()
Quoted 10 lines · Ira
Quoted 10 lines · John Hubbard
Quoted 7 lines · Juergen Gross
Quoted 2 lines · On 02.08.19 04:19, [email protected] wrote:
Quoted 1 line
From: John Hubbard <[email protected]>
...
If that's not the case (both here, and in 3 or 4 other patches in this series, then as you said, I should add NULL checks toput_user_pages()andput_user_pages_dirty_lock().
Quoted 7 lines
Quoted 4 lines
In this case it is not correct, but can easily be handled. The NULL case can occur only in an error case with the pages array filled partially or not at all.
I'd prefer something like the attached patch here.
I'm not an expert in this code and have not looked at it carefully but that patch does seem to be the better fix than forcing NULL checks on everyone.
OK, I'll use Juergen's approach, and also check for that pattern in the other patches.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
PATCH 21/34 fs/exec.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c +1 -1
@@ -227,7 +227,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,static void put_arg_page (struct page *page) { -put_page (page); +put_user_page (page); }static void free_arg_pages (struct linux_binprm *bprm)
Signature · 1 line
2.22.0
PATCH 22/34 orangefs: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- fs/orangefs/orangefs-bufmap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/orangefs/orangefs-bufmap.c +2 -5
@@ -168,10 +168,7 @@ static DEFINE_SPINLOCK(orangefs_bufmap_lock);static void orangefs_bufmap_unmap (struct orangefs_bufmap *bufmap) { -int i; - -for (i =0 ; i < bufmap->page_count; i++) -put_page (bufmap->page_array[i]); +put_user_pages (bufmap->page_array, bufmap->page_count); } static void
@@ -280,7 +277,7 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap,for (i =0 ; i < ret; i++) {SetPageError (bufmap->page_array[i]); -put_page (bufmap->page_array[i]); +put_user_page (bufmap->page_array[i]); }return -ENOMEM ; }
Signature · 1 line
2.22.0
PATCH 23/34 uprobes: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- kernel/events/uprobes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/events/uprobes.c +3 -3
@@ -397,7 +397,7 @@ __update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d) ret =0 ; out:kunmap_atomic (kaddr); -put_page (page); +put_user_page (page);return ret; }
@@ -504,7 +504,7 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, ret =__replace_page (vma, vaddr, old_page, new_page);put_page (new_page); put_old: -put_page (old_page); +put_user_page (old_page);if (unlikely (ret == -EAGAIN )) goto retry;
@@ -1981,7 +1981,7 @@ static int is_trap_at_addr(struct mm_struct *mm, unsigned long vaddr)return result;copy_from_page (page, vaddr, &opcode,UPROBE_SWBP_INSN_SIZE ); -put_page (page); +put_user_page (page); out:/* This needs to return true for any variant of the trap insn */ return is_trap_insn (&opcode);
Signature · 1 line
2.22.0
PATCH 24/34 futex: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- kernel/futex.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/futex.c +5 -5
@@ -623,7 +623,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_alock_page (page); shmem_swizzled =PageSwapCache (page) || page->mapping;unlock_page (page); -put_page (page); +put_user_page (page);if (shmem_swizzled) goto again;
@@ -675,7 +675,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_aif (READ_ONCE (page->mapping) != mapping) {rcu_read_unlock (); -put_page (page); +put_user_page (page); goto again; }
@@ -683,7 +683,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a inode =READ_ONCE (mapping->host);if (!inode) {rcu_read_unlock (); -put_page (page); +put_user_page (page); goto again; }
@@ -702,7 +702,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a*/ if (!atomic_inc_not_zero (&inode->i_count)) {rcu_read_unlock (); -put_page (page); +put_user_page (page); goto again; }
@@ -723,7 +723,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, enum futex_a } out: -put_page (page); +put_user_page (page);return err; }
Signature · 1 line
2.22.0
PATCH 25/34 mm/frame_vector.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- mm/frame_vector.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/frame_vector.c +1 -3
@@ -120,7 +120,6 @@ EXPORT_SYMBOL(get_vaddr_frames);*/ void put_vaddr_frames (struct frame_vector *vec) { -int i;struct page **pages;if (!vec->got_ref)
@@ -133,8 +132,7 @@ void put_vaddr_frames(struct frame_vector *vec)*/ if (WARN_ON (IS_ERR (pages))) goto out; -for (i =0 ; i < vec->nr_frames; i++) -put_page (pages[i]); +put_user_pages (pages, vec->nr_frames); vec->got_ref = false; out: vec->nr_frames =0 ;
Signature · 1 line
2.22.0
PATCH 26/34 mm/gup_benchmark.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- mm/gup_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/gup_benchmark.c +1 -1
@@ -79,7 +79,7 @@ static int __gup_benchmark_ioctl(unsigned int cmd,for (i =0 ; i < nr_pages; i++) {if (!pages[i])break ; -put_page (pages[i]); +put_user_page (pages[i]); } end_time =ktime_get (); gup->put_delta_usec =ktime_us_delta (end_time, start_time);
Signature · 1 line
2.22.0
Re: [PATCH 26/34] mm/gup_benchmark.c: convert put_page() to put_user_page*()
Quoted 9 lines · On Thu, Aug 01, 2019 at 07:19:57PM -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").
Quoted 7 lines
Cc Dan Carpenter <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Keith Busch <[email protected]>Cc Kirill A. Shutemov <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc YueHaibing <[email protected]>Signed-off-by John Hubbard <[email protected]>
Looks fine.
Quoted 9 lines
mm/gup_benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/gup_benchmark.c +0
-0
mm/gup_benchmark.c static int __gup_benchmark_ioctl(unsigned int cmd, · line 85
Quoted 8 lines
mm/gup_benchmark.c +1
-1@@ -79,7 +79,7 @@ static int __gup_benchmark_ioctl(unsigned int cmd,for (i =0 ; i < nr_pages; i++) {if (!pages[i])break ; -put_page (pages[i]); +put_user_page (pages[i]); } end_time =ktime_get (); gup->put_delta_usec =ktime_us_delta (end_time, start_time);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 27/34 mm/memory.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory.c +1 -1
@@ -4337,7 +4337,7 @@ int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm, buf, maddr + offset, bytes); }kunmap (page); -put_page (page); +put_user_page (page); } len -= bytes; buf += bytes;
Signature · 6 lines
2.22.0 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 28/34 mm/madvise.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/madvise.c +1 -1
@@ -672,7 +672,7 @@ static int madvise_inject_error(int behavior,* routine is responsible for pinning the page to prevent it * from being released back to the page allocator. */ -put_page (page); +put_user_page (page); ret =memory_failure (pfn,0 );if (ret)return ret;
Signature · 6 lines
2.22.0 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 29/34 mm/process_vm_access.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- mm/process_vm_access.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
mm/process_vm_access.c +9 -9
@@ -96,7 +96,7 @@ static int process_vm_rw_single_vec(unsigned long addr, flags |=FOLL_WRITE ;while (!rc && nr_pages &&iov_iter_count (iter)) { -int pages =min (nr_pages, max_pages_per_loop); +int pinned_pages =min (nr_pages, max_pages_per_loop);int locked =1 ;size_t bytes;
@@ -106,14 +106,15 @@ static int process_vm_rw_single_vec(unsigned long addr,* current/current->mm */ down_read (&mm->mmap_sem); - pages =get_user_pages_remote (task, mm, pa, pages, flags, - process_pages,NULL , &locked); + pinned_pages =get_user_pages_remote (task, mm, pa, pinned_pages, + flags, process_pages,NULL , + &locked);if (locked)up_read (&mm->mmap_sem); -if (pages <=0 ) +if (pinned_pages <=0 )return -EFAULT ; - bytes = pages *PAGE_SIZE - start_offset; + bytes = pinned_pages *PAGE_SIZE - start_offset;if (bytes > len) bytes = len;
@@ -122,10 +123,9 @@ static int process_vm_rw_single_vec(unsigned long addr, vm_write); len -= bytes; start_offset =0 ; - nr_pages -= pages; - pa += pages *PAGE_SIZE ; -while (pages) -put_page (process_pages[--pages]); + nr_pages -= pinned_pages; + pa += pinned_pages *PAGE_SIZE ; +put_user_pages (process_pages, pinned_pages); }return rc;
Signature · 1 line
2.22.0
PATCH 30/34 crypt: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- crypto/af_alg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
crypto/af_alg.c +2 -5
@@ -428,10 +428,7 @@ static void af_alg_link_sg(struct af_alg_sgl *sgl_prev,void af_alg_free_sg (struct af_alg_sgl *sgl) { -int i; - -for (i =0 ; i < sgl->npages; i++) -put_page (sgl->pages[i]); +put_user_pages (sgl->pages, sgl->npages); }EXPORT_SYMBOL_GPL (af_alg_free_sg);
@@ -668,7 +665,7 @@ static void af_alg_free_areq_sgls(struct af_alg_async_req *areq)for_each_sg (tsgl, sg, areq->tsgl_entries, i) {if (!sg_page (sg))continue ; -put_page (sg_page (sg)); +put_user_page (sg_page (sg)); }sock_kfree_s (sk, tsgl, areq->tsgl_entries *sizeof (*tsgl));
Signature · 1 line
2.22.0
PATCH 31/34 nfs: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- fs/nfs/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfs/direct.c +1 -3
@@ -278,9 +278,7 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)static void nfs_direct_release_pages (struct page **pages,unsigned int npages) { -unsigned int i; -for (i =0 ; i < npages; i++) -put_page (pages[i]); +put_user_pages (pages, npages); } void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo,
Signature · 1 line
2.22.0
Re: [PATCH 31/34] nfs: convert put_page() to put_user_page*()
Quoted 22 lines · On 02/08/2019 3:20 am, [email protected] wrote:
From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via
put_page()orrelease_pages().This is part a tree-wide conversion, as described in commit
fc1d8e7cca2d("mm: introduce put_user_page*(), placeholder versions").Cc Trond Myklebust <[email protected]>Cc Anna Schumaker <[email protected]>Signed-off-by John Hubbard <[email protected]>--- fs/nfs/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/nfs/direct.c +0
-0
fs/nfs/direct.c ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · line 282
Quoted 8 lines
fs/nfs/direct.c +1
-3@@ -278,9 +278,7 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)static void nfs_direct_release_pages (struct page **pages,unsigned int npages) { -unsigned int i; -for (i =0 ; i < npages; i++) -put_page (pages[i]); +put_user_pages (pages, npages); }
Since it's static, and only called twice, might it be better to change its two callers [nfs_direct_{read,write}_schedule_iovec()] to call put_user_pages() directly, and remove nfs_direct_release_pages() entirely?
thanks,
calum.
Quoted 3 lines
fs/nfs/direct.c +0
-0void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo,
John Hubbard
reviewerRe: [PATCH 31/34] nfs: convert put_page() to put_user_page*()
Quoted 1 line · Calum Mackay
On 02/08/2019 3:20 am, [email protected] wrote:
...
Quoted 8 lines
Since it's static, and only called twice, might it be better to change its two callers [nfs_direct_{read,write}_schedule_iovec()] to call
put_user_pages()directly, and removenfs_direct_release_pages()entirely?thanks,
calum.Quoted 2 lines
void nfs_init_cinfo_from_dreq(struct
nfs_commit_info*cinfo,
Hi Calum,
Absolutely! Is it OK to add your reviewed-by, with the following incremental patch made to this one?
fs/nfs/direct.c +2 -7
@@ -276,11 +276,6 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)return nfs_file_direct_write (iocb, iter); } -static void nfs_direct_release_pages (struct page **pages,unsigned int npages) -{ -put_user_pages (pages, npages); -} -void nfs_init_cinfo_from_dreq (struct nfs_commit_info *cinfo,struct nfs_direct_req *dreq) {
@@ -510,7 +505,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, pos += req_len; dreq->bytes_left -= req_len; } -nfs_direct_release_pages (pagevec, npages); +put_user_pages (pagevec, npages);kvfree (pagevec);if (result <0 )break ;
@@ -933,7 +928,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, pos += req_len; dreq->bytes_left -= req_len; } -nfs_direct_release_pages (pagevec, npages); +put_user_pages (pagevec, npages);kvfree (pagevec);if (result <0 )break ;
thanks,
Signature · 6 lines
John Hubbard NVIDIA _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Calum Mackay
Reviewed-byRe: [PATCH 31/34] nfs: convert put_page() to put_user_page*()
Quoted 9 lines · John Hubbard
Quoted 1 line · Calum Mackay
On 02/08/2019 3:20 am, [email protected] wrote:
...
Quoted 6 lines
Since it's static, and only called twice, might it be better to change its two callers [nfs_direct_{read,write}_schedule_iovec()] to call
put_user_pages()directly, and removenfs_direct_release_pages()entirely?thanks,
calum.
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
void nfs_init_cinfo_from_dreq(struct
nfs_commit_info*cinfo,Hi Calum,
Absolutely! Is it OK to add your reviewed-by, with the following incremental patch made to this one?
Thanks John; looks good.
Quoted 38 lines
fs/nfs/direct.c +2
-7@@ -276,11 +276,6 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)return nfs_file_direct_write (iocb, iter); } -static void nfs_direct_release_pages (struct page **pages,unsigned int npages) -{ -put_user_pages (pages, npages); -} -void nfs_init_cinfo_from_dreq (struct nfs_commit_info *cinfo,struct nfs_direct_req *dreq) {@@ -510,7 +505,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, pos += req_len; dreq->bytes_left -= req_len; } -nfs_direct_release_pages (pagevec, npages); +put_user_pages (pagevec, npages);kvfree (pagevec);if (result <0 )break ;@@ -933,7 +928,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, pos += req_len; dreq->bytes_left -= req_len; } -nfs_direct_release_pages (pagevec, npages); +put_user_pages (pagevec, npages);kvfree (pagevec);if (result <0 )break ;
Quoted 2 lines
thanks,
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 32/34 goldfish_pipe: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
Note that this effectively changes the code's behavior in qp_release_pages(): it now ultimately calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate.
As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1]
[1] https://lore.kernel.org/r/[email protected]
--- drivers/platform/goldfish/goldfish_pipe.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/platform/goldfish/goldfish_pipe.c +3 -6
@@ -288,15 +288,12 @@ static int pin_user_pages(unsigned long first_page,static void release_user_pages (struct page **pages,int pages_count,int is_write,s32 consumed_size) { -int i; +bool dirty = !is_write && consumed_size >0 ; -for (i =0 ; i < pages_count; i++) { -if (!is_write && consumed_size >0 ) -set_page_dirty (pages[i]); -put_page (pages[i]); - } +put_user_pages_dirty_lock (pages, pages_count, dirty); } +/* Populate the call parameters, merging adjacent pages together */ static void populate_rw_params(struct page **pages, int pages_count,
Signature · 1 line
2.22.0
PATCH 33/34 kernel/events/core.c: convert put_page() to put_user_page*()
In reply to [email protected]From: John Hubbard <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
--- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/core.c +1 -1
@@ -6426,7 +6426,7 @@ static u64 perf_virt_to_phys(u64 virt) phys_addr =page_to_phys (p) + virt %PAGE_SIZE ;if (p) -put_page (p); +put_user_page (p); }return phys_addr;
Signature · 1 line
2.22.0
PATCH 34/34 fs/binfmt_elf: convert put_page() to put_user_page*()
In reply to [email protected]From: Ira Weiny <[email protected]>
For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages().
This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions").
get_dump_page calls get_user_page so put_user_page must be used to match.
--- fs/binfmt_elf.c | 2 +- fs/binfmt_elf_fdpic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/binfmt_elf.c +1 -1
@@ -2377,7 +2377,7 @@ static int elf_core_dump(struct coredump_params *cprm)void *kaddr =kmap (page); stop = !dump_emit (cprm, kaddr,PAGE_SIZE );kunmap (page); -put_page (page); +put_user_page (page); }else stop = !dump_skip (cprm,PAGE_SIZE );if (stop)
fs/binfmt_elf_fdpic.c +1 -1
@@ -1511,7 +1511,7 @@ static bool elf_fdpic_dump_segments(struct coredump_params *cprm)void *kaddr =kmap (page); res =dump_emit (cprm, kaddr,PAGE_SIZE );kunmap (page); -put_page (page); +put_user_page (page); }else { res =dump_skip (cprm,PAGE_SIZE ); }
Signature · 1 line
2.22.0
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]
Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Signature · 6 lines
Michal Hocko SUSE Labs _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Jan Kara
reviewerQuoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.
Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say vaddr_pin_pages() - and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named as unpin_page() or whatever instead of put_user_page(). Sure this is not completely foolproof (you can create new callsite using vaddr_pin_pages() and then just drop refs using put_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?
Honza
Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Quoted 8 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?
I think the API we really need is get_user_bvec() / put_user_bvec(), and I know Christoph has been putting some work into that. That avoids doing refcount operations on hundreds of pages if the page in question is a huge page. Once people are switched over to that, they won't be tempted to manually call put_page() on the individual constituent pages of a bvec.
Jan Kara
reviewerQuoted 26 lines · Matthew Wilcox
Quoted 16 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Quoted 8 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?
Quoted 5 lines
I think the API we really need is
get_user_bvec()/put_user_bvec(), and I know Christoph has been putting some work into that. That avoids doing refcount operations on hundreds of pages if the page in question is a huge page. Once people are switched over to that, they won't be tempted to manually callput_page()on the individual constituent pages of a bvec.
Well, get_user_bvec() is certainly a good API for one class of users but just looking at the above series, you'll see there are *many* places that just don't work with bvecs at all and you need something for those.
Honza
Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
John Hubbard
reviewerQuoted 9 lines · Jan Kara
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Hi Michal,
Yes, I've thought about it, and coccinelle falls a bit short (it's not smart enough to know which put_page()'s to convert). However, there is a debug option planned: a yet-to-be-posted commit [1] uses struct page extensions (obviously protected by CONFIG_DEBUG_GET_USER_PAGES_REFERENCES) to add a redundant counter. That allows:
void __put_page(struct page *page)
{
...
/* Someone called put_page() instead of put_user_page() */
WARN_ON_ONCE(atomic_read(&page_ext->pin_count) > 0);Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?
The debug option above is still a bit simplistic in its implementation (and maybe not taking full advantage of the data it has), but I think it's preferable, because it monitors the "core" and WARNs.
Instead of the wrapper, I'm thinking: documentation and the passage of time, plus the debug option (perhaps enhanced--probably once I post it someone will notice opportunities), yes?
Quoted 11 lines
Quoted 6 lines
I think the API we really need is
get_user_bvec()/put_user_bvec(), and I know Christoph has been putting some work into that. That avoids doing refcount operations on hundreds of pages if the page in question is a huge page. Once people are switched over to that, they won't be tempted to manually callput_page()on the individual constituent pages of a bvec.Well,
get_user_bvec()is certainly a good API for one class of users but just looking at the above series, you'll see there are *many* places that just don't work with bvecs at all and you need something for those.
Yes, there are quite a few places that don't involve _bvec, as we can see right here. So we need something. Andrew asked for a debug option some time ago, and several people (Dave Hansen, Dan Williams, Jerome) had the idea of vmap-ing gup pages separately, so you can definitely tell where each page came from. I'm hoping not to have to go to that level of complexity though.
[1] "mm/gup: debug tracking of get_user_pages() references" :
https://github.com/johnhubbard/linux/commit/21ff7d6161ec2a14d3f9d17c98abb00cc969d4d6
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Jan Kara
reviewerQuoted 43 lines · John Hubbard
Quoted 9 lines · Jan Kara
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Hi Michal,
Yes, I've thought about it, and coccinelle falls a bit short (it's not smart enough to know which put_page()'s to convert). However, there is a debug option planned: a yet-to-be-posted commit [1] uses struct page extensions (obviously protected by
CONFIG_DEBUG_GET_USER_PAGES_REFERENCES) to add a redundant counter. That allows:void
__put_page(struct page *page){ ... /* Someone called put_page() instead of put_user_page() */ WARN_ON_ONCE(atomic_read(&page_ext->pin_count) > 0);Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?
Quoted 7 lines
The debug option above is still a bit simplistic in its implementation (and maybe not taking full advantage of the data it has), but I think it's preferable, because it monitors the "core" and WARNs.
Instead of the wrapper, I'm thinking: documentation and the passage of time, plus the debug option (perhaps enhanced--probably once I post it someone will notice opportunities), yes?
So I think your debug option and my suggested renaming serve a bit different purposes (and thus both make sense). If you do the renaming, you can just grep to see unconverted sites. Also when someone merges new GUP user (unaware of the new rules) while you switch GUP to use pins instead of ordinary references, you'll get compilation error in case of renaming instead of hard to debug refcount leak without the renaming. And such conflict is almost bound to happen given the size of GUP patch set... Also the renaming serves against the "coding inertia" - i.e., GUP is around for ages so people just use it without checking any documentation or comments. After switching how GUP works, what used to be correct isn't anymore so renaming the function serves as a warning that something has really changed.
Your refcount debug patches are good to catch bugs in the conversions done but that requires you to be able to excercise the code path in the first place which may require particular HW or so, and you also have to enable the debug option which means you already aim at verifying the GUP references are treated properly.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 52 lines · Jan Kara
Quoted 43 lines · John Hubbard
Quoted 9 lines · Jan Kara
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Hi Michal,
Yes, I've thought about it, and coccinelle falls a bit short (it's not smart enough to know which put_page()'s to convert). However, there is a debug option planned: a yet-to-be-posted commit [1] uses struct page extensions (obviously protected by
CONFIG_DEBUG_GET_USER_PAGES_REFERENCES) to add a redundant counter. That allows:void
__put_page(struct page *page){ ... /* Someone called put_page() instead of put_user_page() */ WARN_ON_ONCE(atomic_read(&page_ext->pin_count) > 0);Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?Quoted 7 lines
The debug option above is still a bit simplistic in its implementation (and maybe not taking full advantage of the data it has), but I think it's preferable, because it monitors the "core" and WARNs.
Instead of the wrapper, I'm thinking: documentation and the passage of time, plus the debug option (perhaps enhanced--probably once I post it someone will notice opportunities), yes?
Quoted 12 lines
So I think your debug option and my suggested renaming serve a bit different purposes (and thus both make sense). If you do the renaming, you can just grep to see unconverted sites. Also when someone merges new GUP user (unaware of the new rules) while you switch GUP to use pins instead of ordinary references, you'll get compilation error in case of renaming instead of hard to debug refcount leak without the renaming. And such conflict is almost bound to happen given the size of GUP patch set... Also the renaming serves against the "coding inertia" - i.e., GUP is around for ages so people just use it without checking any documentation or comments. After switching how GUP works, what used to be correct isn't anymore so renaming the function serves as a warning that something has really changed.
Fully agreed!
Quoted 11 lines
Your refcount debug patches are good to catch bugs in the conversions done but that requires you to be able to excercise the code path in the first place which may require particular HW or so, and you also have to enable the debug option which means you already aim at verifying the GUP references are treated properly.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 66 lines · Michal Hocko
Quoted 52 lines · Jan Kara
Quoted 43 lines · John Hubbard
Quoted 9 lines · Jan Kara
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Jan Kara
Quoted 6 lines · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]Quoted 3 lines
2) Convert all of the call sites for get_user_pages*(), to invoke put_user_page*(), instead of
put_page(). This involves dozens of call sites, and will take some time.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
How do we make sure this is the case and it will remain the case in the future? There must be some automagic to enforce/check that. It is simply not manageable to do it every now and then because then 3) will simply be never safe.
Have you considered coccinele or some other scripted way to do the transition? I have no idea how to deal with future changes that would break the balance though.
Hi Michal,
Yes, I've thought about it, and coccinelle falls a bit short (it's not smart enough to know which put_page()'s to convert). However, there is a debug option planned: a yet-to-be-posted commit [1] uses struct page extensions (obviously protected by
CONFIG_DEBUG_GET_USER_PAGES_REFERENCES) to add a redundant counter. That allows:void
__put_page(struct page *page){ ... /* Someone called put_page() instead of put_user_page() */ WARN_ON_ONCE(atomic_read(&page_ext->pin_count) > 0);Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Yeah, that's why I've been suggesting at LSF/MM that we may need to create a gup wrapper - say
vaddr_pin_pages()- and track which sites dropping references got converted by using this wrapper instead of gup. The counterpart would then be more logically named asunpin_page()or whatever instead ofput_user_page(). Sure this is not completely foolproof (you can create new callsite usingvaddr_pin_pages()and then just drop refs usingput_page()) but I suppose it would be a high enough barrier for missed conversions... Thoughts?Quoted 7 lines
The debug option above is still a bit simplistic in its implementation (and maybe not taking full advantage of the data it has), but I think it's preferable, because it monitors the "core" and WARNs.
Instead of the wrapper, I'm thinking: documentation and the passage of time, plus the debug option (perhaps enhanced--probably once I post it someone will notice opportunities), yes?
Quoted 12 lines
So I think your debug option and my suggested renaming serve a bit different purposes (and thus both make sense). If you do the renaming, you can just grep to see unconverted sites. Also when someone merges new GUP user (unaware of the new rules) while you switch GUP to use pins instead of ordinary references, you'll get compilation error in case of renaming instead of hard to debug refcount leak without the renaming. And such conflict is almost bound to happen given the size of GUP patch set... Also the renaming serves against the "coding inertia" - i.e., GUP is around for ages so people just use it without checking any documentation or comments. After switching how GUP works, what used to be correct isn't anymore so renaming the function serves as a warning that something has really changed.
Quoted 1 line
Fully agreed!
Ok Prior to this I've been basing all my work for the RDMA/FS DAX stuff in Johns put_user_pages()... (Including when I proposed failing truncate with a lease in June [1])
However, based on the suggestions in that thread it became clear that a new interface was going to need to be added to pass in the "RDMA file" information to GUP to associate file pins with the correct processes...
I have many drawings on my white board with "a whole lot of lines" on them to make sure that if a process opens a file, mmaps it, pins it with RDMA, _closes_ it, and ummaps it; that the resulting file pin can still be traced back to the RDMA context and all the processes which may have access to it.... No matter where the original context may have come from. I believe I have accomplished that.
Before I go on, I would like to say that the "imbalance" of get_user_pages() and put_page() bothers me from a purist standpoint... However, since this discussion cropped up I went ahead and ported my work to Linus' current master (5.3-rc3+) and in doing so I only had to steal a bit of Johns code... Sorry John... :-(
I don't have the commit messages all cleaned up and I know there may be some discussion on these new interfaces but I wanted to throw this series out there because I think it may be what Jan and Michal are driving at (or at least in that direction.
Right now only RDMA and DAX FS's are supported. Other users of GUP will still fail on a DAX file and regular files will still be at risk.[2]
I've pushed this work (based 5.3-rc3+ (33920f1ec5bf)) here[3]:
https://github.com/weiny2/linux-kernel/tree/linus-rdmafsdax-b0-v3
I think the most relevant patch to this conversation is:
https://github.com/weiny2/linux-kernel/commit/5d377653ba5cf11c3b716f904b057bee6641aaf6
I stole Jans suggestion for a name as the name I used while prototyping was pretty bad... So Thanks Jan... ;-)
Also thanks to John for his contribution on some of this. I'm still tweaking put_user_pages under the hood on the DAX path.
Ira
[1] https://lwn.net/Articles/790544/
[2] I've been looking into how to support io_uring next but I've had some issue getting a test program to actually call GUP in that code path... :-(
[3] If it would be easier I can just throw an RFC on the list but right now the cover letter and some of the commit messages are full of the old stuff and various ideas I have had...
Quoted 16 lines
Quoted 12 lines
Your refcount debug patches are good to catch bugs in the conversions done but that requires you to be able to excercise the code path in the first place which may require particular HW or so, and you also have to enable the debug option which means you already aim at verifying the GUP references are treated properly.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CRSignature · 2 lines
Michal Hocko SUSE Labs
John Hubbard
reviewerQuoted 8 lines · Ira Weiny
Quoted 7 lines · Michal Hocko
Quoted 6 lines · Jan Kara
Quoted 5 lines · John Hubbard
Quoted 4 lines · Jan Kara
Quoted 3 lines · Matthew Wilcox
Quoted 2 lines · Jan Kara
Quoted 1 line · Michal Hocko
On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]
Quoted 14 lines
Before I go on, I would like to say that the "imbalance" of
get_user_pages()andput_page()bothers me from a purist standpoint... However, since this discussion cropped up I went ahead and ported my work to Linus' current master (5.3-rc3+) and in doing so I only had to steal a bit of Johns code... Sorry John... :-(I don't have the commit messages all cleaned up and I know there may be some discussion on these new interfaces but I wanted to throw this series out there because I think it may be what Jan and Michal are driving at (or at least in that direction.
Right now only RDMA and DAX FS's are supported. Other users of GUP will still fail on a DAX file and regular files will still be at risk.[2]
Quoted 8 lines
I've pushed this work (based 5.3-rc3+ (
33920f1ec5bf)) here[3]:https://github.com/weiny2/linux-kernel/tree/linus-rdmafsdax-b0-v3
I think the most relevant patch to this conversation is:
https://github.com/weiny2/linux-kernel/commit/5d377653ba5cf11c3b716f904b057bee6641aaf6
ohhh...can you please avoid using the old __put_user_pages_dirty() function? I thought I'd caught things early enough to get away with the rename and deletion of that. You could either:
a) open code an implementation of vaddr_put_pages_dirty_lock() that doesn't call any of the *put_user_pages_dirty*() variants, or
b) include my first patch ("") are part of your series, or
c) base this on Andrews's tree, which already has merged in my first patch.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 33 lines · Ira Weiny
Quoted 8 lines · Michal Hocko
Quoted 7 lines · Jan Kara
Quoted 6 lines · John Hubbard
Quoted 5 lines · Jan Kara
Quoted 4 lines · Matthew Wilcox
Quoted 3 lines · Jan Kara
Quoted 2 lines · Michal Hocko
Quoted 1 line · On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]
Quoted 22 lines
Before I go on, I would like to say that the "imbalance" of
get_user_pages()andput_page()bothers me from a purist standpoint... However, since this discussion cropped up I went ahead and ported my work to Linus' current master
(5.3-rc3+) and in doing so I only had to steal a bit of Johns code... Sorry John... :-(I don't have the commit messages all cleaned up and I know there may be some discussion on these new interfaces but I wanted to throw this series out there because I think it may be what Jan and Michal are driving at (or at least in that direction.
Right now only RDMA and DAX FS's are supported. Other users of GUP will still fail on a DAX file and regular files will still be at risk.[2]
I've pushed this work (based 5.3-rc3+ (
33920f1ec5bf)) here[3]:https://github.com/weiny2/linux-kernel/tree/linus-rdmafsdax-b0-v3
I think the most relevant patch to this conversation is:
Quoted 7 lines
Quoted 1 line
kernel/commit/5d377653ba5cf11c3b716f90Quoted 2 lines
4b057bee6641aaf6ohhh...can you please avoid using the old
__put_user_pages_dirty()function?
Agreed... I did not like that. Part of the reason I did not post this is I'm still trying to figure out what has landed and what I can and can't depend on.
For example, Christoph H. was proposing changes to some of the GUP calls which may conflict. But I'm not sure his changes are moving forward. So rather than waiting for the dust to settle I decided to see how hard it would be to get this rebased against mainline and working. Turns out it was not too hard.
I think that is because, as time has moved on it seems that, for some users such as RDMA, a simple put_user_page() is not going to be sufficient. We need something else to allow GUP to keep track of the file pins as we discussed. So I'm starting to think some of this could go in at the same time.
Quoted 10 lines
I thought I'd caught things early enough to get away with the rename and deletion of that. You could either:
a) open code an implementation of
vaddr_put_pages_dirty_lock()that doesn't call any of the *put_user_pages_dirty*() variants, orb) include my first patch ("") are part of your series, or
c) base this on Andrews's tree, which already has merged in my first patch.
Yep I can do this. I did not realize that Andrew had accepted any of this work. I'll check out his tree. But I don't think he is going to accept this series through his tree. So what is the ETA on that landing in Linus' tree?
To that point I'm still not sure who would take all this as I am now touching mm, procfs, rdma, ext4, and xfs.
I just thought I would chime in with my progress because I'm to a point where things are working and so I can submit the code but I'm not sure what I can/should depend on landing... Also, now that 0day has run overnight it has found issues with this rebase so I need to clean those up... Perhaps I will base on Andrew's tree prior to doing that...
Thanks,
Ira
Quoted 5 lines
thanks,
--
John Hubbard
NVIDIA
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
John Hubbard
reviewerQuoted 4 lines · Ira
Quoted 4 lines · Ira Weiny
Quoted 2 lines · Michal Hocko
Quoted 1 line · Jan Kara
Quoted 9 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · John Hubbard
Quoted 5 lines · Jan Kara
Quoted 4 lines · Matthew Wilcox
Quoted 3 lines · Jan Kara
Quoted 2 lines · Michal Hocko
Quoted 1 line · On Thu 01-08-19 19:19:31, [email protected] wrote:
[...]
Yep I can do this. I did not realize that Andrew had accepted any of this work. I'll check out his tree. But I don't think he is going to accept this series through his tree. So what is the ETA on that landing in Linus' tree?
I'd expect it to go into 5.4, according to my understanding of how the release cycles are arranged.
Quoted 3 lines
To that point I'm still not sure who would take all this as I am now touching mm, procfs, rdma, ext4, and xfs.
I just thought I would chime in with my progress because I'm to a point where things are working and so I can submit the code but I'm not sure what I can/should depend on landing... Also, now that 0day has run overnight it has found issues with this rebase so I need to clean those up... Perhaps I will base on Andrew's tree prior to doing that...
I'm certainly not the right person to answer, but in spite of that, I'd think Andrew's tree is a reasonable place for it. Sort of.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Jan Kara
reviewerQuoted 11 lines · Ira
Quoted 10 lines
I thought I'd caught things early enough to get away with the rename and deletion of that. You could either:
a) open code an implementation of
vaddr_put_pages_dirty_lock()that doesn't call any of the *put_user_pages_dirty*() variants, orb) include my first patch ("") are part of your series, or
c) base this on Andrews's tree, which already has merged in my first patch.
Quoted 7 lines
Yep I can do this. I did not realize that Andrew had accepted any of this work. I'll check out his tree. But I don't think he is going to accept this series through his tree. So what is the ETA on that landing in Linus' tree?
To that point I'm still not sure who would take all this as I am now touching mm, procfs, rdma, ext4, and xfs.
MM tree would be one candidate for routing but there are other options that would make sense as well - Dan's tree, VFS tree, or even I can pickup the patches to my tree if needed. But let's worry about the routing after we have working and reviewed patches...
Honza
Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jan Kara
reviewerQuoted 47 lines · Ira Weiny
Quoted 13 lines · Michal Hocko
Quoted 4 lines
So I think your debug option and my suggested renaming serve a bit different purposes (and thus both make sense). If you do the renaming, you can just grep to see unconverted sites. Also when someone merges new GUP user (unaware of the new rules) while you switch GUP to use pins instead of
Quoted 8 lines
ordinary references, you'll get compilation error in case of renaming instead of hard to debug refcount leak without the renaming. And such conflict is almost bound to happen given the size of GUP patch set... Also the renaming serves against the "coding inertia" - i.e., GUP is around for ages so people just use it without checking any documentation or comments. After switching how GUP works, what used to be correct isn't anymore so renaming the function serves as a warning that something has really changed.
Quoted 1 line
Fully agreed!
Ok Prior to this I've been basing all my work for the RDMA/FS DAX stuff in Johns
put_user_pages()... (Including when I proposed failing truncate with a lease in June [1])However, based on the suggestions in that thread it became clear that a new interface was going to need to be added to pass in the "RDMA file" information to GUP to associate file pins with the correct processes...
I have many drawings on my white board with "a whole lot of lines" on them to make sure that if a process opens a file, mmaps it, pins it with RDMA, _closes_ it, and ummaps it; that the resulting file pin can still be traced back to the RDMA context and all the processes which may have access to it.... No matter where the original context may have come from. I believe I have accomplished that.
Before I go on, I would like to say that the "imbalance" of
get_user_pages()andput_page()bothers me from a purist standpoint... However, since this discussion cropped up I went ahead and ported my work to Linus' current master (5.3-rc3+) and in doing so I only had to steal a bit of Johns code... Sorry John... :-(I don't have the commit messages all cleaned up and I know there may be some discussion on these new interfaces but I wanted to throw this series out there because I think it may be what Jan and Michal are driving at (or at least in that direction.
Right now only RDMA and DAX FS's are supported. Other users of GUP will still fail on a DAX file and regular files will still be at risk.[2]
I've pushed this work (based 5.3-rc3+ (
33920f1ec5bf)) here[3]:
Quoted 8 lines
https://github.com/weiny2/linux-kernel/tree/linus-rdmafsdax-b0-v3
I think the most relevant patch to this conversation is:
https://github.com/weiny2/linux-kernel/commit/5d377653ba5cf11c3b716f904b057bee6641aaf6
I stole Jans suggestion for a name as the name I used while prototyping was pretty bad... So Thanks Jan... ;-)
For your function, I'd choose a name like vaddr_pin_leased_pages() so that association with a lease is clear from the name :) Also I'd choose the counterpart to be vaddr_unpin_leased_page[s](). Especially having put_page in the name looks confusing to me...
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 57 lines · Ira Weiny
Quoted 10 lines · Michal Hocko
Quoted 9 lines
Quoted 9 lines
So I think your debug option and my suggested renaming serve a bit different purposes (and thus both make sense). If you do the renaming, you can just grep to see unconverted sites. Also when someone merges new GUP user (unaware of the new rules) while you switch GUP to use pins instead of ordinary references, you'll get compilation error in case of renaming instead of hard to debug refcount leak without the renaming. And such conflict is almost bound to happen given the size of GUP patch set... Also the renaming serves against the "coding inertia" - i.e., GUP is around for
ages so people just use it without checking any documentation or comments.
Quoted 37 lines
Quoted 5 lines
Quoted 3 lines
After switching how GUP works, what used to be correct isn't anymore so renaming the function serves as a warning that something has really changed.
Fully agreed!
Ok Prior to this I've been basing all my work for the RDMA/FS DAX stuff in Johns
put_user_pages()... (Including when I proposed failing truncate with a lease in June [1])However, based on the suggestions in that thread it became clear that a new interface was going to need to be added to pass in the "RDMA file" information to GUP to associate file pins with the correct processes...
I have many drawings on my white board with "a whole lot of lines" on them to make sure that if a process opens a file, mmaps it, pins it with RDMA, _closes_ it, and ummaps it; that the resulting file pin can still be traced back to the RDMA context and all the processes which may have access to it.... No matter where the original context may have come from. I believe I have accomplished that.
Before I go on, I would like to say that the "imbalance" of
get_user_pages()andput_page()bothers me from a purist standpoint... However, since this discussion cropped up I went ahead and ported my work to Linus' current master
(5.3-rc3+) and in doing so I only had to steal a bit of Johns code... Sorry John... :-(I don't have the commit messages all cleaned up and I know there may be some discussion on these new interfaces but I wanted to throw this series out there because I think it may be what Jan and Michal are driving at (or at least in that direction.
Right now only RDMA and DAX FS's are supported. Other users of GUP will still fail on a DAX file and regular files will still be at risk.[2]
Quoted 7 lines
I've pushed this work (based 5.3-rc3+ (
33920f1ec5bf)) here[3]:https://github.com/weiny2/linux-kernel/tree/linus-rdmafsdax-b0-v3
I think the most relevant patch to this conversation is:
Quoted 8 lines
kernel/commit/5d377653ba5cf11c3b716f90Quoted 4 lines
4b057bee6641aaf6I stole Jans suggestion for a name as the name I used while prototyping was pretty bad... So Thanks Jan... ;-)
For your function, I'd choose a name like
vaddr_pin_leased_pages()so that association with a lease is clear from the name :)
My gut was to just change this as you suggested. But the fact is that these calls can get used on anonymous pages as well. So the "leased" semantic may not apply... OTOH if a file is encountered it will fail the pin... :-/ I'm going to leave it for now and get the patches submitted to the list...
Quoted 3 lines
Also I'd choose the
counterpart to be vaddr_unpin_leased_page[s](). Especially havingput_pagein the name looks confusing to me...
Ah yes, totally agree with the "pin/unpin" symmetry. I've changed from "put" to "unpin"...
Thanks,
Ira
Quoted 6 lines
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for put_user_pages(): miscellaneous call sites
In reply to [email protected]== Series Details ==
== Series Details ==
Series: put_user_pages(): miscellaneous call sites
URL : https://patchwork.freedesktop.org/series/64585/
State : failure
== Summary ==
Applying: mm/gup: add make_dirty arg to put_user_pages_dirty_lock()
Applying: net/rds: convert put_page() to put_user_page*()
Applying: net/ceph: convert put_page() to put_user_page*()
Applying: x86/kvm: convert put_page() to put_user_page*()
Applying: drm/etnaviv: convert release_pages() to put_user_pages()
Applying: drm/i915: convert put_page() to put_user_page*()
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/gem/i915_gem_userptr.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0006 drm/i915: convert put_page() to put_user_page*()
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx