Re: [PATCH v12 10/10] drm/ttm/tests: Add TODO file

2024-05-24 Thread Thomas Hellström
On Wed, 2024-05-15 at 13:24 +0200, Karolina Stolarek wrote: > List improvements for the test suite with some notes. > > Signed-off-by: Karolina Stolarek LGTM. Reviewed-by: Thomas Hellström > --- >  drivers/gpu/drm/ttm/tests/TODO | 25 + >  1 file chan

Re: [PATCH v12 01/10] drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk

2024-05-24 Thread Thomas Hellström
s that share the same resv. Update calls to that helper > accordingly. > > Fixes: 995279d280d1 ("drm/ttm/tests: Add tests for ttm_bo functions") > Suggested-by: Christian König > Signed-off-by: Karolina Stolarek Reviewed-by: Thomas Hellström > --- >  drivers

Re: [RFC PATCH v3 13/21] drm/exec: Rework contended locking

2024-05-22 Thread Thomas Hellström
On Wed, 2024-05-22 at 18:52 +0200, Christian König wrote: > Am 22.05.24 um 16:32 schrieb Thomas Hellström: > > On Wed, 2024-05-22 at 07:52 +0200, Christian König wrote: > > > Am 21.05.24 um 09:16 schrieb Thomas Hellström: > > > > If contention and backo

Re: [RFC PATCH v3 15/21] drm/exec: Add a snapshot capability

2024-05-22 Thread Thomas Hellström
On Wed, 2024-05-22 at 15:54 +0200, Thomas Hellström wrote: > On Wed, 2024-05-22 at 13:27 +0200, Christian König wrote: > > Am 21.05.24 um 09:16 schrieb Thomas Hellström: > > > When validating a buffer object for submission, we might need to > > > lock > > > a n

Re: [RFC PATCH v3 13/21] drm/exec: Rework contended locking

2024-05-22 Thread Thomas Hellström
On Wed, 2024-05-22 at 07:52 +0200, Christian König wrote: > Am 21.05.24 um 09:16 schrieb Thomas Hellström: > > If contention and backoff occurs during a drm_exec ww transaction, > > the contended lock is not locked again until the next orinary > > attempt to lock a d

Re: [RFC PATCH v3 15/21] drm/exec: Add a snapshot capability

2024-05-22 Thread Thomas Hellström
On Wed, 2024-05-22 at 13:27 +0200, Christian König wrote: > Am 21.05.24 um 09:16 schrieb Thomas Hellström: > > When validating a buffer object for submission, we might need to > > lock > > a number of object for eviction to make room for the validation. > > >

Re: [RFC PATCH v3 16/21] drm/exec: Introduce an evict mode

2024-05-22 Thread Thomas Hellström
On Wed, 2024-05-22 at 15:28 +0200, Christian König wrote: > Am 21.05.24 um 09:16 schrieb Thomas Hellström: > > Locking for eviction is in some way different from locking for > > submission: > > > > 1) We can't lock objects that are already locke

Re: [PATCH v3 00/21] TTM shrinker helpers and xe buffer object shrinker

2024-05-21 Thread Thomas Hellström
Hi, all On Tue, 2024-05-21 at 09:16 +0200, Thomas Hellström wrote: > This series implements TTM shrinker / eviction helpers and an xe bo > shrinker. It builds on two previous series, *and obsoletes these*. > First > > https://www.mail-archive.com/dri-devel@lists.freedesktop.org

[RFC PATCH v3 21/21] drm/xe: Initial support for drm exec locking during validate

2024-05-21 Thread Thomas Hellström
Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/xe/display/xe_fb_pin.c | 2 +- drivers/gpu/drm/xe/tests/xe_bo.c | 6 +++--- drivers/gpu/drm/xe/tests/xe_dma_buf.c | 4 ++-- drivers/gpu/drm/xe/tests/xe_migrate.c | 2 +- drivers/gpu/drm/xe/xe_bo.c | 8

[RFC PATCH v3 19/21] drm/xe: Use drm_exec for fault locking

2024-05-21 Thread Thomas Hellström
Similar to how TTM vm does this, convert the drm/xe fault handler to use drm_exec locking. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_bo.c | 38 +++--- 1 file changed, 23

[PATCH v3 10/21] drm/ttm: Use fault-injection to test error paths

