Re: [PATCH v3 05/30] drm/gpusvm: Add support for GPU Shared Virtual Memory

2025-01-17 Thread Matthew Brost
On Fri, Jan 17, 2025 at 10:26:16AM +0200, Gwan-gyeong Mun wrote: > > > On 12/18/24 1:33 AM, Matthew Brost wrote: > > This patch introduces support for GPU Shared Virtual Memory (SVM) in the > > Direct Rendering Manager (DRM) subsystem. SVM allows for seamless > > sh

Re: [PATCH v15 4/9] drm/ttm/pool, drm/ttm/tt: Provide a helper to shrink pages

2025-01-15 Thread Matthew Brost
hen restoring a multi-order page (Christian König) > - Update documentation. > > Cc: Christian König > Cc: Somalapuram Amaranath > Cc: Matthew Brost Reviewed-by: Matthew Brost > Cc: > Signed-off-by: Thomas Hellström > --- > drivers/gpu/drm/ttm/ttm_pool

Re: [PATCH v3 05/30] drm/gpusvm: Add support for GPU Shared Virtual Memory

2025-01-10 Thread Matthew Brost
On Tue, Dec 17, 2024 at 03:33:23PM -0800, Matthew Brost wrote: > This patch introduces support for GPU Shared Virtual Memory (SVM) in the > Direct Rendering Manager (DRM) subsystem. SVM allows for seamless > sharing of memory between the CPU and GPU, enhancing performance and > flexib

Re: [PATCH v15 3/9] drm/ttm/pool: Restructure the pool allocation code

2025-01-10 Thread Matthew Brost
ich would enable using write-back cached pools when > allocating memory for other caching modes, rather than to resort > to allocating from the system directly. > > v15: > - Introduce this patch to simplify the upcoming patch that introduces > restore while allocating. > &

Re: [RFC 00/14] Deadline scheduler and other ideas

2025-01-10 Thread Matthew Brost
On Fri, Jan 10, 2025 at 09:16:44AM +, Tvrtko Ursulin wrote: > > On 09/01/2025 19:59, Matthew Brost wrote: > > On Wed, Jan 08, 2025 at 06:55:16PM +, Tvrtko Ursulin wrote: > > > > > > On 08/01/2025 16:57, Danilo Krummrich wrote: > > > > On Wed

Re: [RFC 00/14] Deadline scheduler and other ideas

2025-01-09 Thread Matthew Brost
On Wed, Jan 08, 2025 at 06:55:16PM +, Tvrtko Ursulin wrote: > > On 08/01/2025 16:57, Danilo Krummrich wrote: > > On Wed, Jan 08, 2025 at 03:13:39PM +, Tvrtko Ursulin wrote: > > > > > > On 08/01/2025 08:31, Danilo Krummrich wrote: > > > > On Mon, Dec 30, 2024 at 04:52:45PM +, Tvrtko Ur

Re: [RFC 00/14] Deadline scheduler and other ideas

2025-01-09 Thread Matthew Brost
On Wed, Jan 08, 2025 at 05:57:25PM +0100, Danilo Krummrich wrote: > On Wed, Jan 08, 2025 at 03:13:39PM +, Tvrtko Ursulin wrote: Hi, all. Just catching up on this post holidays. A few thoughts below. > > > > On 08/01/2025 08:31, Danilo Krummrich wrote: > > > On Mon, Dec 30, 2024 at 04:52:45P

Re: [PATCH v3 05/30] drm/gpusvm: Add support for GPU Shared Virtual Memory

2025-01-07 Thread Matthew Brost
On Tue, Dec 17, 2024 at 03:33:23PM -0800, Matthew Brost wrote: > This patch introduces support for GPU Shared Virtual Memory (SVM) in the > Direct Rendering Manager (DRM) subsystem. SVM allows for seamless > sharing of memory between the CPU and GPU, enhancing performance and > flexib

Re: [PATCH V6] drm/xe/mmap: Add mmap support for PCI memory barrier

2025-01-01 Thread Matthew Brost
On Wed, Dec 18, 2024 at 06:26:28PM +0530, Tejas Upadhyay wrote: > In order to avoid having userspace to use MI_MEM_FENCE, > we are adding a mechanism for userspace to generate a > PCI memory barrier with low overhead (avoiding IOCTL call > as well as writing to VRAM will adds some overhead). > > T

Re: [PATCH v3 05/30] drm/gpusvm: Add support for GPU Shared Virtual Memory

2024-12-20 Thread Matthew Brost
On Tue, Dec 17, 2024 at 03:33:23PM -0800, Matthew Brost wrote: > This patch introduces support for GPU Shared Virtual Memory (SVM) in the > Direct Rendering Manager (DRM) subsystem. SVM allows for seamless > sharing of memory between the CPU and GPU, enhancing performance and > flexib

Re: [PATCH v3 15/30] drm/xe: Add unbind to SVM garbage collector

2024-12-20 Thread Matthew Brost
On Sat, Dec 21, 2024 at 12:20:09AM +0530, Ghimiray, Himal Prasad wrote: > > > On 18-12-2024 05:03, Matthew Brost wrote: > > Add unbind to SVM garbage collector. To facilitate add unbind support > > function to VM layer which unbinds a SVM range. Also teach PY layer to >

