[PATCH 13/34] rapidio: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 11/34] scif: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 04/34] x86/kvm: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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&q

[PATCH 02/34] net/rds: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

Re: [PATCH 20/34] xen: convert put_page() to put_user_page*()

2019-08-02 Thread John Hubbard
On 8/1/19 9:36 PM, Juergen Gross wrote: On 02.08.19 04:19, john.hubb...@gmail.com wrote: From: John Hubbard ... diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 2f5ce7230a43..29e461dbee2d 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -611,15 +611,10

[PATCH 12/34] vmci: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 07/34] drm/radeon: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 01/34] mm/gup: add make_dirty arg to put_user_pages_dirty_lock()

2019-08-02 Thread john . hubbard
From: John Hubbard 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

[PATCH 24/34] futex: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 26/34] mm/gup_benchmark.c: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 02/34] net/rds: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 14/34] oradax: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 33/34] kernel/events/core.c: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 03/34] net/ceph: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
From: John Hubbard 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*(), placeh

[PATCH 34/34] fs/binfmt_elf: convert put_page() to put_user_page*()

2019-08-02 Thread john . hubbard
older versions"). get_dump_page calls get_user_page so put_user_page must be used to match. Signed-off-by: Ira Weiny Signed-off-by: John Hubbard --- fs/binfmt_elf.c | 2 +- fs/binfmt_elf_fdpic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/binfmt_

Re: [PATCH v2 2/3] mm/gup.c: Migrate device coherent pages when pinning instead of failing

2022-02-11 Thread John Hubbard
the many things to monitor, the FOLL_PIN counts in /proc/vmstat are especially helpful, whenever making changes to code that deals with this: nr_foll_pin_acquired nr_foll_pin_released ...and those should normally be equal to each other when "at rest".

Re: [PATCH v2 2/3] mm/gup.c: Migrate device coherent pages when pinning instead of failing

2022-02-11 Thread John Hubbard
ith this: nr_foll_pin_acquired nr_foll_pin_released ...and those should normally be equal to each other when "at rest". I hope this is/was run, just to be sure? thanks, -- John Hubbard NVIDIA

Re: [PATCH v2 1/3] migrate.c: Remove vma check in migrate_vma_setup()

