[PATCH v11 21/25] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-12-16 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 9 ++--- tools/testing/selftests/vm/gup_benchmark.c | 6 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a

[PATCH v11 24/25] mm/gup_benchmark: support pin_user_pages() and related calls

2019-12-16 Thread John Hubbard
() returns false, then WARN and return. Do this outside of the benchmark timestamps, so that it doesn't affect reported times. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 65 -- tools/testing/selftests/vm/gup_benchmark.c

[PATCH v11 13/25] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-12-16 Thread John Hubbard
s for easier reading of process_vm_rw_single_vec(). Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/process_vm_access.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/proc

[PATCH v11 16/25] net/xdp: set FOLL_PIN via pin_user_pages()

2019-12-16 Thread John Hubbard
to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v11 07/25] vfio: fix FOLL_LONGTERM use, simplify get_user_pages_remote() call

2019-12-16 Thread John Hubbard
's no need for it at the VFIO call site. So remove it. Tested-by: Alex Williamson Acked-by: Alex Williamson Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_ty

[PATCH v11 20/25] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-12-16 Thread John Hubbard
1. Convert from get_user_pages() to pin_user_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- arch/powerpc/mm/book3s64/iommu_api.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[PATCH v11 12/25] IB/{core, hw, umem}: set FOLL_PIN via pin_user_pages*(), fix up ODP

2019-12-16 Thread John Hubbard
Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/core/umem_odp.c | 13 ++--- drivers/infiniband/hw/hfi1/user_pages.c | 2 +- drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +- drivers/infiniband/hw/qib/qib_user_pag

[PATCH v11 25/25] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-12-16 Thread John Hubbard
are fairly early in the run_vmtests script, because with test suites, it's usually preferable to put the shorter, faster tests first, all other things being equal. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed

[PATCH v11 23/25] mm/gup: track FOLL_PIN pages

2019-12-16 Thread John Hubbard
t/Articles/753027/ Reviewed-by: Jan Kara Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- Documentation/core-api/pin_user_pages.rst | 2 +- include/linux/mm.h| 83 - include/linux/mmzone.h

[PATCH v11 17/25] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-12-16 Thread John Hubbard
set_page_dirty_lock() if the CPU pages were potentially receiving data from the device. Reviewed-by: Christoph Hellwig Acked-by: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH v11 08/25] mm/gup: allow FOLL_FORCE for get_user_pages_fast()

2019-12-16 Thread John Hubbard
FOLL_FORCE to be set for get_user_pages_fast(). Fixes: 817be129e6f2 ("mm: validate get_user_pages_fast flags") Cc: Christoph Hellwig Reviewed-by: Leon Romanovsky Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) di

[PATCH v11 10/25] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-12-16 Thread John Hubbard
Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded upon it.) Reviewed-by: Jan Kara Reviewed-by: Mike Rapoport # Documentation Reviewed-by: Jérôme Glisse Cc: Jonathan Corbet Cc: Ira Weiny Signed-off-by: John Hubbard --- Documentation/cor

[PATCH v11 14/25] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-12-16 Thread John Hubbard
-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c index 3db000aacd26..37c5e572993a 100644 --- a/drivers/gpu/drm/via/via_dmablit.c

[PATCH v11 09/25] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-12-16 Thread John Hubbard
Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 7a3b99597ead..214e87aa609d 100644 --- a/drivers

