linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] Add support for SVM atomics in Nouveau
@ 2021-02-26  7:18 Alistair Popple
  2021-02-26  7:18 ` [PATCH v3 1/8] mm: Remove special swap entry functions Alistair Popple
                   ` (7 more replies)
  0 siblings, 8 replies; 29+ messages in thread
From: Alistair Popple @ 2021-02-26  7:18 UTC (permalink / raw)
  To: linux-mm, nouveau, bskeggs, akpm
  Cc: linux-doc, linux-kernel, dri-devel, jhubbard, rcampbell, jglisse,
	jgg, hch, daniel, Alistair Popple

This is the third version of a series to add support to Nouveau for atomic
memory operations on OpenCL shared virtual memory (SVM) regions. This is
achieved using the atomic PTE bits on the GPU to only permit atomic
operations to system memory when a page is not mapped in userspace on the
CPU. The previous version of this series used an unmap and pin page
migration, however this resulted in problems with ZONE_MOVABLE and other
issues so this series uses a different approach.

Instead 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 are new for v3 and refactor the 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 single 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 and has not changed significantly since v2.

Patch 7 was posted previously and has not changed.

Patch 8 was posted for v2 and has not changed significantly.

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.

v3:
* Refactored some existing functionality.
* Switched to using get_user_pages_remote() instead of open-coding it.
* Moved code out of hmm.

v2:
* Changed implementation to use special swap entries instead of device
  private pages.

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                      |  15 +
 arch/s390/mm/pgtable.c                        |   2 +-
 drivers/gpu/drm/nouveau/include/nvif/if000c.h |   1 +
 drivers/gpu/drm/nouveau/nouveau_svm.c         | 120 +++-
 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/rmap.h                          |   8 +-
 include/linux/swap.h                          |   8 +-
 include/linux/swapops.h                       | 105 ++--
 lib/test_hmm.c                                | 124 ++++
 lib/test_hmm_uapi.h                           |   2 +
 mm/debug_vm_pgtable.c                         |  12 +-
 mm/hmm.c                                      |  12 +-
 mm/huge_memory.c                              |  36 +-
 mm/hugetlb.c                                  |  10 +-
 mm/memcontrol.c                               |   2 +-
 mm/memory.c                                   | 128 +++-
 mm/migrate.c                                  |  41 +-
 mm/mprotect.c                                 |  18 +-
 mm/page_vma_mapped.c                          |  15 +-
 mm/rmap.c                                     | 558 +++++++++++++++---
 tools/testing/selftests/vm/hmm-tests.c        | 219 +++++++
 23 files changed, 1207 insertions(+), 259 deletions(-)

-- 
2.20.1



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

end of thread, other threads:[~2021-03-04 23:54 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26  7:18 [PATCH v3 0/8] Add support for SVM atomics in Nouveau Alistair Popple
2021-02-26  7:18 ` [PATCH v3 1/8] mm: Remove special swap entry functions Alistair Popple
2021-02-26 15:59   ` Christoph Hellwig
2021-03-02  8:52     ` Alistair Popple
2021-03-01 17:46   ` Jason Gunthorpe
2021-03-02  0:21     ` Alistair Popple
2021-02-26  7:18 ` [PATCH v3 2/8] mm/swapops: Rework swap entry manipulation code Alistair Popple
2021-02-26 16:00   ` Christoph Hellwig
2021-03-01 17:47   ` Jason Gunthorpe
2021-02-26  7:18 ` [PATCH v3 3/8] mm/rmap: Split try_to_munlock from try_to_unmap Alistair Popple
2021-02-26 16:01   ` Christoph Hellwig
2021-03-01 16:10   ` Jason Gunthorpe
2021-03-04  4:27     ` Alistair Popple
2021-02-26  7:18 ` [PATCH v3 4/8] mm/rmap: Split migration into its own function Alistair Popple
2021-02-26 16:03   ` Christoph Hellwig
     [not found]   ` <E93F89E1-3CE2-4CA3-97D9-6BCED78E1001@nvidia.com>
2021-03-04 23:54     ` Alistair Popple
2021-02-26  7:18 ` [PATCH v3 5/8] mm: Device exclusive memory access Alistair Popple
2021-03-01 17:54   ` Jason Gunthorpe
2021-03-01 22:55   ` Ralph Campbell
2021-03-02  0:05   ` Jason Gunthorpe
2021-03-02  8:57     ` Alistair Popple
     [not found]       ` <20210302124152.GF4247@nvidia.com>
2021-03-04  5:20         ` Alistair Popple
2021-02-26  7:18 ` [PATCH v3 6/8] mm: Selftests for exclusive device memory Alistair Popple
2021-03-01 17:55   ` Jason Gunthorpe
2021-03-01 18:07     ` Ralph Campbell
2021-03-01 23:14   ` Ralph Campbell
2021-03-02  9:12     ` Alistair Popple
2021-02-26  7:18 ` [PATCH v3 7/8] nouveau/svm: Refactor nouveau_range_fault Alistair Popple
2021-02-26  7:18 ` [PATCH v3 8/8] nouveau/svm: Implement atomic SVM access Alistair Popple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).