All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/8] Add support for SVM atomics in Nouveau
@ 2021-04-07  8:42 ` Alistair Popple
  0 siblings, 0 replies; 127+ messages in thread
From: Alistair Popple @ 2021-04-07  8:42 UTC (permalink / raw)
  To: linux-mm, nouveau, bskeggs, akpm
  Cc: Alistair Popple, linux-doc, linux-kernel, dri-devel, jhubbard,
	rcampbell, jglisse, jgg, hch, daniel, willy, bsingharora

This is the eighth version of a series to add support to Nouveau for atomic
memory operations on OpenCL shared virtual memory (SVM) regions.

The main change for this version is a simplification of device exclusive
entry handling. Instead of copying entries for copy-on-write mappings
during fork they are removed instead. This is safer because there could be
unique corner cases when copying, particularly for pinned pages which
should follow the same logic as copy_present_page(). Removing entries
avoids this possiblity by treating them as normal ptes.

Exclusive device access is implemented by adding a new swap entry type
(SWAP_DEVICE_EXCLUSIVE) which is similar to a migration entry. The main
difference is that on fault the original entry is immediately restored by
the fault handler instead of waiting.

Restoring the entry triggers calls to MMU notifers which allows a device
driver to revoke the atomic access permission from the GPU prior to the CPU
finalising the entry.

Patches 1 & 2 refactor existing migration and device private entry
functions.

Patches 3 & 4 rework try_to_unmap_one() by splitting out unrelated
functionality into separate functions - try_to_migrate_one() and
try_to_munlock_one(). These should not change any functionality, but any
help testing would be much appreciated as I have not been able to test
every usage of try_to_unmap_one().

Patch 5 contains the bulk of the implementation for device exclusive
memory.

Patch 6 contains some additions to the HMM selftests to ensure everything
works as expected.

Patch 7 is a cleanup for the Nouveau SVM implementation.

Patch 8 contains the implementation of atomic access for the Nouveau
driver.

This has been tested using the latest upstream Mesa userspace with a simple
OpenCL test program which checks the results of atomic GPU operations on a
SVM buffer whilst also writing to the same buffer from the CPU.

Alistair Popple (8):
  mm: Remove special swap entry functions
  mm/swapops: Rework swap entry manipulation code
  mm/rmap: Split try_to_munlock from try_to_unmap
  mm/rmap: Split migration into its own function
  mm: Device exclusive memory access
  mm: Selftests for exclusive device memory
  nouveau/svm: Refactor nouveau_range_fault
  nouveau/svm: Implement atomic SVM access

 Documentation/vm/hmm.rst                      |  19 +-
 Documentation/vm/unevictable-lru.rst          |  33 +-
 arch/s390/mm/pgtable.c                        |   2 +-
 drivers/gpu/drm/nouveau/include/nvif/if000c.h |   1 +
 drivers/gpu/drm/nouveau/nouveau_svm.c         | 156 ++++-
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h |   1 +
 .../drm/nouveau/nvkm/subdev/mmu/vmmgp100.c    |   6 +
 fs/proc/task_mmu.c                            |  23 +-
 include/linux/mmu_notifier.h                  |  26 +-
 include/linux/rmap.h                          |  11 +-
 include/linux/swap.h                          |   8 +-
 include/linux/swapops.h                       | 123 ++--
 lib/test_hmm.c                                | 126 +++-
 lib/test_hmm_uapi.h                           |   2 +
 mm/debug_vm_pgtable.c                         |  12 +-
 mm/hmm.c                                      |  12 +-
 mm/huge_memory.c                              |  45 +-
 mm/hugetlb.c                                  |  10 +-
 mm/memcontrol.c                               |   2 +-
 mm/memory.c                                   | 196 +++++-
 mm/migrate.c                                  |  51 +-
 mm/mlock.c                                    |  10 +-
 mm/mprotect.c                                 |  18 +-
 mm/page_vma_mapped.c                          |  15 +-
 mm/rmap.c                                     | 612 +++++++++++++++---
 tools/testing/selftests/vm/hmm-tests.c        | 158 +++++
 26 files changed, 1366 insertions(+), 312 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 127+ messages in thread

end of thread, other threads:[~2021-05-21  6:53 UTC | newest]

Thread overview: 127+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  8:42 [PATCH v8 0/8] Add support for SVM atomics in Nouveau Alistair Popple
2021-04-07  8:42 ` Alistair Popple
2021-04-07  8:42 ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 1/8] mm: Remove special swap entry functions Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-05-18  2:17   ` Peter Xu
2021-05-18  2:17     ` Peter Xu
2021-05-18  2:17     ` [Nouveau] " Peter Xu
2021-05-18 11:58     ` Alistair Popple
2021-05-18 11:58       ` Alistair Popple
2021-05-18 11:58       ` [Nouveau] " Alistair Popple
2021-05-18 14:17       ` Peter Xu
2021-05-18 14:17         ` Peter Xu
2021-05-18 14:17         ` [Nouveau] " Peter Xu
2021-04-07  8:42 ` [PATCH v8 2/8] mm/swapops: Rework swap entry manipulation code Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 3/8] mm/rmap: Split try_to_munlock from try_to_unmap Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-05-18 20:04   ` Liam Howlett
2021-05-18 20:04     ` Liam Howlett
2021-05-18 20:04     ` [Nouveau] " Liam Howlett
2021-05-19 12:38     ` Alistair Popple
2021-05-19 12:38       ` Alistair Popple
2021-05-19 12:38       ` [Nouveau] " Alistair Popple
2021-05-20 20:24       ` Liam Howlett
2021-05-20 20:24         ` Liam Howlett
2021-05-20 20:24         ` [Nouveau] " Liam Howlett
2021-05-21  2:23         ` Alistair Popple
2021-05-21  2:23           ` Alistair Popple
2021-05-21  2:23           ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 4/8] mm/rmap: Split migration into its own function Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 5/8] mm: Device exclusive memory access Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-05-18  2:08   ` Peter Xu
2021-05-18  2:08     ` Peter Xu
2021-05-18  2:08     ` [Nouveau] " Peter Xu
2021-05-18 13:19     ` Alistair Popple
2021-05-18 13:19       ` Alistair Popple
2021-05-18 13:19       ` [Nouveau] " Alistair Popple
2021-05-18 17:27       ` Peter Xu
2021-05-18 17:27         ` Peter Xu
2021-05-18 17:27         ` [Nouveau] " Peter Xu
2021-05-18 17:33         ` Jason Gunthorpe
2021-05-18 17:33           ` Jason Gunthorpe
2021-05-18 17:33           ` [Nouveau] " Jason Gunthorpe
2021-05-18 18:01           ` Peter Xu
2021-05-18 18:01             ` Peter Xu
2021-05-18 18:01             ` [Nouveau] " Peter Xu
2021-05-18 19:45             ` Jason Gunthorpe
2021-05-18 19:45               ` Jason Gunthorpe
2021-05-18 19:45               ` [Nouveau] " Jason Gunthorpe
2021-05-18 20:29               ` Peter Xu
2021-05-18 20:29                 ` Peter Xu
2021-05-18 20:29                 ` [Nouveau] " Peter Xu
2021-05-18 23:03                 ` Jason Gunthorpe
2021-05-18 23:03                   ` Jason Gunthorpe
2021-05-18 23:03                   ` [Nouveau] " Jason Gunthorpe
2021-05-18 23:45                   ` Peter Xu
2021-05-18 23:45                     ` Peter Xu
2021-05-18 23:45                     ` [Nouveau] " Peter Xu
2021-05-19 11:04                     ` Alistair Popple
2021-05-19 11:04                       ` Alistair Popple
2021-05-19 11:04                       ` [Nouveau] " Alistair Popple
2021-05-19 12:15                       ` Peter Xu
2021-05-19 12:15                         ` Peter Xu
2021-05-19 12:15                         ` [Nouveau] " Peter Xu
2021-05-19 13:11                         ` Alistair Popple
2021-05-19 13:11                           ` Alistair Popple
2021-05-19 13:11                           ` [Nouveau] " Alistair Popple
2021-05-19 14:04                           ` Peter Xu
2021-05-19 14:04                             ` Peter Xu
2021-05-19 14:04                             ` [Nouveau] " Peter Xu
2021-05-19 13:28                     ` Jason Gunthorpe
2021-05-19 13:28                       ` Jason Gunthorpe
2021-05-19 13:28                       ` [Nouveau] " Jason Gunthorpe
2021-05-19 14:09                       ` Peter Xu
2021-05-19 14:09                         ` Peter Xu
2021-05-19 14:09                         ` [Nouveau] " Peter Xu
2021-05-19 18:11                         ` Jason Gunthorpe
2021-05-19 18:11                           ` Jason Gunthorpe
2021-05-19 18:11                           ` [Nouveau] " Jason Gunthorpe
2021-05-19 11:35         ` Alistair Popple
2021-05-19 11:35           ` Alistair Popple
2021-05-19 11:35           ` [Nouveau] " Alistair Popple
2021-05-19 12:21           ` Peter Xu
2021-05-19 12:21             ` Peter Xu
2021-05-19 12:21             ` [Nouveau] " Peter Xu
2021-05-19 12:46             ` Alistair Popple
2021-05-19 12:46               ` Alistair Popple
2021-05-19 12:46               ` [Nouveau] " Alistair Popple
2021-05-21  6:53       ` Alistair Popple
2021-05-21  6:53         ` Alistair Popple
2021-05-21  6:53         ` [Nouveau] " Alistair Popple
2021-05-18 21:16   ` Peter Xu
2021-05-18 21:16     ` Peter Xu
2021-05-18 21:16     ` [Nouveau] " Peter Xu
2021-05-19 10:49     ` Alistair Popple
2021-05-19 10:49       ` Alistair Popple
2021-05-19 10:49       ` [Nouveau] " Alistair Popple
2021-05-19 12:24       ` Peter Xu
2021-05-19 12:24         ` Peter Xu
2021-05-19 12:24         ` [Nouveau] " Peter Xu
2021-05-19 12:46         ` Alistair Popple
2021-05-19 12:46           ` Alistair Popple
2021-05-19 12:46           ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 6/8] mm: Selftests for exclusive device memory Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 7/8] nouveau/svm: Refactor nouveau_range_fault Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-04-07  8:42 ` [PATCH v8 8/8] nouveau/svm: Implement atomic SVM access Alistair Popple
2021-04-07  8:42   ` Alistair Popple
2021-04-07  8:42   ` [Nouveau] " Alistair Popple
2021-05-21  4:04   ` Ben Skeggs
2021-05-21  4:04     ` Ben Skeggs
2021-05-21  4:04     ` [Nouveau] " Ben Skeggs
2021-05-21  4:04     ` Ben Skeggs
2021-05-06  7:43 ` [PATCH v8 0/8] Add support for SVM atomics in Nouveau Alistair Popple
2021-05-06  7:43   ` Alistair Popple
2021-05-06  7:43   ` [Nouveau] " Alistair Popple

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.