[PATCH v11 18/25] media/v4l2-core: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-12-16 Thread John Hubbard
1. Change v4l2 from get_user_pages() to pin_user_pages(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Acked-by: Hans Verkuil Cc: Ira Weiny Signed-off-by: John Hubbard --- drivers/media/v4l2

[PATCH v11 03/25] mm: Cleanup __put_devmap_managed_page() vs ->page_free()

2019-12-16 Thread John Hubbard
p is only needed in the MEMORY_DEVICE_FSDAX case, but it does no harm in the MEMORY_DEVICE_DEVDAX and MEMORY_DEVICE_PCI_P2PDMA case. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Cc: Jan Kara Cc: Ira Weiny Signed-off-by: Dan Williams Signed-off-by: John Hubbard --- drivers/nvdimm/pm

[PATCH v11 00/25] mm/gup: track dma-pinned pages: FOLL_PIN

2019-12-16 Thread John Hubbard
() (Apr 30, 2018): https://lwn.net/Articles/753027/ Dan Williams (1): mm: Cleanup __put_devmap_managed_page() vs ->page_free() John Hubbard (24): mm/gup: factor out duplicate code from four routines mm/gup: move try_get_compound_head() to top, fix minor issues mm: devmap: refactor 1-based

[PATCH v11 01/25] mm/gup: factor out duplicate code from four routines

2019-12-16 Thread John Hubbard
the the successful end of each routine, to increment *nr. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Reviewed-by: Jan Kara Cc: Ira Weiny Cc: Christoph Hellwig Cc: Aneesh Kumar K.V Signed-off-by: John Hubbard --- mm/gup.c | 91 ++-- 1

[PATCH v11 11/25] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-12-16 Thread John Hubbard
.c instead of here, so just delete the local release_user_pages() entirely, and call put_user_pages_dirty_lock() directly, instead. [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldf

Re: [RFC PATCH] mm/gup: try_pin_compound_head() can be static

2019-12-17 Thread John Hubbard
page *page, + int refs) { struct page *head = try_get_compound_head(page, GUP_PIN_COUNTING_BIAS * refs); thanks, -- John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop

[PATCH v12 23/25] mm/gup: track FOLL_PIN pages

2019-12-17 Thread John Hubbard
t/Articles/753027/ Reviewed-by: Jan Kara Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- Hi, The kbuild test robot noticed that try_pin_compound_head() can be declared static, in mm/gup.c. This updated patch does that. thanks, John Hubb

[PATCH v10 19/25] vfio, mm: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-12-12 Thread John Hubbard
[1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Tested-by: Alex Williamson Acked-by: Alex Williamson Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_type1.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_i

[PATCH v10 06/25] mm: fix get_user_pages_remote()'s handling of FOLL_LONGTERM

2019-12-12 Thread John Hubbard
s to Jason Gunthorpe for pointing out a clean way to fix this, and to Dan Williams for helping clarify the DAX refactoring. Tested-by: Alex Williamson Acked-by: Alex Williamson Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse

[PATCH v10 09/25] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-12-12 Thread John Hubbard
Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 7a3b99597ead..214e87aa609d 100644 --- a/drivers

[PATCH v10 08/25] mm/gup: allow FOLL_FORCE for get_user_pages_fast()

2019-12-12 Thread John Hubbard
FOLL_FORCE to be set for get_user_pages_fast(). Fixes: 817be129e6f2 ("mm: validate get_user_pages_fast flags") Cc: Christoph Hellwig Reviewed-by: Leon Romanovsky Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) di

[PATCH v10 10/25] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-12-12 Thread John Hubbard
Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded upon it.) Reviewed-by: Jan Kara Reviewed-by: Mike Rapoport # Documentation Reviewed-by: Jérôme Glisse Cc: Jonathan Corbet Cc: Ira Weiny Signed-off-by: John Hubbard --- Documentation/cor

[PATCH v10 13/25] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-12-12 Thread John Hubbard
s for easier reading of process_vm_rw_single_vec(). Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/process_vm_access.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/proc

[PATCH v10 23/25] mm/gup: track FOLL_PIN pages

2019-12-12 Thread John Hubbard
t/Articles/753027/ Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- Documentation/core-api/pin_user_pages.rst | 2 +- include/linux/mm.h| 77 - include/linux/mmzone.h| 2 + include/linux/

[PATCH v10 02/25] mm/gup: move try_get_compound_head() to top, fix minor issues

2019-12-12 Thread John Hubbard
An upcoming patch uses try_get_compound_head() more widely, so move it to the top of gup.c. Also fix a tiny spelling error and a checkpatch.pl warning. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup.c | 29

[PATCH v10 07/25] vfio: fix FOLL_LONGTERM use, simplify get_user_pages_remote() call

2019-12-12 Thread John Hubbard
's no need for it at the VFIO call site. So remove it. Tested-by: Alex Williamson Acked-by: Alex Williamson Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_ty

[PATCH v10 25/25] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-12-12 Thread John Hubbard
are fairly early in the run_vmtests script, because with test suites, it's usually preferable to put the shorter, faster tests first, all other things being equal. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed

[PATCH v10 24/25] mm/gup_benchmark: support pin_user_pages() and related calls

2019-12-12 Thread John Hubbard
() returns false, then WARN and return. Do this outside of the benchmark timestamps, so that it doesn't affect reported times. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 65 -- tools/testing/selftests/vm/gup_benchmark.c

[PATCH v10 22/25] mm, tree-wide: rename put_user_page*() to unpin_user_page*()

2019-12-12 Thread John Hubbard
In order to provide a clearer, more symmetric API for pinning and unpinning DMA pages. This way, pin_user_pages*() calls match up with unpin_user_pages*() calls, and the API is a lot closer to being self-explanatory. Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- Documentation/core-api

[PATCH v10 03/25] mm: Cleanup __put_devmap_managed_page() vs ->page_free()

2019-12-12 Thread John Hubbard
p is only needed in the MEMORY_DEVICE_FSDAX case, but it does no harm in the MEMORY_DEVICE_DEVDAX and MEMORY_DEVICE_PCI_P2PDMA case. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Cc: Jan Kara Cc: Ira Weiny Signed-off-by: Dan Williams Signed-off-by: John Hubbard --- drivers/nvdimm/pm

[PATCH v10 20/25] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-12-12 Thread John Hubbard
1. Convert from get_user_pages() to pin_user_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- arch/powerpc/mm/book3s64/iommu_api.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[PATCH v10 00/25] mm/gup: track dma-pinned pages: FOLL_PIN

2019-12-12 Thread John Hubbard
C: Dec 12, 2018): https://lwn.net/Articles/774411/ [3] The trouble with get_user_pages() (Apr 30, 2018): https://lwn.net/Articles/753027/ Dan Williams (1): mm: Cleanup __put_devmap_managed_page() vs ->page_free() John Hubbard (24): mm/gup: factor out duplicate code from four routines