2022-02-15 Thread John Hubbard
ring the comments into alignment with the code. * I don't think memset deals properly with a zero length input arg, so it's probably better to return 0, before that point. thanks, -- John Hubbard NVIDIA - if (args->start < args->vma->vm_start || - args->

Re: [PATCH 6/7] nouveau/dmem: Evict device private memory during release

2022-09-26 Thread John Hubbard
some point, we're going to make this all work with file-backed memory, which will *definitely* not be discardable--I realize that we're not there yet, of course. But here, it's reasonable to commit to just retrying indefinitely, really. Memory should eventually show up. And if it doesn't, then restarting the machine is better than corrupting data, generally. thanks, -- John Hubbard NVIDIA

[PATCH 18/19] mm/gup: remove support for gup(FOLL_LONGTERM)

2019-10-31 Thread John Hubbard
associated GUP_LONGTERM_BENCHMARK test. Signed-off-by: John Hubbard --- mm/gup.c | 8 mm/gup_benchmark.c | 9 + tools/testing/selftests/vm/gup_benchmark.c | 7 ++- 3 files changed, 7 insertions(+), 17 deletions

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

2019-10-31 Thread John Hubbard
Convert drm/via to use the new pin_user_pages_fast() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1

[PATCH 12/19] mm/gup: track FOLL_PIN pages

2019-10-31 Thread John Hubbard
P pages by introducing put_devmap_managed_user_page() which accounts for GUP_PIN_COUNTING_BIAS now used by GUP. [1] https://lwn.net/Articles/784574/ "Some slow progress on get_user_pages()" Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Signed-off-by: Ira Weiny Signed-off-by: John H

[PATCH 00/19] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-10-31 Thread John Hubbard
* Work with Ira and Dave Chinner to weave this together with the layout lease stuff. [1] Some slow progress on get_user_pages() (Apr 2, 2019): https://lwn.net/Articles/784574/ [2] DMA and get_user_pages() (LPC: Dec 12, 2018): https://lwn.net/Articles/774411/ [3] The trouble with

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

2019-10-31 Thread John Hubbard
uot;get_user_pages". That makes it easy to find and audit the call sites. * Set FOLL_PIN * For pages that are received via FOLL_PIN, those pages must be returned via put_user_page(). Signed-off-by: John Hubbard --- include/linux/mm.h | 53 +

[PATCH 15/19] powerpc: book3s64: convert to pin_longterm_pages() and put_user_page()

2019-10-31 Thread John Hubbard
n_longterm_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 | 15 ++- 1 file changed, 6 insertions

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

2019-10-31 Thread John Hubbard
or easier reading of process_vm_rw_single_vec(). Signed-off-by: John Hubbard --- mm/process_vm_access.c | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 357aa7bef6c0..fd20ab67

[PATCH 14/19] vfio, mm: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-10-31 Thread John Hubbard
stoph 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/20190723153640.gb...@lst.de Cc: Alex Williamson Signed-off-by: John Hubbard --- drivers/vfio/vfio_iom

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

2019-10-31 Thread John Hubbard
lling set_page_dirty_lock() if the CPU pages were potentially receiving data from the device. 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-core/videobuf-dma-sg

[PATCH 16/19] mm/gup_benchmark: support pin_user_pages() and related calls

2019-10-31 Thread John Hubbard
alls pin_longterm_pages() PIN_BENCHMARK : calls pin_user_pages() In between the calls to pin_*() and put_user_pages(), check each page: if page_dma_pinned() returns false, then WARN and return. Do this outside of the benchmark timestamps, so that it doesn't affect repo

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

2019-10-31 Thread John Hubbard
Convert net/xdp to use the new pin_longterm_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages. Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xdp

Re: [PATCH 14/19] vfio, mm: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-10-31 Thread John Hubbard
On 10/30/19 3:49 PM, John Hubbard wrote: > This also fixes one or two likely bugs. Well, actually just one... > > 1. Change vfio from get_user_pages(FOLL_LONGTERM), to > pin_longterm_pages(), which sets both FOLL_LONGTERM and FOLL_PIN. > > Note that this is a change in beh

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

2019-10-31 Thread John Hubbard
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 for any code that calls put_user_page(). Signed-off-by: John Hubbard --- fs/io_uring.c | 5 ++--- 1 file changed, 2

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

2019-10-31 Thread John Hubbard
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 Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldfish_pipe.c | 17 +++-- 1 file

[PATCH 19/19] Documentation/vm: add pin_user_pages.rst

2019-10-31 Thread John Hubbard
Document the new pin_user_pages() and related calls and behavior. Thanks to Jan Kara and Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded on it slightly.) Cc: Jonathan Corbet Signed-off-by: John Hubbard --- Documentation/vm/inde

[PATCH 07/19] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-10-31 Thread John Hubbard
put_user_page*() calls, but infiniband was already doing that as part of an earlier commit. Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 5 ++--- drivers/infiniband/core/umem_odp.c | 10 +- drivers/infiniband/hw/hfi1/user_pages.c | 4

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

2019-10-31 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. Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- mm/gup.c | 28 ++-- 1 file changed, 18

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

2019-10-31 Thread John Hubbard
Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index 28262190c3ab..9b9c5b37bf59 100644 --- a/drivers

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

2019-10-31 Thread John Hubbard
e the successful end of each routine, to increment *nr. Cc: Christoph Hellwig Cc: Aneesh Kumar K.V Signed-off-by: John Hubbard --- mm/gup.c | 113 ++- 1 file changed, 46 insertions(+), 67 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 85caf76

[PATCH 17/19] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-10-31 Thread John Hubbard
s 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. Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed, 22 insertion

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

2019-10-31 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. Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldfish_pipe.c | 18 +

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

2019-11-01 Thread John Hubbard
On 10/31/19 4:35 PM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:19PM -0700, John Hubbard wrote: >> Convert process_vm_access to use the new pin_user_pages_remote() >> call, which sets FOLL_PIN. Setting FOLL_PIN is now required for >> code that requires tracking of pin

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

2019-11-01 Thread John Hubbard
On 10/31/19 4:15 PM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:16PM -0700, John Hubbard wrote: ... >> + * FOLL_PIN indicates that a special kind of tracking (not just >> page->_refcount, >> + * but an additional pin counting system) will be invoked. This is intended

Re: [PATCH 19/19] Documentation/vm: add pin_user_pages.rst