2024-05-21 Thread Thomas Hellström
Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/Kconfig| 10 ++ drivers/gpu/drm/ttm/ttm_pool.c | 17 - 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index

[RFC PATCH v3 18/21] drm/ttm: Convert ttm vm to using drm_exec

2024-05-21 Thread Thomas Hellström
TTM faulting may include migration and swapping. Convert helpers to support drm_exec locking and enable it by converting the ttm_bo_vm_fault() function to include a drm_exec loop. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers

[RFC PATCH v3 13/21] drm/exec: Rework contended locking

2024-05-21 Thread Thomas Hellström
the contended lock may return -EINTR. Hence drm_exec_retry_on_contention() must take an error parameter and also return a value indicating success. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 16

[PATCH v3 05/21] drm/ttm: Provide a generic LRU walker helper

2024-05-21 Thread Thomas Hellström
Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo_util.c | 145 ++ include/drm/ttm/ttm_bo.h | 32 +++ 2 files changed, 177 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm

[RFC PATCH v3 15/21] drm/exec: Add a snapshot capability

2024-05-21 Thread Thomas Hellström
that can be used to record the locks held at a certain time, and a restore functionality that restores the drm_exec state to the snapshot by dropping all locks. Snapshots can be nested if needed. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas

[RFC PATCH v3 17/21] drm/ttm: Support drm_exec locking for eviction and swapping

2024-05-21 Thread Thomas Hellström
Snapshot the drm_exec state before validation, and perform locking for eviction and swapping using the passed in drm_exec pointer if any. Otherwise fall back to trylock / ticketlock. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström

[PATCH v3 08/21] drm/ttm: Add a virtual base class for graphics memory backup

2024-05-21 Thread Thomas Hellström
Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/Makefile | 2 +- drivers/gpu/drm/ttm/ttm_backup_shmem.c | 137 + include/drm/ttm/ttm_backup.h | 136 3 files changed, 274 insertions(+), 1 deletion(-) create mode

[RFC PATCH v3 14/21] drm/exec: Introduce a drm_exec_trylock_obj() function

2024-05-21 Thread Thomas Hellström
held lock array. This failure mode could be avoided if the drm_exec structure instead maintained a linked list of locked objects, similar to i915. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/drm_exec.c | 50

[RFC PATCH v3 20/21] drm/ttm: Use drm_exec_trylock for bo initialization

2024-05-21 Thread Thomas Hellström
: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 8706502edcb1

[RFC PATCH v3 16/21] drm/exec: Introduce an evict mode

2024-05-21 Thread Thomas Hellström
Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/drm_exec.c | 77 ++ include/drm/drm_exec.h | 15 2 files changed, 85 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_exec.c b/drivers/gpu/drm/drm_exec.c index 9eea5d0d3a98

[RFC PATCH v3 12/21] dma-buf/dma-resv: Introduce dma_resv_trylock_ctx()

2024-05-21 Thread Thomas Hellström
Cc: Cc: Signed-off-by: Thomas Hellström --- include/linux/dma-resv.h | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index 8d0e34dad446..68dae8f2a22c 100644 --- a/include/linux/dma-resv.h +++ b

[PATCH v3 11/21] drm/ttm, drm/xe: Add a shrinker for xe bos

2024-05-21 Thread Thomas Hellström
. v2: - Cleanups bugfixes and a KUNIT shrinker test. - Add writeback support, and activate if kswapd. v3: - Move the try_shrink() helper to core TTM. - Minor cleanups. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm

[PATCH v3 09/21] drm/ttm/pool: Provide a helper to shrink pages

2024-05-21 Thread Thomas Hellström
/back_up/backup/ - Add a writeback parameter to the exported interface. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_pool.c | 397 +++-- drivers/gpu/drm/ttm/ttm_tt.c | 37

[PATCH v3 07/21] drm/ttm: Use the LRU walker for eviction

2024-05-21 Thread Thomas Hellström
are not restarted in-between evictions. Also provide a separate ttm_bo_evict_first() function for its single user. The context of that user allows sleeping dma_resv locks. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm

[PATCH v3 02/21] drm/ttm: Slightly clean up LRU list iteration

2024-05-21 Thread Thomas Hellström
-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_resource.c | 48 +- include/drm/ttm/ttm_resource.h | 10 --- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index