[PATCH v10 14/25] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-12-12 Thread John Hubbard
-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c index 3db000aacd26..37c5e572993a 100644 --- a/drivers/gpu/drm/via/via_dmablit.c

[PATCH v10 01/25] mm/gup: factor out duplicate code from four routines

2019-12-12 Thread John Hubbard
the the successful end of each routine, to increment *nr. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Reviewed-by: Jan Kara Cc: Ira Weiny Cc: Christoph Hellwig Cc: Aneesh Kumar K.V Signed-off-by: John Hubbard --- mm/gup.c | 91 ++-- 1

[PATCH v10 11/25] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-12-12 Thread John Hubbard
.c instead of here, so just delete the local release_user_pages() entirely, and call put_user_pages_dirty_lock() directly, instead. [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldf

[PATCH v10 04/25] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-12-12 Thread John Hubbard
wed-by: Dan Williams Reviewed-by: Jan Kara Signed-off-by: Ira Weiny Signed-off-by: John Hubbard --- include/linux/mm.h | 17 + mm/memremap.c | 16 ++-- mm/swap.c | 24 3 files changed, 39 insertions(+), 18 deletions(-) diff -

[PATCH v10 21/25] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-12-12 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 9 ++--- tools/testing/selftests/vm/gup_benchmark.c | 6 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a

[PATCH v10 12/25] IB/{core, hw, umem}: set FOLL_PIN via pin_user_pages*(), fix up ODP

2019-12-12 Thread John Hubbard
Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/core/umem_odp.c | 13 ++--- drivers/infiniband/hw/hfi1/user_pages.c | 2 +- drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +- drivers/infiniband/hw/qib/qib_user_pag

[PATCH v10 16/25] net/xdp: set FOLL_PIN via pin_user_pages()

2019-12-12 Thread John Hubbard
to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v10 18/25] media/v4l2-core: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-12-12 Thread John Hubbard
1. Change v4l2 from get_user_pages() to pin_user_pages(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Acked-by: Hans Verkuil Cc: Ira Weiny Signed-off-by: John Hubbard --- drivers/media/v4l2

[PATCH v10 17/25] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-12-12 Thread John Hubbard
set_page_dirty_lock() if the CPU pages were potentially receiving data from the device. Reviewed-by: Christoph Hellwig Acked-by: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH v10 05/25] goldish_pipe: rename local pin_user_pages() routine

2019-12-12 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "goldfish_pin_pages()". An upcoming patch will introduce a global pin_user_pages() function. Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John H

