mbox series

[v2,00/29] Introduce GPU SVM and Xe SVM implementation

Message ID 20241016032518.539495-1-matthew.brost@intel.com (mailing list archive)
Headers show
Series Introduce GPU SVM and Xe SVM implementation | expand

Message

Matthew Brost Oct. 16, 2024, 3:24 a.m. UTC
Version 2 of GPU SVM has been promoted to the proper series from an RFC.
Thanks to everyone (especially Sima and Thomas) for their numerous
reviews on revision 1 and for helping to address many design issues.

This version has been tested with IGT [1] on PVC, BMG, and LNL.

Major changes in v2:
- Dropped mmap write abuse
- core MM locking and retry loops instead of driver locking to avoid races
- Removed physical to virtual references
- Embedded structure/ops for drm_gpusvm_devmem
- Fixed mremap and fork issues
- Added DRM pagemap
- Included RFC documentation in the kernel doc

Known issues in v2:
- gpusvm/pagemap is still located in the Xe directory; it can be moved
  to the drm directory in the next revision, but will remain in Xe for
  streamlined testing for now
- drm_gpusvm_range_evict looks up VMA; it may be possible to use
  hmm_range_fault here instead, with some minor tweaks to HMM

Matt

[1] https://patchwork.freedesktop.org/series/137545/#rev3

Matthew Brost (26):
  drm/xe: Retry BO allocation
  mm/migrate: Add migrate_device_prepopulated_range
  mm/migrate: Trylock device page in do_swap_page
  drm/gpusvm: Add support for GPU Shared Virtual Memory
  drm/xe/uapi: Add DRM_XE_VM_BIND_FLAG_SYSTEM_ALLOCATON flag
  drm/xe: Add SVM init / close / fini to faulting VMs
  drm/xe: Add SVM range invalidation
  drm/gpuvm: Add DRM_GPUVA_OP_USER
  drm/xe: Add (re)bind to SVM page fault handler
  drm/xe: Add SVM garbage collector
  drm/xe: Add unbind to SVM garbage collector
  drm/xe: Do not allow system allocator VMA unbind if the GPU has
    bindings
  drm/xe: Enable system allocator uAPI
  drm/xe: Add migrate layer functions for SVM support
  drm/xe: Add SVM device memory mirroring
  drm/xe: Add drm_gpusvm_devmem to xe_bo
  drm/xe: Add GPUSVM devic memory copy vfunc functions
  drm/xe: Add Xe SVM populate_devmem_pfn vfunc
  drm/xe: Add Xe SVM devmem_release vfunc
  drm/xe: Add BO flags required for SVM
  drm/xe: Add SVM VRAM migration
  drm/xe: Basic SVM BO eviction
  drm/xe: Add SVM debug
  drm/xe: Add modparam for SVM notifier size
  drm/xe: Add always_migrate_to_vram modparam
  drm/doc: gpusvm: Add GPU SVM documentation

Thomas Hellström (3):
  drm/pagemap: Add DRM pagemap
  drm/xe: Add dma_addr res cursor
  drm/xe: Add drm_pagemap ops to SVM

 Documentation/gpu/rfc/gpusvm.rst     |   70 +
 Documentation/gpu/rfc/index.rst      |    4 +
 drivers/gpu/drm/xe/Makefile          |    4 +-
 drivers/gpu/drm/xe/drm_gpusvm.c      | 2074 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/drm_gpusvm.h      |  447 ++++++
 drivers/gpu/drm/xe/drm_pagemap.h     |  103 ++
 drivers/gpu/drm/xe/xe_bo.c           |   43 +-
 drivers/gpu/drm/xe/xe_bo.h           |    2 +
 drivers/gpu/drm/xe/xe_bo_types.h     |    5 +
 drivers/gpu/drm/xe/xe_device_types.h |   15 +
 drivers/gpu/drm/xe/xe_gt_pagefault.c |   17 +-
 drivers/gpu/drm/xe/xe_migrate.c      |  149 ++
 drivers/gpu/drm/xe/xe_migrate.h      |   10 +
 drivers/gpu/drm/xe/xe_module.c       |    7 +
 drivers/gpu/drm/xe/xe_module.h       |    2 +
 drivers/gpu/drm/xe/xe_pt.c           |  362 ++++-
 drivers/gpu/drm/xe/xe_pt.h           |    3 +
 drivers/gpu/drm/xe/xe_pt_types.h     |    2 +
 drivers/gpu/drm/xe/xe_res_cursor.h   |  116 +-
 drivers/gpu/drm/xe/xe_svm.c          |  840 +++++++++++
 drivers/gpu/drm/xe/xe_svm.h          |   60 +
 drivers/gpu/drm/xe/xe_tile.c         |    5 +
 drivers/gpu/drm/xe/xe_vm.c           |  286 +++-
 drivers/gpu/drm/xe/xe_vm.h           |   15 +-
 drivers/gpu/drm/xe/xe_vm_types.h     |   44 +
 include/drm/drm_gpuvm.h              |    5 +
 include/linux/migrate.h              |    1 +
 include/uapi/drm/xe_drm.h            |   19 +-
 mm/memory.c                          |   13 +-
 mm/migrate_device.c                  |  104 +-
 30 files changed, 4695 insertions(+), 132 deletions(-)
 create mode 100644 Documentation/gpu/rfc/gpusvm.rst
 create mode 100644 drivers/gpu/drm/xe/drm_gpusvm.c
 create mode 100644 drivers/gpu/drm/xe/drm_gpusvm.h
 create mode 100644 drivers/gpu/drm/xe/drm_pagemap.h
 create mode 100644 drivers/gpu/drm/xe/xe_svm.c
 create mode 100644 drivers/gpu/drm/xe/xe_svm.h