Re: [PATCH v3 19/30] drm/xe: Add SVM device memory mirroring

2024-12-20 Thread Matthew Brost
On Sat, Dec 21, 2024 at 12:09:55AM +0530, Ghimiray, Himal Prasad wrote: > > > On 18-12-2024 05:03, Matthew Brost wrote: > > Add SVM device memory mirroring which enables device pages for > > migration. Enabled via CONFIG_XE_DEVMEM_MIRROR Kconfig. Kconfig option > >

Re: [PATCH v3 27/30] drm/xe: Basic SVM BO eviction

2024-12-18 Thread Matthew Brost
On Tue, Dec 17, 2024 at 03:33:45PM -0800, Matthew Brost wrote: > Wire xe_bo_move to GPU SVM migration via new helper xe_svm_bo_evict. > Somehow lost the xe_bo.c changes in this rev which call xe_svm_bo_evict. Ignore this patch. Matt > v2: > - Use xe_svm_bo_evict > - Drop

[PATCH v3 03/30] mm/migrate: Trylock device page in do_swap_page

2024-12-17 Thread Matthew Brost
ff-by: Matthew Brost --- mm/memory.c | 13 ++--- mm/migrate_device.c | 64 - 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 75c2dfd04f72..ae8b11131dad 100644 --- a/mm/memory.c +++ b/mm/mem

[PATCH v3 21/30] drm/xe: Add drm_pagemap ops to SVM

2024-12-17 Thread Matthew Brost
Signed-off-by: Matthew Brost Signed-off-by: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/xe/xe_device_types.h | 7 +++ drivers/gpu/drm/xe/xe_svm.c | 30 2 files changed, 37 insertions(+) diff --git a/drivers/gpu/drm/xe

[PATCH v3 12/30] drm/gpuvm: Add DRM_GPUVA_OP_DRIVER

2024-12-17 Thread Matthew Brost
Add DRM_GPUVA_OP_DRIVER which allows driver to define their own gpuvm ops. Useful for driver created ops which can be passed into the bind software pipeline. v3: - s/DRM_GPUVA_OP_USER/DRM_GPUVA_OP_DRIVER (Thomas) - Better commit message (Thomas) Cc: Danilo Krummrich Signed-off-by: Matthew

[PATCH v3 19/30] drm/xe: Add SVM device memory mirroring

2024-12-17 Thread Matthew Brost
: Niranjana Vishwanathapura Signed-off-by: Oak Zeng Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/Kconfig | 9 drivers/gpu/drm/xe/xe_device_types.h | 8 drivers/gpu/drm/xe/xe_svm.c | 62 +++- drivers/gpu/drm/xe/xe_svm.h | 3

[PATCH v3 20/30] drm/xe: Add drm_gpusvm_devmem to xe_bo

2024-12-17 Thread Matthew Brost
Add drm_gpusvm_devmem to xe_bo. Required to enable SVM migrations. Signed-off-by: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_bo_types.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_bo_types.h b/drivers/gpu/drm/xe/xe_bo_types.h index

[PATCH v3 23/30] drm/xe: Add Xe SVM populate_devmem_pfn GPU SVM vfunc

2024-12-17 Thread Matthew Brost
ff-by: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_svm.c | 40 + 1 file changed, 40 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c index dcd99520a6d9..16d526b2d19a 100644 --- a/drivers/gpu/d

[PATCH v3 18/30] drm/xe: Add migrate layer functions for SVM support

2024-12-17 Thread Matthew Brost
homas) - Return error to large of migration (Thomas) Signed-off-by: Oak Zeng Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_migrate.c | 175 drivers/gpu/drm/xe/xe_migrate.h | 10 ++ 2 files changed, 185 insertions(+) diff --git a/drivers/gpu/d

[PATCH v3 29/30] drm/xe: Add modparam for SVM notifier size