[PATCH v10 15/25] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-12-12 Thread John Hubbard
-by: John Hubbard --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 405be10da73d..9639ebc21e8a 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4521,7 +4521,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void

Re: [PATCH v9 10/25] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-12-11 Thread John Hubbard
On 12/11/19 12:57 PM, Jonathan Corbet wrote: > On Tue, 10 Dec 2019 18:53:03 -0800 > John Hubbard wrote: > >> Introduce pin_user_pages*() variations of get_user_pages*() calls, >> and also pin_longterm_pages*() variations. > > Just a couple of nits on the docu

Re: [GIT PULL] Please pull hmm changes

2019-12-05 Thread John Hubbard
tifier_mm notif_subscription (notif_sub) <- struct mmu_notifier notif_invalidate_desc <- struct mmu_notifier_range* notif_range_subscription (notif_range_sub) <- struct mmu_interval_notifier thanks, -- John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v8 20/26] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-12-09 Thread John Hubbard
On 12/9/19 2:53 PM, John Hubbard wrote: ... > @@ -212,10 +211,9 @@ static void mm_iommu_unpin(struct > mm_iommu_table_group_mem_t *mem) > if (!page) > continue; > > - if (mem->hpas[i] & MM_IOM

Re: [PATCH v9 23/25] mm/gup: track FOLL_PIN pages

2019-12-11 Thread John Hubbard
ed when you do try_grab_page() here anyway since that early check seems to be just a tiny optimization AFAICT. Honza Yes. I've removed it, good spot. thanks, -- John Hubbard NVIDIA __

Re: [PATCH v5 02/24] mm/gup: factor out duplicate code from four routines

2019-11-18 Thread John Hubbard
On 11/18/19 1:46 AM, Jan Kara wrote: > On Thu 14-11-19 21:53:18, John Hubbard wrote: >> There are four locations in gup.c that have a fair amount of code >> duplication. This means that changing one requires making the same >> changes in four places, not to mention readi

[PATCH v6 17/24] mm/gup: track FOLL_PIN pages

2019-11-19 Thread John Hubbard
t/Articles/753027/ Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Signed-off-by: John Hubbard --- Documentation/core-api/pin_user_pages.rst | 2 +- include/linux/mm.h| 86 +-- include/linux/mmzone.h| 2 + include/linux/page_ref.h

[PATCH v6 15/24] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-19 Thread John Hubbard
put_user_page() instead of put_page(). Therefore, in order to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- fs

[PATCH v6 22/24] mm/gup_benchmark: support pin_user_pages() and related calls

2019-11-19 Thread John Hubbard
false, then WARN and return. Do this outside of the benchmark timestamps, so that it doesn't affect reported times. Cc: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 65 -- tools/testing/selftests/vm/gup_benchmark.c | 15 - 2 files

[PATCH v6 24/24] mm, tree-wide: rename put_user_page*() to unpin_user_page*()

2019-11-19 Thread John Hubbard
In order to provide a clearer, more symmetric API for pinning and unpinning DMA pages. This way, pin_user_pages*() calls match up with unpin_user_pages*() calls, and the API is a lot closer to being self-explanatory. Signed-off-by: John Hubbard --- Documentation/core-api/pin_user_pages.rst

[PATCH v6 16/24] net/xdp: set FOLL_PIN via pin_user_pages()

2019-11-19 Thread John Hubbard
to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v6 20/24] powerpc: book3s64: convert to pin_user_pages() and put_user_page()

2019-11-19 Thread John Hubbard
m_pages() filled in. This is more accurate and should be a little safer from a maintenance point of view. [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Signed-off-by: John Hubbard --- arch/powerpc/mm/book3s64/iommu_api.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) d

[PATCH v6 07/24] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-11-19 Thread John Hubbard
And get rid of the mmap_sem calls, as part of that. Note that get_user_pages_fast() will, if necessary, fall back to __gup_longterm_unlocked(), which takes the mmap_sem as needed. Reviewed-by: Jan Kara Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Signed-off-by: John Hubbard