[PATCH v3 04/21] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-05-21 Thread Thomas Hellström
ian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c | 89 ++ drivers/gpu/drm/xe/xe_vm.c | 4 ++ include/drm/ttm/ttm_resourc

[PATCH v3 06/21] drm/ttm: Use the LRU walker helper for swapping

2024-05-21 Thread Thomas Hellström
. The TTM swapout functionality is a bit weird anyway since it alternates between memory types without exhausting TTM_PL_SYSTEM first. Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 112

[PATCH v3 03/21] drm/ttm: Use LRU hitches

2024-05-21 Thread Thomas Hellström
, one new functionality (Christian König) - use ttm_resource_cursor_fini_locked() instead of open-coding (Matthew Brost) Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm

[PATCH v3 01/21] drm/ttm: Allow TTM LRU list nodes of different types

2024-05-21 Thread Thomas Hellström
. Changes in previous series: - Update enum ttm_lru_item_type documentation. v3: - Introduce ttm_lru_first_res_or_null() (Christian König, Thomas Hellström) Cc: Christian König Cc: Somalapuram Amaranath Cc: Matthew Brost Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm

[PATCH v3 00/21] TTM shrinker helpers and xe buffer object shrinker

2024-05-21 Thread Thomas Hellström
. - Provide a POC drm_exec locking implementation for exhaustive eviction. (Christian König). Cc: Somalapuram Amaranath Cc: Christian König Cc: Matthew Brost Cc: Thomas Hellström (21): drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Slightly clean up LRU list iteration drm/ttm

Re: drm_exec changes for eviction

2024-05-07 Thread Thomas Hellström
On Tue, 2024-05-07 at 15:36 +0200, Christian König wrote: > Am 06.05.24 um 11:46 schrieb Thomas Hellström: > > Hi Christian, Others. > > > > In order to support exhaustive eviction there are some changes that > > I > > think needs to be made to drm_

drm_exec changes for eviction