2019-11-01 Thread John Hubbard
On 10/31/19 4:49 PM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:30PM -0700, John Hubbard wrote: >> Document the new pin_user_pages() and related calls >> and behavior. >> >> Thanks to Jan Kara and Vlastimil Babka for explaining the 4 cases >> in this doc

Re: [PATCH 07/19] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-11-01 Thread John Hubbard
On 10/31/19 4:25 PM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:18PM -0700, John Hubbard wrote: >> Convert infiniband to use the new wrapper calls, and stop >> explicitly setting FOLL_LONGTERM at the call sites. >> >> The new pin_longterm_*() calls replace get_user

Re: [PATCH 19/19] Documentation/vm: add pin_user_pages.rst

2019-11-01 Thread John Hubbard
On 10/31/19 4:49 PM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:30PM -0700, John Hubbard wrote: ... >> +TODO: There is also a special case when the pages are DAX pages: in >> addition to >> +the above flags, the caller needs something like a layout lease on the >>

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

2019-11-01 Thread John Hubbard
On 10/31/19 2:09 PM, Ira Weiny wrote: > On Thu, Oct 31, 2019 at 11:43:37AM -0700, John Hubbard wrote: >> On 10/31/19 11:35 AM, Ira Weiny wrote: >>> On Wed, Oct 30, 2019 at 03:49:13PM -0700, John Hubbard wrote: >> ... >>>> + >>>> +static int __huge_

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

2019-11-01 Thread John Hubbard
On 10/31/19 11:35 AM, Ira Weiny wrote: > On Wed, Oct 30, 2019 at 03:49:13PM -0700, John Hubbard wrote: ... >> + >> +static void __remove_refs_from_head(struct page *page, int refs) >> +{ >> +/* Do a get_page() first, in case refs == page->_ref

[PATCH v2 07/18] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-11-03 Thread John Hubbard
put_user_page*() calls, but infiniband was already doing that as part of an earlier commit. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 5 ++--- drivers/infiniband/core/umem_odp.c | 10 +- drivers/infiniband/hw/hfi1

[PATCH v2 03/18] goldish_pipe: rename local pin_user_pages() routine

2019-11-03 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: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/

Re: [PATCH v2 05/18] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-04 Thread John Hubbard
t; it can be properly implemented ? > Well, the problem is that I need each call site that requires FOLL_PIN to use a proper wrapper. It's the FOLL_PIN that is the focus here, because there is a hard, bright rule, which is: if and only if a caller sets FOLL_PIN, then the dma-page tracking happens, and put_user_page() must be called. So this leaves me with only two reasonable choices: a) Convert the call site as above: pin_longterm_pages_remote(), which sets FOLL_PIN (the key point!), and leaves the FOLL_LONGTERM situation exactly as it has been so far. When the FOLL_LONGTERM situation is fixed, the call site *might* not need any changes to adopt the working gup.c code. b) Convert the call site to pin_user_pages_remote(), which also sets FOLL_PIN, and also leaves the FOLL_LONGTERM situation exactly as before. There would also be a comment at the call site, to the effect of, "this is the wrong call to make: it really requires FOLL_LONGTERM behavior". When the FOLL_LONGTERM situation is fixed, the call site will need to be changed to pin_longterm_pages_remote(). So you can probably see why I picked (a). thanks, John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

2019-11-04 Thread John Hubbard
On 11/4/19 10:10 AM, Daniel Vetter wrote: > On Thu, Oct 31, 2019 at 04:36:28PM -0700, Ira Weiny wrote: >> On Wed, Oct 30, 2019 at 03:49:20PM -0700, John Hubbard wrote: >>> Convert drm/via to use the new pin_user_pages_fast() call, which sets >>> FOLL_PIN. Setting FOLL_P

Re: [PATCH v2 09/18] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-04 Thread John Hubbard
On 11/4/19 9:44 AM, Jerome Glisse wrote: > On Sun, Nov 03, 2019 at 01:18:04PM -0800, John Hubbard wrote: >> Convert drm/via to use the new pin_user_pages_fast() call, which sets >> FOLL_PIN. Setting FOLL_PIN is now required for code that requires >> tracking of pinned pages,

Re: [PATCH v2 05/18] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-04 Thread John Hubbard
On 11/4/19 11:18 AM, Jerome Glisse wrote: > On Mon, Nov 04, 2019 at 11:04:38AM -0800, John Hubbard wrote: >> On 11/4/19 9:33 AM, Jerome Glisse wrote: >> ... >>> >>> Few nitpick belows, nonetheless: >>> >>> Reviewed-by

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

2019-11-05 Thread John Hubbard
On 11/5/19 1:49 AM, Daniel Vetter wrote: > On Mon, Nov 04, 2019 at 11:20:38AM -0800, John Hubbard wrote: >> On 11/4/19 10:10 AM, Daniel Vetter wrote: >>> On Thu, Oct 31, 2019 at 04:36:28PM -0700, Ira Weiny wrote: >>>> On Wed, Oct 30, 2019 at 03:49:20PM -0700, John Hu

Re: [PATCH v2 05/18] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-05 Thread John Hubbard
to gup, meaning that neither FOLL_PIN nor FOLL_LONGTERM should not appear at the gup call sites. This allows the associated wrapper functions (pin_user_pages() and others) to set the correct combination of these flags, and to check for problems as well. thanks, John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 01/15] mm/mmu_notifier: define the header pre-processor parts even if disabled

2019-11-05 Thread John Hubbard
(+), 29 deletions(-) > Because this is correct as-is, you can add: Reviewed-by: John Hubbard ...whether or not you take the following recommendation, which is: you've only done part of the job of making struct mmu_notifier_mm private to mmu_notifier.c. There's more: * struct

Re: [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-06 Thread John Hubbard
lidating(mmn_mm)); > + mrn->invalidate_seq = mmn_mm->invalidate_seq - 1; Ohhh, checkmate. I lose. Why is *subtracting* the right thing to do for seq numbers here? I'm acutely unhappy trying to figure this out. I suspect it's another unfortunate side effect

Re: [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-11-07 Thread John Hubbard
validation should be +* odd, not equal to the current invalidate_seq and + * invalidate_seq should not 'wrap' to the new seq any time +* soon. +*/ mrn->invalidate_seq = mmn_mm->invalidate_seq - 1; interval_tree_insert(&mrn->interval_tree, &mmn_mm->itree); } Looks good. We're just polishing up minor points now, so you can add: Reviewed-by: John Hubbard thanks, -- John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 04/18] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-11-11 Thread John Hubbard
On 11/10/19 2:10 AM, Hans Verkuil wrote: > On 11/3/19 10:17 PM, John Hubbard wrote: >> After DMA is complete, and the device and CPU caches are synchronized, >> it's still required to mark the CPU pages as dirty, if the data was >> coming from the device. However, this