[PATCH v6 19/24] vfio, mm: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-11-19 Thread John Hubbard
[1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Cc: Alex Williamson Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_type1.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index c7a111ad9975..18

[PATCH v6 23/24] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-11-19 Thread John Hubbard
are fairly early in the run_vmtests script, because with test suites, it's usually preferable to put the shorter, faster tests first, all other things being equal. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed

[PATCH v6 21/24] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-11-19 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 9 ++--- tools/testing/selftests/vm/gup_benchmark.c | 6 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a

[PATCH v6 10/24] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-19 Thread John Hubbard
Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded upon it.) Reviewed-by: Jan Kara Reviewed-by: Mike Rapoport # Documentation Reviewed-by: Jérôme Glisse Cc: Jonathan Corbet Cc: Ira Weiny Signed-off-by: John Hubbard --- Documentation/cor

[PATCH v6 05/24] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-11-19 Thread John Hubbard
wed-by: Dan Williams Reviewed-by: Jan Kara Signed-off-by: Ira Weiny Signed-off-by: John Hubbard --- include/linux/mm.h | 27 --- mm/memremap.c | 16 ++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/include/linux/mm.h b/incl

[PATCH v6 06/24] goldish_pipe: rename local pin_user_pages() routine

2019-11-19 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "pin_goldfish_pages()". An upcoming patch will introduce a global pin_user_pages() function. Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John H

[PATCH v6 00/24] mm/gup: track dma-pinned pages: FOLL_PIN

2019-11-19 Thread John Hubbard
with get_user_pages() (Apr 30, 2018): https://lwn.net/Articles/753027/ Dan Williams (1): mm: Cleanup __put_devmap_managed_page() vs ->page_free() John Hubbard (23): mm/gup: pass flags arg to __gup_device_* functions mm/gup: factor out duplicate code from four routines mm/gup: move try_get_compound_hea

[PATCH v6 03/24] mm/gup: move try_get_compound_head() to top, fix minor issues

2019-11-19 Thread John Hubbard
An upcoming patch uses try_get_compound_head() more widely, so move it to the top of gup.c. Also fix a tiny spelling error and a checkpatch.pl warning. Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup.c | 29 +++-- 1 file changed, 15

[PATCH v6 09/24] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-19 Thread John Hubbard
for helping clarify the DAX refactoring. Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_type1.c | 30 +- mm/gup.c

[PATCH v6 08/24] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-11-19 Thread John Hubbard
set_page_dirty_lock() if the CPU pages were potentially receiving data from the device. Acked-by: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2