2024-05-06 Thread Thomas Hellström
Hi Christian, Others. In order to support exhaustive eviction there are some changes that I think needs to be made to drm_exec: 1) Trylock support  (This is for ttm_bo_vm, ttm_buffer_object_init_reserved, and also for the eviction path where I think we want to make a trylock pass before a

Re: [PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-05-02 Thread Thomas Hellström
On Thu, 2024-05-02 at 09:46 -0300, Jason Gunthorpe wrote: > On Thu, May 02, 2024 at 11:11:04AM +0200, Thomas Hellström wrote: > > > It's true the cpu vma lookup is a remnant from amdkfd. The idea > > here is > > to replace that with fixed prefaulting ranges of tunable size

Re: [PATCH v2 1/9] drm/ttm: Allow TTM LRU list nodes of different types

2024-05-02 Thread Thomas Hellström
Hi, Matt, Christian, On Wed, 2024-04-17 at 08:09 +0200, Christian König wrote: > Am 17.04.24 um 03:15 schrieb Matthew Brost: > > On Tue, Apr 16, 2024 at 12:07:22PM +0200, Thomas Hellström wrote: > > > To be able to handle list unlocking while traversing the LRU > > >

Re: [PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-05-02 Thread Thomas Hellström
ter wrote: > > > On Tue, Apr 30, 2024 at 02:30:02PM -0300, Jason Gunthorpe wrote: > > > > On Mon, Apr 29, 2024 at 10:25:48AM +0200, Thomas Hellström > > > > wrote: > > > > > > > > > > Yes there is another common scheme where you bind a win

Re: [PATCH v3] drm/i915/vma: Fix UAF on reopen vs destroy race

2024-04-29 Thread Thomas Hellström
On Thu, 2024-04-25 at 20:42 +0200, Janusz Krzysztofik wrote: > Hi Thomas, > > On Tuesday, 16 April 2024 18:40:12 CEST Rodrigo Vivi wrote: > > On Tue, Apr 16, 2024 at 10:09:46AM +0200, Janusz Krzysztofik wrote: > > > Hi Rodrigo, > > > > > > On Tuesday, 16 April 2024 03:16:31 CEST Rodrigo Vivi

Re: [PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-04-29 Thread Thomas Hellström
On Fri, 2024-04-26 at 13:35 -0300, Jason Gunthorpe wrote: > On Fri, Apr 26, 2024 at 04:49:26PM +0200, Thomas Hellström wrote: > > On Fri, 2024-04-26 at 09:00 -0300, Jason Gunthorpe wrote: > > > On Fri, Apr 26, 2024 at 11:55:05AM +0200, Thomas Hellström wrote: > > > >

Re: [PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-04-26 Thread Thomas Hellström
On Fri, 2024-04-26 at 09:00 -0300, Jason Gunthorpe wrote: > On Fri, Apr 26, 2024 at 11:55:05AM +0200, Thomas Hellström wrote: > > First, the gpu_vma structure is something that partitions the > > gpu_vm > > that holds gpu-related range metadata, like what to mirror, desire

Re: [PATCH 06/23] drm/xe/svm: Introduce a helper to build sg table from hmm range

2024-04-26 Thread Thomas Hellström
Hi, Jason. I've quickly read through the discussion here and have a couple of questions and clarifications to hopefully help moving forward on aligning on an approach for this. Let's for simplicity initially ignore migration and assume this is on integrated hardware since it seems like it's

Re: [PATCH v2 0/9] TTM shrinker helpers and xe buffer object shrinker

2024-04-16 Thread Thomas Hellström
we should support). That's why I opted for implementing shrinking before exhaustive eviction. But if you insist we can do it the other way around. Most of what's needed is already in the patches. /Thomas > > Regards, > Christian. > > Am 16.04.24 um 12:07 schrieb Thomas Hel

[PATCH v2 6/9] drm/ttm/pool: Provide a helper to shrink pages.

2024-04-16 Thread Thomas Hellström
/back_up/backup/ - Add a writeback parameter to the exported interface. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_pool.c | 397 +++-- drivers/gpu/drm/ttm/ttm_tt.c | 37 +++ include/drm/ttm

[PATCH v2 9/9] drm/xe: Add a shrinker for xe bos

2024-04-16 Thread Thomas Hellström
. v2: - Cleanups bugfixes and a KUNIT shrinker test. - Add writeback support, and activate if kswapd. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/tests/xe_bo.c | 118 ++ drivers/gpu/drm/xe/tests/xe_bo_test.c | 1

[PATCH v2 8/9] drm/xe, drm/ttm: Provide a generic LRU walker helper

2024-04-16 Thread Thomas Hellström
by other drivers. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_resource.c | 3 + drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_ttm_helpers.c | 149 drivers/gpu/drm/xe

[PATCH v2 7/9] drm/ttm: Use fault-injection to test error paths

2024-04-16 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/Kconfig| 10 ++ drivers/gpu/drm/ttm/ttm_pool.c | 17 - 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 959b19a04101

[PATCH v2 5/9] drm/ttm: Add a virtual base class for graphics memory backup

2024-04-16 Thread Thomas Hellström
-by: Thomas Hellström --- drivers/gpu/drm/ttm/Makefile | 2 +- drivers/gpu/drm/ttm/ttm_backup_shmem.c | 137 + include/drm/ttm/ttm_backup.h | 136 3 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu

[PATCH v2 4/9] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-04-16 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu

[PATCH v2 3/9] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-04-16 Thread Thomas Hellström
off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c | 92 +- drivers/gpu/drm/xe/xe_vm.c | 4 ++ include/drm/ttm/ttm_resource.h | 58 ++-- 4 files changed, 137 insertions(+), 21 deleti

[PATCH v2 2/9] drm/ttm: Use LRU hitches

2024-04-16 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm/ttm_resource.c | 94 -- include/drm/ttm/ttm_resource.h | 16 +++-- 4 files changed, 82 insertions(+), 38

[PATCH v2 1/9] drm/ttm: Allow TTM LRU list nodes of different types

2024-04-16 Thread Thomas Hellström
. Changes in previous series: - Update enum ttm_lru_item_type documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include

[PATCH v2 0/9] TTM shrinker helpers and xe buffer object shrinker

2024-04-16 Thread Thomas Hellström
/xe_shrinker.c create mode 100644 drivers/gpu/drm/xe/xe_shrinker.h create mode 100644 drivers/gpu/drm/xe/xe_ttm_helpers.c create mode 100644 drivers/gpu/drm/xe/xe_ttm_helpers.h create mode 100644 include/drm/ttm/ttm_backup.h -- 2.44.0 Thomas Hellström (9): drm/ttm: Allow TTM LRU list nodes

Re: Cross-device and cross-driver HMM support

2024-04-09 Thread Thomas Hellström
Hi, On Wed, 2024-04-03 at 12:09 -0300, Jason Gunthorpe wrote: > On Wed, Apr 03, 2024 at 04:06:11PM +0200, Christian König wrote: > > [UGH html emails, try to avoid those they don't get archived!] > > >    The problem with that isn't the software but the hardware. > >    At least on the AMD GPUs

Re: [RFC PATCH 0/8] TTM shrinker helpers and xe buffer object shrinker

2024-04-08 Thread Thomas Hellström
Hi, Amaranath, On Tue, 2024-04-02 at 17:25 +0530, Somalapuram, Amaranath wrote: > > On 3/29/2024 8:26 PM, Thomas Hellström wrote: > > This series implements TTM shrinker / eviction helpers and an xe bo > > shrinker. It builds on two previous series. First > > > >

Re: [PATCH 2/8] drm/ttm: Use LRU hitches

2024-04-08 Thread Thomas Hellström
On Fri, 2024-04-05 at 14:41 +0200, Christian König wrote: > Am 29.03.24 um 15:57 schrieb Thomas Hellström: > > Have iterators insert themselves into the list they are iterating > > over using hitch list nodes. Since only the iterator owner > > can remove these list nodes fro

Re: [PATCH 1/8] drm/ttm: Allow TTM LRU list nodes of different types

2024-04-08 Thread Thomas Hellström
Hi, Christian. Thanks for reviewing. On Fri, 2024-04-05 at 14:34 +0200, Christian König wrote: > Am 29.03.24 um 15:57 schrieb Thomas Hellström: > > To be able to handle list unlocking while traversing the LRU > > list, we want the iterators not only to point to the next > >

[RFC PATCH 8/8] drm/xe: Add a shrinker for xe bos

2024-03-29 Thread Thomas Hellström
. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_bo.c | 123 -- drivers/gpu/drm/xe/xe_bo.h | 3 + drivers/gpu/drm/xe/xe_device.c | 8 + drivers/gpu/drm/xe/xe_device_types.h | 2 + drivers/gpu/drm

[PATCH 1/8] drm/ttm: Allow TTM LRU list nodes of different types

2024-03-29 Thread Thomas Hellström
. v2: - Update enum ttm_lru_item_type documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include/drm/ttm/ttm_resource.h

[PATCH 3/8] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-03-29 Thread Thomas Hellström
: - Avoid a NULL pointer dereference assigning manager->mem_type v4: - Remove some leftover code causing build problems Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c |

[RFC PATCH 5/8] drm/ttm: Add a virtual base class for graphics memory backup

2024-03-29 Thread Thomas Hellström
the abstraction, this functionality may actually come in handy for configurable dedicated graphics memory backup to fast nvme files or similar, whithout affecting swap-space. Could indeed be useful for VRAM backup on S4 and other cases. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/Makefile

[RFC PATCH 7/8] drm/xe, drm/ttm: Provide a generic LRU walker helper

2024-03-29 Thread Thomas Hellström
by other drivers. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_resource.c | 3 + drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_ttm_helpers.c | 150 drivers/gpu/drm/xe/xe_ttm_helpers.h | 60 +++ 4 files changed, 214

[PATCH 4/8] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-03-29 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu

[RFC PATCH 6/8] drm/ttm/pool: Provide a helper to shrink pages.

2024-03-29 Thread Thomas Hellström
by the core. Due to potential backup- and recover errors, allow partially swapped out struct ttm_tt's, although mark them as swapped out stopping them from being swapped out a second time. More details in the ttm_pool.c DOC section. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_pool.c

[RFC PATCH 0/8] TTM shrinker helpers and xe buffer object shrinker

2024-03-29 Thread Thomas Hellström
preservation. Cc: Somalapuram Amaranath Cc: Christian König Cc: Thomas Hellström (8): drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Use LRU hitches drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves drm/ttm: Allow continued swapout after

[PATCH 2/8] drm/ttm: Use LRU hitches

2024-03-29 Thread Thomas Hellström
it. This will be addressed in a later patch. v2: - Updated ttm_resource_cursor_fini() documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm

Cross-device and cross-driver HMM support

2024-03-27 Thread Thomas Hellström
Hi! With our SVM mirror work we'll soon start looking at HMM cross-device support. The identified needs are 1) Instead of migrating foreign device memory to system when the current device is faulting, leave it in place... 1a) for access using internal interconnect, 1b) for access using PCIE p2p

Re: [PATCH v4 0/4] TTM unlockable restartable LRU list iteration

2024-03-13 Thread Thomas Hellström
Hi! On Mon, 2024-03-11 at 14:07 +0100, Thomas Hellström wrote: > On Fri, 2024-03-08 at 13:13 +0530, Somalapuram, Amaranath wrote: > > Patches are tested on AMD platform. > > Repeated stress test on Unigine Heaven, memory full (VRAM + GTT + > > system > > SWAP), then

Re: [PATCH] drm/ttm: warn when resv objs are mixed in a bulk_move

2024-03-13 Thread Thomas Hellström
Tested with Xe CI, Reviewed-by: Thomas Hellström > --- >  drivers/gpu/drm/ttm/ttm_resource.c | 1 + >  include/drm/ttm/ttm_resource.h | 3 +++ >  2 files changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/ttm/ttm_resource.c > b/drivers/gpu/drm/ttm/ttm_resour

Re: [PATCH v4 0/4] TTM unlockable restartable LRU list iteration

2024-03-11 Thread Thomas Hellström
re testing locally against Intel Xe CI and Intel i915 CI which should give rather good coverage. If there are some amdgpu tests that exercise eviction / swapping also with a lot of local objects (Vulkan apps?) that would be great. Thanks, Thomas > > Regards, > S.Amarnath > On 3/6/2024 12

Re: [PATCH v4 2/4] drm/ttm: Use LRU hitches

2024-03-11 Thread Thomas Hellström
Hi! Thanks for reviewing. On Fri, 2024-03-08 at 18:50 +0530, Somalapuram, Amaranath wrote: > > On 3/6/2024 12:31 PM, Thomas Hellström wrote: > > Have iterators insert themselves into the list they are iterating > > over using hitch list nodes. Since only the iterator ow

[PATCH v4 3/4] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-03-05 Thread Thomas Hellström
: - Avoid a NULL pointer dereference assigning manager->mem_type v4: - Remove some leftover code causing build problems Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c |

[PATCH v4 2/4] drm/ttm: Use LRU hitches

2024-03-05 Thread Thomas Hellström
it. This will be addressed in a later patch. v2: - Updated ttm_resource_cursor_fini() documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm

[PATCH v4 4/4] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-03-05 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu

[PATCH v4 1/4] drm/ttm: Allow TTM LRU list nodes of different types

2024-03-05 Thread Thomas Hellström
. v2: - Update enum ttm_lru_item_type documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include/drm/ttm/ttm_resource.h

[PATCH v4 0/4] TTM unlockable restartable LRU list iteration

2024-03-05 Thread Thomas Hellström
causing build problems. Cc: Somalapuram Amaranath Cc: Christian König Cc: Thomas Hellström (4): drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Use LRU hitches drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves drm/ttm: Allow continued swapout

[PATCH v3 4/4] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-03-05 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu

[PATCH v3 3/4] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-03-05 Thread Thomas Hellström
: - Avoid a NULL pointer dereference assigning manager->mem_type Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c | 90 +- drivers/gpu/drm/xe/xe_v

[PATCH v3 1/4] drm/ttm: Allow TTM LRU list nodes of different types

2024-03-05 Thread Thomas Hellström
. v2: - Update enum ttm_lru_item_type documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include/drm/ttm/ttm_resource.h

[PATCH v3 2/4] drm/ttm: Use LRU hitches

2024-03-05 Thread Thomas Hellström
it. This will be addressed in a later patch. v2: - Updated ttm_resource_cursor_fini() documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm

[PATCH v3 0/4] TTM unlockable restartable LRU list iteration

2024-03-05 Thread Thomas Hellström
: Christian König Cc: Thomas Hellström (4): drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Use LRU hitches drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves drm/ttm: Allow continued swapout after -ENOSPC falure drivers/gpu/drm/amd/amdgpu

[PATCH v2 4/4] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-03-05 Thread Thomas Hellström
Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu

[PATCH v2 2/4] drm/ttm: Use LRU hitches

2024-03-05 Thread Thomas Hellström
it. This will be addressed in a later patch. v2: - Updated ttm_resource_cursor_fini() documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm

[PATCH v2 3/4] drm/ttm, drm/amdgpu, drm/xe: Consider hitch moves within bulk sublist moves

2024-03-05 Thread Thomas Hellström
: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++ drivers/gpu/drm/ttm/ttm_resource.c | 89 +- drivers/gpu/drm/xe/xe_vm.c | 4 ++ include/drm/ttm/ttm_device.h | 1

[PATCH v2 1/4] drm/ttm: Allow TTM LRU list nodes of different types

2024-03-05 Thread Thomas Hellström
. v2: - Update enum ttm_lru_item_type documentation. Cc: Christian König Cc: Somalapuram Amaranath Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include/drm/ttm/ttm_resource.h

[PATCH v2 0/4] TTM unlockable restartable LRU list iteration

2024-03-05 Thread Thomas Hellström
. This is implemented in patch 3. The restartable property is used in patch 4 to restart swapout if needed, but the main purpose is this paves the way for shrinker- and exhaustive eviction. v2: - Rework patch 3 completely. Cc: Somalapuram Amaranath Cc: Christian König Cc: Thomas Hellström (4): drm/ttm

Re: [PATCH 0/4] TTM unlockable restartable LRU list iteration

2024-03-01 Thread Thomas Hellström
On Fri, 2024-03-01 at 15:20 +0100, Christian König wrote: > Am 01.03.24 um 14:45 schrieb Thomas Hellström: > > On Thu, 2024-02-29 at 18:34 +0100, Thomas Hellström wrote: > > > Hi, Christian. > > > > > > Thanks for having a look. > > > > > &

Re: [PATCH 0/4] TTM unlockable restartable LRU list iteration

2024-03-01 Thread Thomas Hellström
On Thu, 2024-02-29 at 18:34 +0100, Thomas Hellström wrote: > Hi, Christian. > > Thanks for having a look. > > On Thu, 2024-02-29 at 16:08 +0100, Christian König wrote: > > Am 16.02.24 um 15:20 schrieb Thomas Hellström: > > [SNIP] > > > > My approach was ba

Re: [PATCH 1/2] drm/ttm: improve idle/busy handling v5

2024-03-01 Thread Thomas Hellström
atthew > > Signed-off-by: Christian König > Reviewed-by: Zack Rusin v3 Now Xe CI passes \o/ Still some checkpatch.pl warnings on both these lines. For the first line I think it uses From: in the email as the author and when that doesn't match the SOB, it becomes unhappy. With t

Re: [PATCH 0/4] TTM unlockable restartable LRU list iteration

2024-02-29 Thread Thomas Hellström
Hi, Christian. Thanks for having a look. On Thu, 2024-02-29 at 16:08 +0100, Christian König wrote: > Am 16.02.24 um 15:20 schrieb Thomas Hellström: > [SNIP] > > > My approach was basically to not only lock the current BO, but > > > also > > > the > > >

Re: Making drm_gpuvm work across gpu devices

2024-02-29 Thread Thomas Hellström
Hi, Christian. On Thu, 2024-02-29 at 10:41 +0100, Christian König wrote: > Am 28.02.24 um 20:51 schrieb Zeng, Oak: > > > > The mail wasn’t indent/preface correctly. Manually format it. > > > > *From:*Christian König > > *Sent:* Tuesday, February 27, 2024 1:54 AM > > *To:* Zeng, Oak ; Danilo

Re: [PATCH] xe: avoid using writeq() on 32-bit

2024-02-28 Thread Thomas Hellström
Hi, Arnd, On Wed, 2024-02-28 at 13:27 +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > 32-bit kernels do not provide a writeq(), failing the build: > > drivers/gpu/drm/xe/xe_ggtt.c:78:2: error: use of undeclared > identifier 'writeq' >    78 | writeq(pte, >gsm[addr >>

Re: [PATCH 1/2] drm/ttm: improve idle/busy handling v4

2024-02-26 Thread Thomas Hellström
Hi, Christian On Fri, 2024-02-23 at 15:30 +0100, Christian König wrote: > Am 06.02.24 um 13:56 schrieb Christian König: > > Am 06.02.24 um 13:53 schrieb Thomas Hellström: > > > Hi, Christian, > > > > > > On Fri, 2024-01-26 at 15:09 +0100, Christian König wrot

Re: [PATCH 8/9] drm/xe/tests: Fix printf format specifiers in xe_migrate test

2024-02-22 Thread Thomas Hellström
") > Signed-off-by: David Gow Ack to merge through the Kunit tree. Acked-by: Thomas Hellström

Re: [PATCH] drm/ttm: Fix an invalid freeing on already freed page in error path

2024-02-22 Thread Thomas Hellström
On Thu, 2024-02-22 at 08:34 +0100, Thomas Hellström wrote: > On Wed, 2024-02-21 at 11:26 +0100, Christian König wrote: > > Am 21.02.24 um 08:33 schrieb Thomas Hellström: > > > If caching mode change fails due to, for example, OOM we > > > free the allocated pages i

Re: [PATCH] drm/ttm: Fix an invalid freeing on already freed page in error path

2024-02-21 Thread Thomas Hellström
On Wed, 2024-02-21 at 11:26 +0100, Christian König wrote: > Am 21.02.24 um 08:33 schrieb Thomas Hellström: > > If caching mode change fails due to, for example, OOM we > > free the allocated pages in a two-step process. First the pages > > for which the caching change

[PATCH] drm/ttm: Fix an invalid freeing on already freed page in error path

2024-02-20 Thread Thomas Hellström
already freed in the first step. Fix. Signed-off-by: Thomas Hellström Fixes: 379989e7cbdc ("drm/ttm/pool: Fix ttm_pool_alloc error path") Cc: Christian König Cc: Dave Airlie Cc: Christian Koenig Cc: Huang Rui Cc: dri-devel@lists.freedesktop.org Cc: # v6.4+ --- drivers/gpu/drm/ttm/

Re: [PATCH 0/4] TTM unlockable restartable LRU list iteration

2024-02-16 Thread Thomas Hellström
On Fri, 2024-02-16 at 15:00 +0100, Christian König wrote: > Am 16.02.24 um 14:13 schrieb Thomas Hellström: > > This patch-set is a prerequisite for a standalone TTM shrinker > > and for exhaustive TTM eviction using sleeping dma_resv locks, > > which is the motivation it. &g

[PATCH 4/4] drm/ttm: Allow continued swapout after -ENOSPC falure

2024-02-16 Thread Thomas Hellström
-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index e8a6a1dab669..4a030b4bc848 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b

[PATCH 3/4] drm/ttm: Consider hitch moves within bulk sublist moves

2024-02-16 Thread Thomas Hellström
. Sublist bumps are detected by checking the sublist age which is increased by 1 each time it was bumped. The age is then compared to that of the last iteration returning an item within the sublist. Cc: Christian König Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_resource.c

[PATCH 2/4] drm/ttm: Use LRU hitches

2024-02-16 Thread Thomas Hellström
it. This will be addressed in a later patch. Cc: Christian König Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + drivers/gpu/drm/ttm/ttm_device.c | 9 ++- drivers/gpu/drm/ttm/ttm_resource.c | 94 -- include/drm/ttm/ttm_resource.h | 16

[PATCH 1/4] drm/ttm: Allow TTM LRU list nodes of different types

2024-02-16 Thread Thomas Hellström
. Cc: Christian König Cc: Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_device.c | 13 -- drivers/gpu/drm/ttm/ttm_resource.c | 70 ++ include/drm/ttm/ttm_resource.h | 51 +- 3 files changed, 110 insertions(+), 24 deletions

[PATCH 0/4] TTM unlockable restartable LRU list iteration

2024-02-16 Thread Thomas Hellström
is used in patch 4 to restart swapout if needed, but the main purpose is this paves the way for shrinker- and exhaustive eviction. Cc: Christian König Cc: Thomas Hellström (4): drm/ttm: Allow TTM LRU list nodes of different types drm/ttm: Use LRU hitches drm/ttm: Consider hitch moves within

  1   2   3   4   5   6   7   8   9   10   >