[PATCH v3 01/23] mm/gup: pass flags arg to __gup_device_* functions

2019-11-11 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: Jérôme Glisse Reviewed-by: Ira Weiny Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- mm/gup.c | 28

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

2019-11-11 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. Signed-off-by: John Hubbard --- mm/gup.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a

[PATCH v3 05/23] goldish_pipe: rename local pin_user_pages() routine

2019-11-11 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: Jérôme Glisse Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drive

[PATCH v3 06/23] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-11-11 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: Ira Weiny Cc: Jason Gunthorpe Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 17

[PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-11 Thread John Hubbard
s to Jason Gunthorpe for pointing out a clean way to fix this. Suggested-by: Jason Gunthorpe Cc: Jerome Glisse Cc: Ira Weiny Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_type1.c | 30 +- mm/gup.c| 13 - 2 files changed, 21

[PATCH v3 13/23] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-11-11 Thread John Hubbard
: 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 v3 04/23] mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages

2019-11-11 Thread John Hubbard
y to unconditionally freeing a devmap page. This is originally based on a separate patch by Ira Weiny, which applied to an early version of the put_user_page() experiments. Since then, Jérôme Glisse suggested the refactoring described above. Suggested-by: Jérôme Glisse Signed-off-by: Ira Weiny

[PATCH v3 00/23] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-11-11 Thread John Hubbard
e block/bio_vec sites converted to use pin_user_pages(). * Work with Ira and Dave Chinner to weave this together with the layout lease stuff. [1] Some slow progress on get_user_pages() (Apr 2, 2019): https://lwn.net/Articles/784574/ [2] DMA and get_user_pages() (LPC:

[PATCH v3 09/23] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-11-11 Thread John Hubbard
t.) Reviewed-by: Jérôme Glisse Cc: Mike Rapoport Cc: Jonathan Corbet Cc: Ira Weiny Signed-off-by: John Hubbard --- Documentation/core-api/index.rst | 1 + Documentation/core-api/pin_user_pages.rst | 218 ++ include/linux/mm.h

[PATCH v3 02/23] mm/gup: factor out duplicate code from four routines

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

[PATCH v3 10/23] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-11-11 Thread John Hubbard
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: Ira Weiny Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldfish_pipe.c | 17 +++---

[PATCH v3 07/23] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-11-11 Thread John Hubbard
lling 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

[PATCH v3 11/23] IB/{core, hw, umem}: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-11-11 Thread John Hubbard
put_user_page*() calls, but infiniband was already doing that as part of an earlier commit. Reviewed-by: Ira Weiny Signed-off-by: John Hubbard --- drivers/infiniband/core/umem.c | 10 - drivers/infiniband/core/umem_odp.c | 24 ++--- drivers/infiniband

[PATCH v3 19/23] powerpc: book3s64: convert to pin_longterm_pages() and put_user_page()

2019-11-11 Thread John Hubbard
n_longterm_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 | 15 ++- 1 file changed, 6 insertions