2024-12-17 Thread Matthew Brost
Useful to experiment with notifier size and how it affects performance. v3: - Pull missing changes including in following patch (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_module.c | 4 drivers/gpu/drm/xe/xe_module.h | 1 + drivers/gpu/drm/xe/xe_svm.c| 4 +++- 3

[PATCH v3 26/30] drm/xe: Add SVM VRAM migration

2024-12-17 Thread Matthew Brost
range structure (Thomas) - Hide migration behind Kconfig - Kernel doc (Thomas) - Use check_pages_threshold Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_svm.c | 102 ++-- drivers/gpu/drm/xe/xe_svm.h | 5 ++ 2 files changed, 103 insertions(+), 4

[PATCH v3 28/30] drm/xe: Add SVM debug

2024-12-17 Thread Matthew Brost
Add some useful SVM debug logging fro SVM range which prints the range's state. v2: - Upadte logging with latest structure layout v3: - Better commit message (Thomas) - New range structure (Thomas) - s/COLLECTOT/s/COLLECTOR (Thomas) Signed-off-by: Matthew Brost Reviewed-by: Thomas Hell

[PATCH v3 30/30] drm/xe: Add always_migrate_to_vram modparam

2024-12-17 Thread Matthew Brost
-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_module.c | 5 - drivers/gpu/drm/xe/xe_module.h | 1 + drivers/gpu/drm/xe/xe_svm.c| 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c index 2126e99ede01

[PATCH v3 05/30] drm/gpusvm: Add support for GPU Shared Virtual Memory

2024-12-17 Thread Matthew Brost
(Thomas) - Move some static inlines from head to C file (Thomas) - Don't allocate pages under page lock in drm_gpusvm_migrate_populate_ram_pfn (Thomas) - Change check_pages to a threshold Cc: Simona Vetter Cc: Dave Airlie Cc: Christian König Cc: Signed-off-by: Matthew Brost Signe

[PATCH v3 24/30] drm/xe: Add Xe SVM devmem_release GPU SVM vfunc

2024-12-17 Thread Matthew Brost
Implement with a simple BO put which releases the device memory. v2: - Use new drm_gpusvm_devmem_ops v3: - Better commit message (Thomas) Signed-off-by: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_svm.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a

[PATCH v3 16/30] drm/xe: Do not allow CPU address mirror VMA unbind if the GPU has bindings

2024-12-17 Thread Matthew Brost
as it simplifies the code. This decision can always be revisited if a use case arises. v3: - s/arrises/arises (Thomas) - s/system allocator/GPU address mirror (Thomas) - Kernel doc (Thomas) - Newline between function defs (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_svm.c

[PATCH v3 22/30] drm/xe: Add GPUSVM device memory copy vfunc functions

2024-12-17 Thread Matthew Brost
xe_svm_copy to clarify behavior (Thomas) - Better commit message (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_svm.c | 179 1 file changed, 179 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c index

[PATCH v3 15/30] drm/xe: Add unbind to SVM garbage collector

2024-12-17 Thread Matthew Brost
/DRM_GPUVA_OP_USER/DRM_GPUVA_OP_DRIVER (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 84 ++-- drivers/gpu/drm/xe/xe_svm.c | 9 +++- drivers/gpu/drm/xe/xe_vm.c | 83 +++ drivers/gpu/drm/xe/xe_vm.h | 2

[PATCH v3 10/30] drm/xe: Nuke VM's mapping upon close

2024-12-17 Thread Matthew Brost
into SVM series (Thomas) - Wait for pending binds (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 24 + drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h | 2 ++ drivers/gpu/drm/xe/xe_pt.c | 14 drivers/gpu

[PATCH v3 09/30] drm/xe: Add dma_addr res cursor

2024-12-17 Thread Matthew Brost
From: Thomas Hellström Add dma_addr res cursor which walks an array of drm_pagemap_dma_addr. Useful for SVM ranges and programing page tables. v3: - Better commit message (Thomas) - Use new drm_pagemap.h location Signed-off-by: Matthew Brost Signed-off-by: Thomas Hellström --- drivers/gpu

[PATCH v3 11/30] drm/xe: Add SVM range invalidation and page fault handler

2024-12-17 Thread Matthew Brost
pings are unmapped on VM close (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_gt_pagefault.c | 17 +- drivers/gpu/drm/xe/xe_pt.c | 41 + drivers/gpu/drm/xe/xe_pt.h | 2 + drivers/gpu/drm/xe/xe_svm.c | 223 ++- drivers/gp

[PATCH v3 27/30] drm/xe: Basic SVM BO eviction

2024-12-17 Thread Matthew Brost
Wire xe_bo_move to GPU SVM migration via new helper xe_svm_bo_evict. v2: - Use xe_svm_bo_evict - Drop bo->range v3: - Kernel doc (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_svm.c | 14 ++ drivers/gpu/drm/xe/xe_svm.h | 2 ++ 2 files changed, 16 inserti

[PATCH v3 14/30] drm/xe: Add SVM garbage collector

2024-12-17 Thread Matthew Brost
: - Better commit message (Thomas) - Kernel doc (Thomas) - Use list_first_entry_or_null for garbage collector loop (Thomas) - Don't add to garbage collector if VM is closed (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_svm.c | 90 +++- drivers/gp

[PATCH v3 17/30] drm/xe: Enable CPU address mirror uAPI

2024-12-17 Thread Matthew Brost
Support for CPU address mirror bindings in SRAM fully in place, enable the implementation. v3: - s/system allocator/CPU address mirror (Thomas) Signed-off-by: Matthew Brost Reviewed-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_svm.c | 10 ++ drivers/gpu/drm/xe/xe_vm.c | 6

[PATCH v3 25/30] drm/xe: Add BO flags required for SVM

2024-12-17 Thread Matthew Brost
for system allocator BOs v3: - s/XE_BO_FLAG_SYSTEM_ALLOC/XE_BO_FLAG_CPU_ADDR_MIRROR (Thomas) - Better commit message (Thomas) - Drop XE_BO_FLAG_SKIP_CLEAR for now - Add comment about possibly supporting CCS (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_bo.c | 12 d

[PATCH v3 07/30] drm/xe/uapi: Add DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR flag

2024-12-17 Thread Matthew Brost
YSTEM_ALLOCATOR/DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR (Thomas) - Rework commit message for expected usage (Thomas) - Describe state of code after patch in commit message (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 76 drivers/gpu/drm/xe/xe_v

[PATCH v3 13/30] drm/xe: Add (re)bind to SVM page fault handler

2024-12-17 Thread Matthew Brost
- Use drm_pagemap dma cursor - Take notifier lock in bind code to check range state v3: - Use new GPU SVM range structure (Thomas) - Kernel doc (Thomas) - s/DRM_GPUVA_OP_USER/DRM_GPUVA_OP_DRIVER (Thomas) Signed-off-by: Thomas Hellström Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe

[PATCH v3 08/30] drm/xe: Add SVM init / close / fini to faulting VMs

2024-12-17 Thread Matthew Brost
(Thomas) - Newlines between functions in xe_svm.h (Thomas) - Call drm_gpusvm_driver_set_lock in init (Thomas) Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_svm.c | 73 drivers/gpu/drm/xe/xe_svm.h | 17

[PATCH v3 06/30] drm/xe: Select DRM_GPUSVM Kconfig

2024-12-17 Thread Matthew Brost
Xe depends on DRM_GPUSVM for SVM implementation, select it in Kconfig. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig index b51a2bde73e2..3a08e16bfada 100644 --- a/drivers

[PATCH v3 02/30] mm/migrate: Add migrate_device_pfns

2024-12-17 Thread Matthew Brost
/migrate_device_prepopulated_range - Drop extra mmu invalidation (Vetter) v3: - s/migrate_device_prepopulated_range/migrate_device_pfns (Alistar) - Use helper to lock device pages (Alistar) - Update commit message with why this is required (Alistar) Cc: Andrew Morton Signed-off-by: Matthew Brost --- include/linux

[PATCH v3 04/30] drm/pagemap: Add DRM pagemap

2024-12-17 Thread Matthew Brost
works, let the memory provider (drm_pagemap) provide the mapping functionality. v3: - Move to drm level include Signed-off-by: Matthew Brost Signed-off-by: Thomas Hellström --- include/drm/drm_pagemap.h | 103 ++ 1 file changed, 103 insertions(+) create m

[PATCH v3 01/30] drm/xe: Retry BO allocation

2024-12-17 Thread Matthew Brost
TTM doesn't support fair eviction via WW locking, this mitigated in by using retry loops in exec and preempt rebind worker. Extend this retry loop to BO allocation. Once TTM supports fair eviction this patch can be reverted. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_bo.

[PATCH v3 00/30] Introduce GPU SVM and Xe SVM implementation

2024-12-17 Thread Matthew Brost
mpute-runtime/pull/782 Matthew Brost (27): drm/xe: Retry BO allocation mm/migrate: Add migrate_device_pfns mm/migrate: Trylock device page in do_swap_page drm/gpusvm: Add support for GPU Shared Virtual Memory drm/xe: Select DRM_GPUSVM Kconfig drm/xe/uapi: Add DRM_XE_VM_BIND_FLAG_CPU_ADDR_M

Re: [PATCH v2 29/29] drm/doc: gpusvm: Add GPU SVM documentation

2024-12-17 Thread Matthew Brost
On Mon, Dec 02, 2024 at 02:00:44PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add documentation for agree upon GPU SVM design principles, current > > status, and future plans. > > > > Signed-off-by: Matthew Brost >

Re: [PATCH v2 26/29] drm/xe: Add SVM debug

2024-12-16 Thread Matthew Brost
On Mon, Dec 02, 2024 at 01:33:29PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add some useful SVM debug logging. > > > > v2: > >  - Upadte logging with latest structure layout > > > > Signed-off-by: Matthew

Re: [PATCH] drm/amdgpu: Make the submission path memory reclaim safe

2024-12-16 Thread Matthew Brost
ko's patch is indeed accurate. For what it's worth, we encountered several similar bugs in Xe that emerged once we added the correct work queue annotations. > > There is no need to use WQ_MEM_RECLAIM for the workqueue or do I miss > > something? > > > >

Re: [PATCH v2 12/29] drm/xe: Add SVM garbage collector

2024-12-16 Thread Matthew Brost
On Mon, Dec 16, 2024 at 11:36:20AM +0100, Thomas Hellström wrote: > On Wed, 2024-12-11 at 11:17 -0800, Matthew Brost wrote: > > On Tue, Nov 19, 2024 at 03:45:33PM +0100, Thomas Hellström wrote: > > > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > > > A

Re: [PATCH v2 09/29] drm/xe: Add SVM range invalidation

2024-12-16 Thread Matthew Brost
On Mon, Dec 16, 2024 at 11:01:23AM +0100, Thomas Hellström wrote: > On Wed, 2024-12-11 at 11:01 -0800, Matthew Brost wrote: > > On Tue, Nov 19, 2024 at 02:56:12PM +0100, Thomas Hellström wrote: > > > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > > > Ad

Re: [PATCH v2 18/29] drm/xe: Add drm_gpusvm_devmem to xe_bo

2024-12-14 Thread Matthew Brost
On Tue, Nov 19, 2024 at 05:51:50PM +0100, Thomas Hellström wrote: > > > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add drm_gpusvm_devmem to xe_bo. Required to enable SVM migrations. > > > > Signed-off-by: Matthew Brost > > --- > >

Re: [PATCH v2 09/29] drm/xe: Add SVM range invalidation

2024-12-14 Thread Matthew Brost
On Wed, Dec 11, 2024 at 11:01:14AM -0800, Matthew Brost wrote: > On Tue, Nov 19, 2024 at 02:56:12PM +0100, Thomas Hellström wrote: > > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > > Add SVM range invalidation vfunc. > > > > > > v2: > > &

Re: [PATCH v2 03/29] mm/migrate: Trylock device page in do_swap_page

2024-12-13 Thread Matthew Brost
On Fri, Dec 13, 2024 at 02:16:51PM -0800, Matthew Brost wrote: > On Fri, Nov 29, 2024 at 10:31:32AM +1100, Alistair Popple wrote: > > > > Matthew Brost writes: > > > > > Avoid multiple CPU page faults to the same device page racing by trying > > > to lock

Re: [PATCH v2 05/29] drm/gpusvm: Add support for GPU Shared Virtual Memory

2024-12-13 Thread Matthew Brost
On Fri, Nov 29, 2024 at 11:00:24AM +1100, Alistair Popple wrote: > > Matthew Brost writes: > > [...] > > > + * 3) Invalidation driver vfunc. > > + * > > + * void driver_invalidation(struct drm_gpusvm *gpusvm, > > + *

Re: [PATCH v2 03/29] mm/migrate: Trylock device page in do_swap_page

2024-12-13 Thread Matthew Brost
On Fri, Nov 29, 2024 at 10:31:32AM +1100, Alistair Popple wrote: > > Matthew Brost writes: > > > Avoid multiple CPU page faults to the same device page racing by trying > > to lock the page in do_swap_page before taking an extra reference to the > > page. This preven

Re: [PATCH 14/26] drm/xe/eudebug: implement userptr_vma access

2024-12-13 Thread Matthew Brost
On Thu, Dec 12, 2024 at 11:12:39AM +0100, Simona Vetter wrote: > On Thu, Dec 12, 2024 at 09:49:24AM +0100, Thomas Hellström wrote: > > On Mon, 2024-12-09 at 16:31 +0100, Simona Vetter wrote: > > > On Mon, Dec 09, 2024 at 03:03:04PM +0100, Christian König wrote: > > > > Am 09.12.24 um 14:33 schrieb

Re: [PATCH v2 19/29] drm/xe: Add GPUSVM devic memory copy vfunc functions

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 11:13:55AM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add GPUSVM devic memory copy vfunc functions and connect to migration > > s/devic/device Yes. > > > > > layer. > > >

Re: [PATCH v2 23/29] drm/xe: Add BO flags required for SVM

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 11:44:47AM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add XE_BO_FLAG_SYSTEM_ALLOC to indicate BO is tied to SVM range. > > > > Add XE_BO_FLAG_SKIP_CLEAR to indicate BO does not need to cleared. > &

Re: [PATCH v2 24/29] drm/xe: Add SVM VRAM migration

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 01:06:33PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Migration is implemented with range granularity, with VRAM backing > > being > > a VM private TTM BO (i.e., shares dma-resv with VM). The lifetime

Re: [PATCH v2 28/29] drm/xe: Add always_migrate_to_vram modparam

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 01:40:20PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Used to show we can bounce memory multiple times. > > > > Signed-off-by: Matthew Brost > > --- > >  drivers/gpu/drm/xe/xe_module.c |

Re: [PATCH v2 27/29] drm/xe: Add modparam for SVM notifier size

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 01:37:46PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Useful to experiment with notifier size and how it affects > > performance. > > > > Signed-off-by: Matthew Brost > > --- > &

Re: [PATCH v2 25/29] drm/xe: Basic SVM BO eviction

2024-12-11 Thread Matthew Brost
On Mon, Dec 02, 2024 at 01:27:24PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Wire xe_bo_move to GPUSVM migration to SRAM with trylocking of mmap > > lock. > > > > v2: > >  - Use xe_svm_bo_evict > >  

Re: [PATCH v2 17/29] drm/xe: Add SVM device memory mirroring

2024-12-11 Thread Matthew Brost
On Wed, Nov 20, 2024 at 05:05:32AM +0200, Gwan-gyeong Mun wrote: > > > On 10/16/24 6:25 AM, Matthew Brost wrote: > > +/** > > + * xe_devm_add: Remap and provide memmap backing for device memory > > + * @tile: tile that the memory region belongs to > >

Re: [PATCH v2 12/29] drm/xe: Add SVM garbage collector

2024-12-11 Thread Matthew Brost
On Tue, Nov 19, 2024 at 03:45:33PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add basic SVM garbage collector which can destroy an SVM range upon > > an > > MMU UNMAP event. > > > > v2: > >  -

Re: [PATCH v2 16/29] drm/xe: Add migrate layer functions for SVM support

2024-12-11 Thread Matthew Brost
On Wed, Nov 20, 2024 at 09:04:20AM +0100, Thomas Hellström wrote: > On Tue, 2024-11-19 at 15:08 -0800, Matthew Brost wrote: > > On Tue, Nov 19, 2024 at 05:45:27PM +0100, Thomas Hellström wrote: > > > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > > >

Re: [PATCH v2 11/29] drm/xe: Add (re)bind to SVM page fault handler

2024-12-11 Thread Matthew Brost
On Tue, Nov 19, 2024 at 03:26:32PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add (re)bind to SVM page fault handler. To facilitate add support > > function to VM layer which (re)binds a SVM range. Also teach PT layer > >

Re: [PATCH v2 09/29] drm/xe: Add SVM range invalidation

2024-12-11 Thread Matthew Brost
On Tue, Nov 19, 2024 at 02:56:12PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > Add SVM range invalidation vfunc. > > > > v2: > >  - Don't run invalidation if VM is closed > >  - Cycle not

Re: [PATCH v6 2/8] drm/ttm: Add ttm_bo_access

2024-11-26 Thread Matthew Brost
On Tue, Nov 26, 2024 at 09:19:47AM +0100, Christian König wrote: > Am 25.11.24 um 18:27 schrieb Matthew Brost: > > On Mon, Nov 25, 2024 at 05:19:54PM +0100, Christian König wrote: > > > Am 25.11.24 um 16:29 schrieb Matthew Brost: > > > > On Fri, Nov 15, 2024 at 1

[PATCH v7 8/8] drm/xe: Only allow contiguous BOs to use xe_bo_vmap

2024-11-26 Thread Matthew Brost
xe_bo_vmap only works on contiguous BOs, disallow xe_bo_vmap on BO unless we are certain the BO is contiguous. Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_bo.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a

[PATCH v7 3/8] drm/xe: Add xe_ttm_access_memory

2024-11-26 Thread Matthew Brost
offset (Mika) Reported-by: Christoph Manszewski Suggested-by: Thomas Hellström Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_bo.c | 59 -- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe

[PATCH v7 4/8] drm/xe: Take PM ref in delayed snapshot capture worker

2024-11-26 Thread Matthew Brost
The delayed snapshot capture worker can access the GPU or VRAM both of which require a PM reference. Take a reference in this worker. Cc: Rodrigo Vivi Cc: Maarten Lankhorst Fixes: 4f04d07c0a94 ("drm/xe: Faster devcoredump") Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --

[PATCH v7 7/8] drm/xe: Set XE_BO_FLAG_PINNED in migrate selftest BOs

2024-11-26 Thread Matthew Brost
We only allow continguous BOs to be vmapped, set XE_BO_FLAG_PINNED on BOs in migrate selftest as this forces continguous BOs and selftest uses vmaps. Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/tests/xe_migrate.c | 13 + 1 file changed, 9

[PATCH v7 1/8] drm/xe: Add xe_bo_vm_access

2024-11-26 Thread Matthew Brost
Add xe_bo_vm_access which is wrapper around ttm_bo_vm_access which takes rpm refs for device access. Suggested-by: Thomas Hellström Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/xe_bo.c | 17 - 1 file changed, 16 insertions(+), 1 deletion

[PATCH v7 6/8] drm/xe: Use ttm_bo_access in xe_vm_snapshot_capture_delayed

2024-11-26 Thread Matthew Brost
Non-contiguous mapping of BO in VRAM doesn't work, use ttm_bo_access instead. v2: - Fix error handling Fixes: 0eb2a18a8fad ("drm/xe: Implement VM snapshot support for BO's and userptr") Suggested-by: Matthew Auld Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld ---

[PATCH v7 5/8] drm/xe/display: Update intel_bo_read_from_page to use ttm_bo_access

2024-11-26 Thread Matthew Brost
Don't open code vmap of a BO, use ttm_bo_access helper which is safe for non-contiguous BOs and non-visible BOs. Suggested-by: Matthew Auld Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld --- drivers/gpu/drm/xe/display/intel_bo.c | 25 + 1 file chang

[PATCH v7 0/8] Fix non-contiguous VRAM BO access in Xe

2024-11-26 Thread Matthew Brost
Fully reviewed and resending for final CI. Dropping non-visible patch for now as it a bit larger, not strickly required to unblock EU debug, and be sent independently in a follow up. Matt Matthew Brost (8): drm/xe: Add xe_bo_vm_access drm/ttm: Add ttm_bo_access drm/xe: Add

[PATCH v7 2/8] drm/ttm: Add ttm_bo_access

2024-11-26 Thread Matthew Brost
ttm_bo_access to ttm_bo_vm.c (Christian) Cc: Christian König Reported-by: Christoph Manszewski Suggested-by: Thomas Hellström Signed-off-by: Matthew Brost Tested-by: Mika Kuoppala Reviewed-by: Matthew Auld --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 40 ++--- include/drm/ttm

Re: [PATCH v6 2/8] drm/ttm: Add ttm_bo_access

2024-11-25 Thread Matthew Brost
On Mon, Nov 25, 2024 at 05:19:54PM +0100, Christian König wrote: > Am 25.11.24 um 16:29 schrieb Matthew Brost: > > On Fri, Nov 15, 2024 at 10:27:59AM -0800, Matthew Brost wrote: > > > [SNIP] > > > We use this interface to read a BO marked with a dumpable flag during a

Re: [PATCH v6 2/8] drm/ttm: Add ttm_bo_access

2024-11-25 Thread Matthew Brost
On Fri, Nov 15, 2024 at 10:27:59AM -0800, Matthew Brost wrote: > On Wed, Nov 13, 2024 at 12:42:35PM +0100, Christian König wrote: > > Am 13.11.24 um 11:44 schrieb Thomas Hellström: > > > On Wed, 2024-11-13 at 09:37 +0100, Christian König wrote: > > > > Am 12.11.24 um

Re: [PATCH 1/2] drm/sched: add WARN_ON and BUG_ON to drm_sched_fini

2024-11-22 Thread Matthew Brost
On Fri, Nov 22, 2024 at 05:24:03PM +0100, Philipp Stanner wrote: > On Thu, 2024-11-21 at 10:05 -0800, Matthew Brost wrote: > > On Tue, Oct 29, 2024 at 08:22:22AM +0100, Philipp Stanner wrote: > > > Christian, Sima? > > > > > > Matthew? (+CC) > > > &

Re: [RFC PATCH 02/29] dma-fence: Add dma_fence_user_fence

2024-11-21 Thread Matthew Brost
On Thu, Nov 21, 2024 at 10:31:16AM +0100, Christian König wrote: > Am 20.11.24 um 23:50 schrieb Matthew Brost: > > On Wed, Nov 20, 2024 at 02:38:49PM +0100, Christian König wrote: > > > Am 19.11.24 um 00:37 schrieb Matthew Brost: > > > > Normalize user fence attachmen

Re: [RFC PATCH 01/29] dma-fence: Add dma_fence_preempt base class

2024-11-21 Thread Matthew Brost
On Thu, Nov 21, 2024 at 11:04:47AM +0100, Christian König wrote: > Am 20.11.24 um 18:36 schrieb Matthew Brost: > > On Wed, Nov 20, 2024 at 02:31:50PM +0100, Christian König wrote: > > > Am 19.11.24 um 00:37 schrieb Matthew Brost: > > > > Add a dma_fence_preempt

Re: [PATCH 1/2] drm/sched: add WARN_ON and BUG_ON to drm_sched_fini

2024-11-21 Thread Matthew Brost
On Thu, Nov 21, 2024 at 10:06:54AM +0100, Philipp Stanner wrote: > +CC Thomas Hellström > > > On Mon, 2024-11-18 at 12:48 +0100, Christian König wrote: > >  Am 15.11.24 um 17:07 schrieb Philipp Stanner: > >   > > >   > > > On Fri, 2024-11-15 at 15:39 +0100, Christian König wrote: > > >   > > > >

Re: [PATCH 1/2] drm/sched: add WARN_ON and BUG_ON to drm_sched_fini

2024-11-21 Thread Matthew Brost
On Tue, Oct 29, 2024 at 08:22:22AM +0100, Philipp Stanner wrote: > Christian, Sima? > > Matthew? (+CC) > Sorry catching up here. Internally in Xe we ref count the scheduler as the scheduler is embedded into our user queue structure (xe_exec_queue). Jobs ref the queue once they are armed. Upon qu

Re: [PATCH v2 07/29] drm/xe: Add SVM init / close / fini to faulting VMs

2024-11-20 Thread Matthew Brost
On Tue, Nov 19, 2024 at 01:13:26PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > Add SVM init / close / fini to faulting VMs. Minimual implementation. > > > > v2: > >  - Add close function > > > > Signed-off-

Re: [RFC PATCH 02/29] dma-fence: Add dma_fence_user_fence

2024-11-20 Thread Matthew Brost
On Wed, Nov 20, 2024 at 02:38:49PM +0100, Christian König wrote: > Am 19.11.24 um 00:37 schrieb Matthew Brost: > > Normalize user fence attachment to a DMA fence. A user fence is a simple > > seqno write to memory, implemented by attaching a DMA fence callback > > that

Re: [RFC PATCH 01/29] dma-fence: Add dma_fence_preempt base class

2024-11-20 Thread Matthew Brost
On Wed, Nov 20, 2024 at 02:31:50PM +0100, Christian König wrote: > Am 19.11.24 um 00:37 schrieb Matthew Brost: > > Add a dma_fence_preempt base class with driver ops to implement > > preemption, based on the existing Xe preemptive fence implementation. > > > > Annotat

Re: [PATCH v2 16/29] drm/xe: Add migrate layer functions for SVM support

2024-11-19 Thread Matthew Brost
On Tue, Nov 19, 2024 at 05:45:27PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add functions which migrate to / from VRAM accepting a single DPA > > argument (VRAM) and array of dma addresses (SRAM). > > > > v2: >

Re: [PATCH v2 13/29] drm/xe: Add unbind to SVM garbage collector

2024-11-19 Thread Matthew Brost
On Tue, Nov 19, 2024 at 04:31:05PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > Add unbind to SVM garbage collector. To facilitate add unbind support > > function to VM layer which unbinds a SVM range. Also teach PY layer > &

Re: [PATCH v2 14/29] drm/xe: Do not allow system allocator VMA unbind if the GPU has bindings

2024-11-19 Thread Matthew Brost
On Tue, Nov 19, 2024 at 05:33:11PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:25 -0700, Matthew Brost wrote: > > uAPI is designed with the the use case that only mapping a BO to a > > malloc'd address will unbind a system allocator VMA. Thus it doesn't

Re: [PATCH v2 10/29] drm/gpuvm: Add DRM_GPUVA_OP_USER

2024-11-19 Thread Matthew Brost
On Tue, Nov 19, 2024 at 02:57:56PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > Add DRM_GPUVA_OP_USER which allows driver to define their own gpuvm > > ops. > > > > Cc: Danilo Krummrich > > Signed-off-by: Matthe

Re: [PATCH v2 08/29] drm/xe: Add dma_addr res cursor

2024-11-19 Thread Matthew Brost
On Tue, Nov 19, 2024 at 01:15:12PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > From: Thomas Hellström > > > > Useful for SVM ranges in SRAM and programing page tables. > > We should look at providing a better commi

Re: [PATCH v2 06/29] drm/xe/uapi: Add DRM_XE_VM_BIND_FLAG_SYSTEM_ALLOCATON flag

2024-11-19 Thread Matthew Brost
On Mon, Nov 18, 2024 at 02:44:58PM +0100, Thomas Hellström wrote: > On Tue, 2024-10-15 at 20:24 -0700, Matthew Brost wrote: > > Add the DRM_XE_VM_BIND_FLAG_SYSTEM_ALLOCATOR flag, which is used to > > create unpopulated virtual memory areas (VMAs) without memory backing > > o

[RFC PATCH 21/29] drm/xe: Enable preempt fences on usermap queues

2024-11-18 Thread Matthew Brost
Preempt fences are used by usermap queues to implement dynamic memory (BO eviction, userptr invalidation), enable preempt fences on usermap queues. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_exec_queue.c | 3 ++- drivers/gpu/drm/xe/xe_pt.c | 3 +-- drivers/gpu/drm/xe

[RFC PATCH 13/29] drm/xe/mmap: Add mmap support for PCI memory barrier

2024-11-18 Thread Matthew Brost
From: Tejas Upadhyay In order to avoid having userspace to use MI_MEM_FENCE, we are adding a mechanism for userspace to generate a PCI memory barrier with low overhead (avoiding IOCTL call as well as writing to VRAM will adds some overhead). This is implemented by memory-mapping a page as uncach

[RFC PATCH 01/29] dma-fence: Add dma_fence_preempt base class

2024-11-18 Thread Matthew Brost
Add a dma_fence_preempt base class with driver ops to implement preemption, based on the existing Xe preemptive fence implementation. Annotated to ensure correct driver usage. Cc: Dave Airlie Cc: Simona Vetter Cc: Christian Koenig Signed-off-by: Matthew Brost --- drivers/dma-buf/Makefile

[RFC PATCH 27/29] drm/xe: Teach xe_sync layer about drm_xe_semaphore

2024-11-18 Thread Matthew Brost
Teach xe_sync layer about drm_xe_semaphore which is used import / export user fences. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_sync.c | 90 ++ drivers/gpu/drm/xe/xe_sync.h | 8 +++ drivers/gpu/drm/xe/xe_sync_types.h | 5 +- 3 files changed

[RFC PATCH 28/29] drm/xe: Add VM convert fence IOCTL

2024-11-18 Thread Matthew Brost
memory allocations). Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_device.c| 1 + drivers/gpu/drm/xe/xe_preempt_fence.c | 9 + drivers/gpu/drm/xe/xe_vm.c| 247 +- drivers/gpu/drm/xe/xe_vm.h| 2 + drivers/gpu/drm/xe

[RFC PATCH 12/29] drm/xe: Add exec queue post init extension processing

2024-11-18 Thread Matthew Brost
Add exec queue post init extension processing which is needed for more complex extensions in which data is returned to the user. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_exec_queue.c | 48 ++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu

[RFC PATCH 26/29] drm/xe: Always wait on preempt fences in vma_check_userptr

2024-11-18 Thread Matthew Brost
The assumption only a VM in preempt fence mode has preempt fences attached is not true, preempt fences can be attached to a dma-resv VM if user queues are open. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[RFC PATCH 22/29] drm/xe/uapi: Add uAPI to convert user semaphore to / from drm syncobj

2024-11-18 Thread Matthew Brost
dma-fence, resume after preemption requires memory allocations). FIXME: uAPI likely to change, perhaps in drm generic way. Currently enough for a PoC and enable initial Mesa development. Signed-off-by: Matthew Brost --- include/uapi/drm/xe_drm.h | 62 +++ 1

  1   2   3   4   5   6   7   8   9   10   >