[PATCH v6 11/24] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-11-19 Thread John Hubbard
.c instead of here, so just delete the local release_user_pages() entirely, and call put_user_pages_dirty_lock() directly, instead. [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldf

[PATCH v6 12/24] IB/{core, hw, umem}: set FOLL_PIN via pin_user_pages*(), fix up ODP

2019-11-19 Thread John Hubbard
Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/core/umem_odp.c | 13 ++--- drivers/infiniband/hw/hfi1/user_pages.c | 2 +- drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +- drivers/infiniband/hw/qib/qib_user_pag

[PATCH v6 14/24] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-19 Thread John Hubbard
-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c index 3db000aacd26..37c5e572993a 100644 --- a/drivers/gpu/drm/via/via_dmablit.c

[PATCH v6 18/24] media/v4l2-core: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-11-19 Thread John Hubbard
1. Change v4l2 from get_user_pages() to pin_user_pages(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Acked-by: Hans Verkuil Cc: Ira Weiny Signed-off-by: John Hubbard --- drivers/media/v4l2

[PATCH v6 13/24] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-11-19 Thread John Hubbard
s for easier reading of process_vm_rw_single_vec(). Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/process_vm_access.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/proc

[PATCH v6 02/24] mm/gup: factor out duplicate code from four routines

2019-11-19 Thread John Hubbard
the the successful end of each routine, to increment *nr. Reviewed-by: Jérôme Glisse Cc: Jan Kara Cc: Ira Weiny Cc: Christoph Hellwig Cc: Aneesh Kumar K.V Signed-off-by: John Hubbard --- mm/gup.c | 91 ++-- 1 file changed, 36 insertions(+), 55

[PATCH v6 04/24] mm: Cleanup __put_devmap_managed_page() vs ->page_free()

2019-11-19 Thread John Hubbard
p is only needed in the MEMORY_DEVICE_FSDAX case, but it does no harm in the MEMORY_DEVICE_DEVDAX and MEMORY_DEVICE_PCI_P2PDMA case. Cc: Jan Kara Cc: Christoph Hellwig Cc: Ira Weiny Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Signed-off-by: Dan Williams Signed-off-by: Joh

[PATCH v6 01/24] mm/gup: pass flags arg to __gup_device_* functions

2019-11-19 Thread John Hubbard
A subsequent patch requires access to gup flags, so pass the flags argument through to the __gup_device_* functions. Also placate checkpatch.pl by shortening a nearby line. Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Cc: Kirill A. Shutemov Signed-off-by: John

Re: [PATCH v6 15/24] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-19 Thread John Hubbard
On 11/19/19 8:10 AM, Jens Axboe wrote: > On 11/19/19 1:16 AM, John Hubbard wrote: >> Convert fs/io_uring to use the new pin_user_pages() call, which sets >> FOLL_PIN. Setting FOLL_PIN is now required for code that requires >> tracking of pinned pages, and therefore fo

Re: [PATCH v5 17/24] mm/gup: track FOLL_PIN pages

2019-11-18 Thread John Hubbard
On 11/18/19 3:58 AM, Jan Kara wrote: > On Thu 14-11-19 21:53:33, John Hubbard wrote: >> Add tracking of pages that were pinned via FOLL_PIN. >> >> As mentioned in the FOLL_PIN documentation, callers who effectively set >> FOLL_PIN are required to ultimately free s

Re: [PATCH v5 10/24] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-18 Thread John Hubbard
On 11/18/19 2:16 AM, Jan Kara wrote: > On Thu 14-11-19 21:53:26, John Hubbard wrote: >> /* >> - * NOTE on FOLL_LONGTERM: >> + * FOLL_PIN and FOLL_LONGTERM may be used in various combinations with each >> + * other. Here is what they mean, and how to use them: >>

Re: [PATCH v6 17/24] mm/gup: track FOLL_PIN pages

2019-11-19 Thread John Hubbard
On 11/19/19 3:37 AM, Jan Kara wrote: > On Tue 19-11-19 00:16:36, John Hubbard wrote: >> @@ -2025,6 +2149,20 @@ static int __record_subpages(struct page *page, >> unsigned long addr, >> return nr; >> } >> >> +static bool __pin_compound_head(st

Re: [PATCH v7 07/24] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-11-24 Thread John Hubbard
On 11/24/19 2:07 AM, Leon Romanovsky wrote: > On Thu, Nov 21, 2019 at 10:36:43AM -0400, Jason Gunthorpe wrote: >> On Thu, Nov 21, 2019 at 12:07:46AM -0800, Christoph Hellwig wrote: >>> On Wed, Nov 20, 2019 at 11:13:37PM -0800, John Hubbard wrote: >>>> And get rid

[PATCH 05/19] mm: fix get_user_pages_remote()'s handling of FOLL_LONGTERM

2019-11-24 Thread John Hubbard
s to Jason Gunthorpe for pointing out a clean way to fix this, and to Dan Williams for helping clarify the DAX refactoring. Tested-by: Alex Williamson Acked-by: Alex Williamson Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse

[PATCH 15/19] media/v4l2-core: pin_user_pages (FOLL_PIN) and put_user_page() conversion

2019-11-24 Thread John Hubbard
1. Change v4l2 from get_user_pages() to pin_user_pages(). 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Acked-by: Hans Verkuil Cc: Ira Weiny Signed-off-by: John Hubbard --- drivers/media/v4l2

[PATCH 14/19] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-11-24 Thread John Hubbard
set_page_dirty_lock() if the CPU pages were potentially receiving data from the device. Reviewed-by: Christoph Hellwig Acked-by: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH 00/19] pin_user_pages(): reduced-risk series for Linux 5.5

2019-11-24 Thread John Hubbard
sets FOLL_GET) put_page() to this: pin_longterm_pages() (sets FOLL_PIN | FOLL_LONGTERM) put_user_page() [1] https://lore.kernel.org/r/20191121071354.456618-1-jhubb...@nvidia.com thanks, John Hubbard NVIDIA Dan Williams (1): mm: Cleanup __put_devmap_managed_page() vs ->page_free()

[PATCH 02/19] mm/gup: move try_get_compound_head() to top, fix minor issues

2019-11-24 Thread John Hubbard
An upcoming patch uses try_get_compound_head() more widely, so move it to the top of gup.c. Also fix a tiny spelling error and a checkpatch.pl warning. Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup.c | 29

[PATCH 10/19] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-11-24 Thread John Hubbard
s for easier reading of process_vm_rw_single_vec(). Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/process_vm_access.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/proc

[PATCH 19/19] mm, tree-wide: rename put_user_page*() to unpin_user_page*()

2019-11-24 Thread John Hubbard
In order to provide a clearer, more symmetric API for pinning and unpinning DMA pages. This way, pin_user_pages*() calls match up with unpin_user_pages*() calls, and the API is a lot closer to being self-explanatory. Reviewed-by: Jan Kara Signed-off-by: John Hubbard --- Documentation/core-api

[PATCH 03/19] mm: Cleanup __put_devmap_managed_page() vs ->page_free()

2019-11-24 Thread John Hubbard
p is only needed in the MEMORY_DEVICE_FSDAX case, but it does no harm in the MEMORY_DEVICE_DEVDAX and MEMORY_DEVICE_PCI_P2PDMA case. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Cc: Jan Kara Cc: Ira Weiny Signed-off-by: Dan Williams Signed-off-by: John Hubbard --- drivers/nvdimm/pm

[PATCH 01/19] mm/gup: factor out duplicate code from four routines

2019-11-24 Thread John Hubbard
the the successful end of each routine, to increment *nr. Reviewed-by: Christoph Hellwig Reviewed-by: Jérôme Glisse Reviewed-by: Jan Kara Cc: Ira Weiny Cc: Christoph Hellwig Cc: Aneesh Kumar K.V Signed-off-by: John Hubbard --- mm/gup.c | 91 ++-- 1

[PATCH 18/19] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-11-24 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- mm/gup_benchmark.c | 9 ++--- tools/testing/selftests/vm/gup_benchmark.c | 6 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a

[PATCH 06/19] vfio: fix FOLL_LONGTERM use, simplify get_user_pages_remote() call

2019-11-24 Thread John Hubbard
's no need for it at the VFIO call site. So remove it. Tested-by: Alex Williamson Acked-by: Alex Williamson Reviewed-by: Jason Gunthorpe Reviewed-by: Ira Weiny Suggested-by: Jason Gunthorpe Cc: Dan Williams Cc: Jerome Glisse Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_ty

[PATCH 11/19] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-24 Thread John Hubbard
-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c index 3db000aacd26..37c5e572993a 100644 --- a/drivers/gpu/drm/via/via_dmablit.c

[PATCH 12/19] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-24 Thread John Hubbard
-by: John Hubbard --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 010003b4b60b..0f7898b1c4b0 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4185,7 +4185,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void

[PATCH 13/19] net/xdp: set FOLL_PIN via pin_user_pages()

2019-11-24 Thread John Hubbard
to convert from the get_user_pages()/put_page() model, to the pin_user_pages()/put_user_page() model, the only change required here is to change get_user_pages() to pin_user_pages(). Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 07/19] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-24 Thread John Hubbard
Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded upon it.) Reviewed-by: Jan Kara Reviewed-by: Mike Rapoport # Documentation Reviewed-by: Jérôme Glisse Cc: Jonathan Corbet Cc: Ira Weiny Signed-off-by: John Hubbard --- Documentation/cor

[PATCH 04/19] goldish_pipe: rename local pin_user_pages() routine

2019-11-24 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "goldfish_pin_pages()". An upcoming patch will introduce a global pin_user_pages() function. Reviewed-by: Jan Kara Reviewed-by: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John H

[PATCH 09/19] IB/{core, hw, umem}: set FOLL_PIN via pin_user_pages*(), fix up ODP

2019-11-24 Thread John Hubbard
Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/core/umem_odp.c | 13 ++--- drivers/infiniband/hw/hfi1/user_pages.c | 2 +- drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +- drivers/infiniband/hw/qib/qib_user_pag

[PATCH 08/19] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-11-24 Thread John Hubbard
.c instead of here, so just delete the local release_user_pages() entirely, and call put_user_pages_dirty_lock() directly, instead. [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Reviewed-by: Jan Kara Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldf

<    1   2   3   4   5   6   7   >