[PATCH v3 14/23] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-11-11 Thread John Hubbard
-off-by: John Hubbard --- fs/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index f9a38998f2fc..0f307f2c7cac 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3433,9 +3433,8 @@ static int io_sqe_buffer_register(struct io_ring_ctx

[PATCH v3 12/23] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-11-11 Thread John Hubbard
or easier reading of process_vm_rw_single_vec(). 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/process_vm_access.c b/mm/proce

[PATCH v3 18/23] vfio, mm: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-11-11 Thread John Hubbard
e inode it hangs off." [1] [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Cc: Alex Williamson Signed-off-by: John Hubbard --- drivers/vfio/vfio_iommu_type1.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c

[PATCH v3 20/23] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-11-11 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. 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/mm/gup_benchmark.c b/mm/gup_benchm

[PATCH v3 16/23] mm/gup: track FOLL_PIN pages

2019-11-11 Thread John Hubbard
N_ON(), in follow_page_mask(). Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Signed-off-by: John Hubbard --- include/linux/mm.h | 75 include/linux/mmzone.h | 2 + include/linux/page_ref.h | 10 +++ mm/gup.c | 190 +

[PATCH v3 15/23] net/xdp: set FOLL_PIN via pin_user_pages()

2019-11-11 Thread John Hubbard
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_longterm_pages(). Reviewed-by: Ira Weiny Acked-by: Björn Töpel Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 4 ++-- 1

[PATCH v3 21/23] mm/gup_benchmark: support pin_user_pages() and related calls

2019-11-11 Thread John Hubbard
alls pin_longterm_pages() PIN_BENCHMARK : calls pin_user_pages() In between the calls to pin_*() and put_user_pages(), check each page: if page_dma_pinned() returns false, then WARN and return. Do this outside of the benchmark timestamps, so that it doesn't affect repo

[PATCH v3 17/23] media/v4l2-core: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-11-11 Thread John Hubbard
Reviewed-by: Ira Weiny Cc: Mauro Carvalho Chehab Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index

[PATCH v3 23/23] mm/gup: remove support for gup(FOLL_LONGTERM)

2019-11-11 Thread John Hubbard
associated GUP_LONGTERM_BENCHMARK test. Signed-off-by: John Hubbard --- mm/gup.c | 8 mm/gup_benchmark.c | 9 + tools/testing/selftests/vm/gup_benchmark.c | 7 ++- 3 files changed, 7 insertions(+), 17 deletions

[PATCH v3 22/23] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-11-11 Thread John Hubbard
s 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. Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed, 22 insertion

Re: [PATCH v3 00/23] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-11-12 Thread John Hubbard
On 11/12/19 12:38 PM, Jason Gunthorpe wrote: > On Mon, Nov 11, 2019 at 04:06:37PM -0800, John Hubbard wrote: >> Hi, >> >> The cover letter is long, so the more important stuff is first: >> >> * Jason, if you or someone could look at the the VFIO cleanup (patch 8

Re: [PATCH v3 11/23] IB/{core,hw,umem}: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-11-12 Thread John Hubbard
On 11/12/19 12:44 PM, Jason Gunthorpe wrote: > On Mon, Nov 11, 2019 at 04:06:48PM -0800, John Hubbard wrote: >> @@ -542,7 +541,7 @@ static int ib_umem_odp_map_dma_single_page( >> } >> >> out: >> -put_user_page(page); >> +put_page(page); &

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
hould do the ((FOLL_LONGTERM | FOLL_GET) && > vma_is_fsdax()) check and that would also remove the need for > __gup_longterm_locked. > Good idea, but there is still the call to check_and_migrate_cma_pages(), inside __gup_longterm_locked(). So it's a little more involved and we can't trivially delete __gup_longterm_locked() yet, right? thanks, -- John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
ead(&mm->mmap_sem); > Yes, that's really odd. It's not good to release and retake the lock anyway in general (without re-checking things), and certainly it is not required to release mmap_sem in order to call page_to_pfn(). I've removed that up_read()

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
in a "happy surprise" way. :) . Fixing up the CMA pages by splitting that functionality into separate function calls sounds like an improvement worth exploring. thanks, -- John Hubbard NVIDIA ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
On 11/12/19 2:45 PM, Dan Williams wrote: > On Tue, Nov 12, 2019 at 2:43 PM John Hubbard wrote: >> >> On 11/12/19 12:43 PM, Jason Gunthorpe wrote: >> ... >>>> -} >>>> +ret = get_user_pages_remote(NULL, mm, vaddr, 1, flags | FOLL_LONGTER

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
;ll post a cleaned up v4 (with the extraneous up_read()/down_read() removed), then. > cleanup, but not something that needs to be done now. > Yes. I've put the FOLL_LONGTERM cleanup items on my list now, in case they don't get done as part of something else. There's a lot more

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
operations. * Disallow attempts to pin fs-dax pages via this * interface. */ if (ret > 0 && vma_is_fsdax(vmas[0])) { ret = -EOPNOTSUPP; put_page(page[0]); } (and the declaration of "vmas", as well).

Re: [PATCH v3 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

2019-11-12 Thread John Hubbard
On 11/12/19 5:35 PM, Dan Williams wrote: > On Tue, Nov 12, 2019 at 5:08 PM John Hubbard wrote: >> >> On 11/12/19 4:58 PM, Dan Williams wrote: >> ... >>>>> It's not redundant relative to upstream which does not do anything the >>>>> FOLL_L

[PATCH v4 20/23] mm/gup_benchmark: use proper FOLL_WRITE flags instead of hard-coding "1"

2019-11-12 Thread John Hubbard
t;gup_flags & 1" phrases in the function calls. 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/mm/gup_benchmark.c b/mm/gup_benchm

[PATCH v4 02/23] mm/gup: factor out duplicate code from four routines

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

[PATCH v4 08/23] vfio, mm: fix get_user_pages_remote() and FOLL_LONGTERM

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

[PATCH v4 22/23] selftests/vm: run_vmtests: invoke gup_benchmark with basic FOLL_PIN coverage

2019-11-12 Thread John Hubbard
s 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. Signed-off-by: John Hubbard --- tools/testing/selftests/vm/run_vmtests | 22 ++ 1 file changed, 22 insertion

[PATCH v4 17/23] media/v4l2-core: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-11-12 Thread John Hubbard
Reviewed-by: Ira Weiny Cc: Mauro Carvalho Chehab Signed-off-by: John Hubbard --- drivers/media/v4l2-core/videobuf-dma-sg.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index

[PATCH v4 16/23] mm/gup: track FOLL_PIN pages

2019-11-12 Thread John Hubbard
N_ON(), in follow_page_mask(). Suggested-by: Jan Kara Suggested-by: Jérôme Glisse Signed-off-by: John Hubbard --- include/linux/mm.h | 74 +++ include/linux/mmzone.h | 2 + include/linux/page_ref.h | 10 +++ mm/gup.c | 189 +

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

2019-11-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. Signed-off-by: John Hubbard --- mm/gup.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a

[PATCH v4 00/23] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-11-12 Thread John Hubbard
[1] Some slow progress on get_user_pages() (Apr 2, 2019): https://lwn.net/Articles/784574/ [2] DMA and get_user_pages() (LPC: Dec 12, 2018): https://lwn.net/Articles/774411/ [3] The trouble with get_user_pages() (Apr 30, 2018): https://lwn.n

<    1   2   3   4   5   6   7   >