[PATCH 4/6] drm/i915: Add a struct dma_fence_work timeline

2021-10-08 Thread Thomas Hellström
function to attach struct dma_fence_work to such a timeline in a way that all previous fences attached to the timeline will be signaled when the latest attached struct dma_fence_work signals. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/i915_sw_fence_work.c | 89

[PATCH 3/6] drm/i915/ttm: Failsafe migration blits

2021-10-08 Thread Thomas Hellström
performs an async cpu blit instead. If there is a failure to allocate the async dma_fence_work, allocate it on the stack and sync wait for the blit to complete. Add selftests that simulate gpu blit failures and failure to allocate the async dma_fence_work. Signed-off-by: Thomas Hellström

[PATCH 2/6] drm/i915: Introduce refcounted sg-tables

2021-10-08 Thread Thomas Hellström
o the design direction chosen for ttm resource managers that would lead to diamond-style inheritance, the LMEM resources may sometimes be prematurely freed, and finally the subclassed struct ttm_resource would have to bleed into the asynchronous vma bind code. Signed-off-by: Thomas Hellström --- ..

[PATCH 0/6] drm/i915: Failsafe migration blits

2021-10-08 Thread Thomas Hellström
cept move_fence errors and refuse GPU- and CPU mappings. Thomas Hellström (6): drm/i915: Update dma_fence_work drm/i915: Introduce refcounted sg-tables drm/i915/ttm: Failsafe migration blits drm/i915: Add a struct dma_fence_work timeline drm/i915/ttm: Attach the migration fence to a reg

[PATCH 1/6] drm/i915: Update dma_fence_work

2021-10-08 Thread Thomas Hellström
r for failsafe migration. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_clflush.c | 5 +++ drivers/gpu/drm/i915/i915_sw_fence_work.c | 36 ++--- drivers/gpu/drm/i915/i915_sw_fence_work.h | 1 + drivers/gpu/drm/i915/i915_vma.c | 12 +-- 4

Interface additions to dma_fence_array?

2021-10-08 Thread Thomas Hellström
Hi, Christian, We have a use-case in i915 with async evictions where we'd like to use dma-fence-array in the following way *Create in commit mode *Add context and seqno, *Publish (signaling critical section starts) *Add fence pointers to the arrary *Commit (signaling critical section ends, fen

Re: [RFC PATCH 1/2] drm/amdgpu: Move dma_resv waiting outside the notifier lock

2021-10-07 Thread Thomas Hellström
Hi, Christian, On Thu, 2021-10-07 at 16:57 +0200, Christian König wrote: > Am 07.10.21 um 15:26 schrieb Thomas Hellström: > > While the range notifier is executing, we have the write-side mmu > > interval > > seqlock, and mmu_interval_read_retry() is always returning true, &g

[RFC PATCH 2/2] drm/amdgpu: Use an rwsem for the notifier lock

2021-10-07 Thread Thomas Hellström
Use an rwsem as the notifier lock, and take it in read mode during command submission. This avoids the device-wide serialization of command submission in the absence of userptr invalidations. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu.h

[RFC PATCH 1/2] drm/amdgpu: Move dma_resv waiting outside the notifier lock

2021-10-07 Thread Thomas Hellström
retrying in mmu_interval_read_begin(). (See the extensive comments in mmu_interval_read_begin()) Hence we can release the notifier lock before the fence wait and avoid a device-wide command submission block during invalidation. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu

[RFC PATCH 0/2] drm/amdgpu: Reduce the notifier_lock contention

2021-10-07 Thread Thomas Hellström
. Cc: Christian König Thomas Hellström (2): drm/amdgpu: Move dma_resv waiting outside the notifier lock drm/amdgpu: Use an rwsem for the notifier lock drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu

Re: [PATCH v6 6/8] drm/i915/ttm: move shrinker management into adjust_lru

2021-10-06 Thread Thomas Hellström
This time piggy back off the shrink_pin stuff, which actually seems to fit quite well for what we want here. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.h| 8 +++ .../gpu/drm/i915/gem/i915_gem_object_types.h | 25 ++- drivers/

Re: [PATCH v6 5/8] drm/i915: add some kernel-doc for shrink_pin and friends

2021-10-06 Thread Thomas Hellström
On 10/5/21 20:24, Matthew Auld wrote: Attempt to document shrink_pin and the other relevant interfaces that interact with it, before we start messing with it. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- .../gpu/drm/i915/gem

Re: [PATCH v6 4/8] drm/i915: drop unneeded make_unshrinkable in free_object

2021-10-06 Thread Thomas Hellström
(). Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c index

Re: [PATCH v6 3/8] drm/i915/gtt: drop unneeded make_unshrinkable

2021-10-06 Thread Thomas Hellström
On 10/5/21 20:24, Matthew Auld wrote: We already do this when mapping the pages. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 1 - drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 1 - 2 files changed, 2 deletions(-) Reviewed-by: Thomas Hellström

Re: [Intel-gfx] [PATCH v5 09/13] drm/i915/ttm: add tt shmem backend

2021-10-05 Thread Thomas Hellström
On 10/5/21 04:05, Zeng, Oak wrote: Hi Matthew/Thomas, See one question inline Regards, Oak -Original Message- From: Intel-gfx On Behalf Of Matthew Auld Sent: September 27, 2021 7:41 AM To: intel-...@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org; Thomas Hellström

Re: [PATCH] drm/i915: Handle Intel igfx + Intel dgfx hybrid graphics setup

2021-10-05 Thread Thomas Hellström
prevent using semaphores for inter-engine synchronisation when relevant objects are not in the same GGTT space. v2: * Avoid adding rq->i915. (Chris) v3: * Use GGTT which describes the limit more precisely. Signed-off-by: Tvrtko Ursulin Cc: Daniel Vetter Cc: Matthew Auld Cc: Thomas Hellst

[PATCH v3] drm/i915/ttm: Rework object initialization slightly

2021-09-30 Thread Thomas Hellström
o make sure we don't inadvertedly introduce a race. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld #v1 --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 43 +++--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 5 +++ drivers/gpu/drm/i915/gem/i915_gem_ttm.c| 36 ++

[PATCH v2] drm/i915/ttm: Rework object initialization slightly

2021-09-29 Thread Thomas Hellström
ialized objects. v2: - The TTM object backend memory was freed before the gem pages were put. Separate this functionality into __i915_gem_object_pages_fini() and call it from the TTM delete_mem_notify() callback. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld #v1 --- driv

Re: [PATCH v5 10/13] drm/i915: try to simplify make_{un}shrinkable

2021-09-29 Thread Thomas Hellström
ssly call > make_unshrinkable multiple times. Outside of that there is some > fallout > in intel_context which relies on nesting calls to shrink_pin. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström Hmm. One thing that worries me a bit here: Let's say we have, for ex

Re: [PATCH v5 13/13] drm/i915/ttm: enable shmem tt backend

2021-09-29 Thread Thomas Hellström
On Mon, 2021-09-27 at 12:41 +0100, Matthew Auld wrote: > Turn on the shmem tt backend, and enable shrinking. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 1 + >  1 file changed, 1 insertion(+) > > diff --git

Re: [PATCH v5 12/13] drm/i915/ttm: use cached system pages when evicting lmem

2021-09-29 Thread Thomas Hellström
Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 8 >  1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > index 194e5f1deda8..4

Re: [PATCH v5 11/13] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-29 Thread Thomas Hellström
ng the shrinker LRU in adjust_lru, where it is > always >     safe to touch the object. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i915/gem/i915_gem_object.h   |  1 + >  drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 29 +++---

Re: [PATCH v5 09/13] drm/i915/ttm: add tt shmem backend

2021-09-29 Thread Thomas Hellström
mments below, with those either fixed or deemed unnecessary, Reviewed-by: Thomas Hellström > > v2(Thomas): >   - Add optional try_to_writeback hook for objects. Importantly we > need >     to check if the object is even still shrinkable; in between us >     dropping the shrin

Re: [PATCH] drm/i915/ttm: Rework object initialization slightly

2021-09-28 Thread Thomas Hellström
On 9/28/21 12:30, Matthew Auld wrote: On 27/09/2021 16:10, Thomas Hellström wrote: We may end up in i915_ttm_bo_destroy() in an error path before the object is fully initialized. In that case it's not correct to call __i915_gem_free_object(), because that function a) Assumes the gem o

[PATCH] drm/i915/ttm: Rework object initialization slightly

2021-09-27 Thread Thomas Hellström
zed objects. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 18 ++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm.c| 32 +- 3 files changed, 38 insertions(+), 15 deletions(-) diff --g

Re: [Intel-gfx] [PATCH v6 3/9] drm/i915/gt: Increase suspend timeout

2021-09-23 Thread Thomas Hellström
On 9/23/21 4:33 PM, Tvrtko Ursulin wrote: On 23/09/2021 14:19, Thomas Hellström wrote: On 9/23/21 2:59 PM, Tvrtko Ursulin wrote: On 23/09/2021 12:47, Thomas Hellström wrote: Hi, Tvrtko, On 9/23/21 12:13 PM, Tvrtko Ursulin wrote: On 22/09/2021 07:25, Thomas Hellström wrote: With GuC

Re: [Intel-gfx] [PATCH v6 3/9] drm/i915/gt: Increase suspend timeout

2021-09-23 Thread Thomas Hellström
On 9/23/21 2:59 PM, Tvrtko Ursulin wrote: On 23/09/2021 12:47, Thomas Hellström wrote: Hi, Tvrtko, On 9/23/21 12:13 PM, Tvrtko Ursulin wrote: On 22/09/2021 07:25, Thomas Hellström wrote: With GuC submission on DG1, the execution of the requests times out for the gem_exec_suspend igt test

Re: [Intel-gfx] [PATCH v6 3/9] drm/i915/gt: Increase suspend timeout

2021-09-23 Thread Thomas Hellström
Hi, Tvrtko, On 9/23/21 12:13 PM, Tvrtko Ursulin wrote: On 22/09/2021 07:25, Thomas Hellström wrote: With GuC submission on DG1, the execution of the requests times out for the gem_exec_suspend igt test case after executing around 800-900 of 1000 submitted requests. Given the time we allow

Re: [PATCH v6 7/9] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-23 Thread Thomas Hellström
On 9/23/21 11:44 AM, Matthew Auld wrote: On 22/09/2021 07:25, Thomas Hellström wrote: We really only need memcpy restore for objects that affect the operability of the migrate context. That is, primarily the page-table objects of the migrate VM. Add an object flag, I915_BO_ALLOC_PM_EARLY for

Re: [PATCH v4 09/14] drm/i915/ttm: add tt shmem backend

2021-09-22 Thread Thomas Hellström
too bad. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/i915/gem/i915_gem_object.h| 8 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 2 + drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 14 +- drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

Re: [PATCH 2/3] drm/i915/ttm: Fix lockdep warning in __i915_gem_free_object()

2021-09-22 Thread Thomas Hellström
On 9/22/21 12:55 PM, Matthew Auld wrote: On Wed, 22 Sept 2021 at 09:38, Thomas Hellström wrote: In the mman selftest, some tests make the ttm_bo_init_reserved() fail, which may trigger a call to the i915_ttm_bo_destroy() function. However, at this point the gem object refcount is set to 1

[PATCH 3/3] HAX: component: do not leave master devres group open after bind

2021-09-22 Thread Thomas Hellström
From: Kai Vehmanen In current code, the devres group for aggregate master is left open after call to component_master_add_*(). This leads to problems when the master does further managed allocations on its own. When any participating driver calls component_del(), this leads to immediate release o

[PATCH 1/3] drm/i915/gem: Fix a lockdep warning the __i915_gem_is_lmem() function

2021-09-22 Thread Thomas Hellström
t;drm/i915: Take pinning into account in __i915_gem_object_is_lmem") Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_

[PATCH 2/3] drm/i915/ttm: Fix lockdep warning in __i915_gem_free_object()

2021-09-22 Thread Thomas Hellström
, i915_selftest@live@mman. Fix this by clearing the gem object refcount if called from that failure path. Fixes: f9b23c157a78 ("drm/i915: Move __i915_gem_free_object to ttm_bo_destroy") Cc: Maarten Lankhorst Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c |

[PATCH 0/3] DG1 Lockdep warning fixes

2021-09-22 Thread Thomas Hellström
A couple of recent commits introduced lockdep warnings, breaking some DG1 BAT tests. Two fixes for those and one HAX patch making CI behave better. Kai Vehmanen (1): HAX: component: do not leave master devres group open after bind Thomas Hellström (2): drm/i915/gem: Fix a lockdep warning

[PATCH v6 9/9] HAX: drm/i915/gem: Fix the __i915_gem_is_lmem() function

2021-09-21 Thread Thomas Hellström
Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c index d659239fcbcc..444f8268b9c5 100644 --- a/drivers/gpu/drm/i915

[PATCH v6 8/9] HAX: component: do not leave master devres group open after bind

2021-09-21 Thread Thomas Hellström
From: Kai Vehmanen In current code, the devres group for aggregate master is left open after call to component_master_add_*(). This leads to problems when the master does further managed allocations on its own. When any participating driver calls component_del(), this leads to immediate release o

[PATCH v6 5/9] drm/i915/gt: Register the migrate contexts with their engines

2021-09-21 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). v3: - Reset contexts in the engine sanitize callback. (Chris Wilson) Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: T

[PATCH v6 3/9] drm/i915/gt: Increase suspend timeout

2021-09-21 Thread Thomas Hellström
and proceed. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c index dea8e2479897..f84f2bfe2de0 100644 --- a/drivers/gpu

[PATCH v6 7/9] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-21 Thread Thomas Hellström
re we fire up the migrate context. Cc: Matthew Brost Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 4 ++-- drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 9 ++--- drivers/gpu/drm/i915/gem/i915_gem_pm.c

[PATCH v6 6/9] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-21 Thread Thomas Hellström
: - Slight documentation clarification (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++

[PATCH v6 4/9] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-21 Thread Thomas Hellström
amp; lmem suspend / resume functions to use flags rather than bools. (Matthew Auld) - Completely drop the i915_gem_backup_suspend change (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm

[PATCH v6 2/9] drm/i915/gem: Implement a function to process all gem objects of a region

2021-09-21 Thread Thomas Hellström
ction that does this for us and that takes an argument that defines the action to be performed on each object. v3: - Improve structure documentation a bit (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_reg

[PATCH v6 1/9] drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects

2021-09-21 Thread Thomas Hellström
accelerated copies. v2: - Fix a missing return value check (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 + drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 4 ++ 2 files changed, 64 insertions(+), 9

[PATCH v6 0/9] drm/i915: Suspend / resume backup- and restore of LMEM.

2021-09-21 Thread Thomas Hellström
master devres group open after bind Thomas Hellström (8): drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects drm/i915/gem: Implement a function to process all gem objects of a region drm/i915/gt: Increase suspend timeout drm/i915 Implement LMEM backup and

[PATCH v5 5/7] drm/i915/gt: Register the migrate contexts with their engines

2021-09-21 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). v3: - Reset contexts in the engine sanitize callback. (Chris Wilson) Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: T

[PATCH v5 7/7] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-21 Thread Thomas Hellström
re we fire up the migrate context. Cc: Matthew Brost Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 4 ++-- drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 9 ++--- drivers/gpu/drm/i915/gem/i915_gem_pm.c

[PATCH v5 6/7] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-21 Thread Thomas Hellström
: - Slight documentation clarification (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++

[PATCH v5 3/7] drm/i915/gt: Increase suspend timeout

2021-09-21 Thread Thomas Hellström
and proceed. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_gt_pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c index dea8e2479897..f84f2bfe2de0 100644 --- a/drivers/gpu

[PATCH v5 2/7] drm/i915/gem: Implement a function to process all gem objects of a region

2021-09-21 Thread Thomas Hellström
ction that does this for us and that takes an argument that defines the action to be performed on each object. v3: - Improve structure documentation a bit (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_reg

[PATCH v5 4/7] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-21 Thread Thomas Hellström
amp; lmem suspend / resume functions to use flags rather than bools. (Matthew Auld) - Completely drop the i915_gem_backup_suspend change (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm

[PATCH v5 1/7] drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects

2021-09-21 Thread Thomas Hellström
accelerated copies. v2: - Fix a missing return value check (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 + drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 4 ++ 2 files changed, 64 insertions(+), 9

[PATCH v5 0/7] drm/i915: Suspend / resume backup- and restore of LMEM.

2021-09-21 Thread Thomas Hellström
cleanups, among other things reworking the ttm / lmem backup- and resume interfaces somewhat. v5: - GuC adaptations. Mark GuC LMEM objects for early resume and increase the suspend idle timeout. Thomas Hellström (7): drm/i915/ttm: Implement a function to copy the contents of two TTM-based

Re: [PATCH v4 01/14] drm/ttm: stop calling tt_swapin in vm_access

2021-09-21 Thread Thomas Hellström
nrelated to kmap. I think what Matthew is saying is that there is a fallthrough to TTM_PL_TT which calls ttm_bo_vm_access_kmap which calls ttm_tt_populate(). So from my pow, unless there are other concerns, this is Reviewed-by: Thomas Hellström > > > > > If anything, calling tt

[PATCH v4 6/6] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-20 Thread Thomas Hellström
early resume, but rather the ggtt page table flags as intended. (Matthew Auld) - The check for user buffer objects during early resume is pointless, since they are never marked I915_BO_ALLOC_PM_EARLY. (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i91

[PATCH v4 5/6] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-20 Thread Thomas Hellström
: - Slight documentation clarification (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++

[PATCH v4 4/6] drm/i915/gt: Register the migrate contexts with their engines

2021-09-20 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). v3: - Reset contexts in the engine sanitize callback. (Chris Wilson) Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: T

[PATCH v4 2/6] drm/i915/gem: Implement a function to process all gem objects of a region

2021-09-20 Thread Thomas Hellström
ction that does this for us and that takes an argument that defines the action to be performed on each object. v3: - Improve structure documentation a bit (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_reg

[PATCH v4 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-20 Thread Thomas Hellström
amp; lmem suspend / resume functions to use flags rather than bools. (Matthew Auld) - Completely drop the i915_gem_backup_suspend change (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm

[PATCH v4 1/6] drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects

2021-09-20 Thread Thomas Hellström
accelerated copies. v2: - Fix a missing return value check (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 + drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 4 ++ 2 files changed, 64 insertions(+), 9

[PATCH v4 0/6] drm/i915: Suspend / resume backup- and restore of LMEM.

2021-09-20 Thread Thomas Hellström
cleanups, among other things reworking the ttm / lmem backup- and resume interfaces somewhat. Thomas Hellström (6): drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects drm/i915/gem: Implement a function to process all gem objects of a region drm/i915 Implement

Re: [PATCH v3 6/6] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-20 Thread Thomas Hellström
On Mon, 2021-09-20 at 12:05 +0100, Matthew Auld wrote: > On 14/09/2021 20:31, Thomas Hellström wrote: > > We really only need memcpy restore for objects that affect the > > operability of the migrate context. That is, primarily the page- > > table > > objects of the

Re: [PATCH v3 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-20 Thread Thomas Hellström
On Mon, 2021-09-20 at 11:49 +0100, Matthew Auld wrote: > On 14/09/2021 20:31, Thomas Hellström wrote: > > Just evict unpinned objects to system. For pinned LMEM objects, > > make a backup system object and blit the contents to that. > > > > Backup is perf

Re: [PATCH 5/5] drm/i915: Take pinning into account in __i915_gem_object_is_lmem

2021-09-16 Thread Thomas Hellström
On Thu, 2021-09-16 at 09:28 -0700, Matthew Brost wrote: > Don't blow up on a GEM_WARN_ON in __i915_gem_object_is_lmem if the > object is pinned (not evictable). > > Signed-off-by: Matthew Brost > Cc: Thomas Hellström Reviewed-by: Thomas Hellström > --- >

Re: [PATCH v3 08/12] drm/i915/ttm: add tt shmem backend

2021-09-16 Thread Thomas Hellström
ed-off-by: Matthew Auld > Cc: Thomas Hellström > Cc: Christian König > --- >  drivers/gpu/drm/i915/gem/i915_gem_object.h |   8 + >  drivers/gpu/drm/i915/gem/i915_gem_shmem.c  |  14 +- >  drivers/gpu/drm/i915/gem/i915_gem_ttm.c    | 217 ++- > -- >  3 file

Re: [PATCH v3 06/12] drm/ttm: add TTM_PAGE_FLAG_EXTERNAL_MAPPABLE

2021-09-16 Thread Thomas Hellström
On 9/16/21 11:58 AM, Matthew Auld wrote: On 16/09/2021 10:03, Thomas Hellström wrote: On Thu, 2021-09-16 at 08:55 +0200, Christian König wrote: Am 15.09.21 um 20:59 schrieb Matthew Auld: In commit: commit 667a50db0477d47fdff01c666f5ee1ce26b5264c Author: Thomas Hellstrom Date:   Fri Jan

Re: [PATCH v3 06/12] drm/ttm: add TTM_PAGE_FLAG_EXTERNAL_MAPPABLE

2021-09-16 Thread Thomas Hellström
nt to introduce a shmem_tt backend, which should follow all the > > existing rules with TTM_PAGE_FLAG_EXTERNAL, since it will need to > > handle > > swapping itself, but with the above mapping restriction lifted. > > > > Signed-off-by: Matthew Auld > > Cc: Thomas Hellström

[PATCH v3 6/6] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-14 Thread Thomas Hellström
with pinned page-table objects can be restored using the blitter. Performance-wise memcpy restore is probably as fast as gpu restore if not faster, but using gpu restore will help tackling future restrictions in mappable LMEM size. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem

[PATCH v3 4/6] drm/i915/gt: Register the migrate contexts with their engines

2021-09-14 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). v3: - Reset contexts in the engine sanitize callback. (Chris Wilson) Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: T

[PATCH v3 5/6] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-14 Thread Thomas Hellström
: - Slight documentation clarification (Matthew Auld) Signed-off-by: Thomas Hellström --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++- drivers/gpu/drm/i915/gt/in

[PATCH v3 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-14 Thread Thomas Hellström
(Matthew Auld) - Fix up kerneldoc for i195_ttm_restore_region(). - Final lmem_suspend() call moved to i915_gem_backup_suspend from i915_gem_suspend_late, since the latter gets called at driver unload and we don't unnecessarily want to run it at that time. Signed-off-by: Thomas Hell

[PATCH v3 2/6] drm/i915/gem: Implement a function to process all gem objects of a region

2021-09-14 Thread Thomas Hellström
ction that does this for us and that takes an argument that defines the action to be performed on each object. v3: - Improve structure documentation a bit (Matthew Auld) Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_region.c | 70 ++ drivers/gpu/dr

[PATCH v3 1/6] drm/i915/ttm: Implement a function to copy the contents of two TTM-based objects

2021-09-14 Thread Thomas Hellström
accelerated copies. v2: - Fix a missing return value check (Matthew Auld) Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 + drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 4 ++ 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/drivers

[PATCH v3 0/6] drm/i915: Suspend / resume backup- and restore of LMEM.

2021-09-14 Thread Thomas Hellström
. v2: - Some polishing of patch 4/6, see patch commit message for details (Chris Wilson) - Rework of patch 3/6. v3: - Comment changes in patch 2/6 (Matthew Auld) - A number of changes to patch 3/6, see commit message. - Slightly reword comment in patch 5/6. (Matthew Auld). Thomas Hellström (6

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-14 Thread Thomas Hellström
On 9/14/21 4:07 PM, Daniel Vetter wrote: On Tue, Sep 14, 2021 at 12:38:00PM +0200, Thomas Hellström wrote: On Tue, 2021-09-14 at 10:53 +0200, Christian König wrote: Am 14.09.21 um 10:27 schrieb Thomas Hellström: On Tue, 2021-09-14 at 09:40 +0200, Christian König wrote: Am 13.09.21 um 14:41

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-14 Thread Thomas Hellström
On Tue, 2021-09-14 at 10:53 +0200, Christian König wrote: > Am 14.09.21 um 10:27 schrieb Thomas Hellström: > > On Tue, 2021-09-14 at 09:40 +0200, Christian König wrote: > > > Am 13.09.21 um 14:41 schrieb Thomas Hellström: > > > > [SNIP] > > > > > > &

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-14 Thread Thomas Hellström
On Tue, 2021-09-14 at 09:40 +0200, Christian König wrote: > Am 13.09.21 um 14:41 schrieb Thomas Hellström: > > [SNIP] > > > > > Let's say you have a struct ttm_object_vram and a struct > > > > > ttm_object_gtt, both subclassing drm_gem_object. Then I&#x

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-13 Thread Thomas Hellström
On 9/13/21 12:16 PM, Thomas Hellström wrote: On 9/13/21 11:41 AM, Christian König wrote: Am 13.09.21 um 11:36 schrieb Thomas Hellström: On 9/13/21 8:17 AM, Christian König wrote: Am 11.09.21 um 08:07 schrieb Thomas Hellström: On Fri, 2021-09-10 at 19:03 +0200, Christian König wrote: Am

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-13 Thread Thomas Hellström
On 9/13/21 11:41 AM, Christian König wrote: Am 13.09.21 um 11:36 schrieb Thomas Hellström: On 9/13/21 8:17 AM, Christian König wrote: Am 11.09.21 um 08:07 schrieb Thomas Hellström: On Fri, 2021-09-10 at 19:03 +0200, Christian König wrote: Am 10.09.21 um 17:30 schrieb Thomas Hellström: On

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-13 Thread Thomas Hellström
On 9/13/21 8:17 AM, Christian König wrote: Am 11.09.21 um 08:07 schrieb Thomas Hellström: On Fri, 2021-09-10 at 19:03 +0200, Christian König wrote: Am 10.09.21 um 17:30 schrieb Thomas Hellström: On Fri, 2021-09-10 at 16:40 +0200, Christian König wrote: Am 10.09.21 um 15:15 schrieb Thomas

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-10 Thread Thomas Hellström
On Fri, 2021-09-10 at 19:03 +0200, Christian König wrote: > Am 10.09.21 um 17:30 schrieb Thomas Hellström: > > On Fri, 2021-09-10 at 16:40 +0200, Christian König wrote: > > > > > > Am 10.09.21 um 15:15 schrieb Thomas Hellström: > > > > Both the provider (

Re: [RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-10 Thread Thomas Hellström
On Fri, 2021-09-10 at 16:40 +0200, Christian König wrote: > > > Am 10.09.21 um 15:15 schrieb Thomas Hellström: > > Both the provider (resource manager) and the consumer (the TTM > > driver) > > want to subclass struct ttm_resource. Since this is left for the > >

Re: [PATCH v2 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-10 Thread Thomas Hellström
On 9/6/21 6:55 PM, Thomas Hellström wrote: Just evict unpinned objects to system. For pinned LMEM objects, make a backup system object and blit the contents to that. Backup is performed in three steps, 1: Opportunistically evict evictable objects using the gpu blitter. 2: After gt idle, evict

[RFC PATCH] drm/ttm: Add a private member to the struct ttm_resource

2021-09-10 Thread Thomas Hellström
a separate ops structure, but Linus has previously made it clear that that's the norm. After careful audit one could perhaps also on a per-driver basis replace the delete_mem_notify() TTM driver callback with the above destroy function. Cc: Matthew Auld Cc: König Christian Signed-off-by: T

Re: i915 ttm_tt shmem backend

2021-09-10 Thread Thomas Hellström
On Fri, 2021-09-10 at 10:25 +0200, Christian König wrote: > > > Am 10.09.21 um 10:08 schrieb Thomas Hellström: > > Perhaps some background and goal is worth mentioning here. > > > > > > On Thu, 2021-09-09 at 17:56 +0100, Matthew Auld wrote: > > > On Th

Re: i915 ttm_tt shmem backend

2021-09-10 Thread Thomas Hellström
> > Christian. > > > > ________ > > Von: Matthew Auld > > Gesendet: Donnerstag, 9. September 2021 16:56 > > An: Christian König ; Koenig, > > Christian > > Cc: Thomas Hellström ; ML dri- > > devel > > Betreff: i91

Re: i915 ttm_tt shmem backend

2021-09-10 Thread Thomas Hellström
Hi, On 9/9/21 4:56 PM, Matthew Auld wrote: Hi Christian, We are looking into using shmem as a ttm_tt backend in i915 for cached system memory objects. We would also like to make such objects visible to the i915-gem shrinker, so that they may be swapped out or discarded when under memory pressur

Re: [PATCH v2 5/6] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-08 Thread Thomas Hellström
On Wed, 2021-09-08 at 12:07 +0100, Matthew Auld wrote: > On 06/09/2021 17:55, Thomas Hellström wrote: > > Pinned context images are now reset during resume. Don't back them > > up, > > and assuming that rings can be assumed empty at suspend, don't back > > the

Re: [PATCH v2 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-08 Thread Thomas Hellström
Hi, Matt, Thanks for reviewing. On 9/7/21 7:37 PM, Matthew Auld wrote: +    i915_gem_ww_unlock_single(backup); +    i915_gem_object_put(backup); I assume we need to set ttm.backup = NULL somewhere here on the failure path, or don't drop the ref? Or at least it looks like potential uaf lat

[PATCH v2 6/6] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-06 Thread Thomas Hellström
with pinned page-table objects can be restored using the blitter. Performance-wise memcpy restore is probably as fast as gpu restore if not faster, but using gpu restore will help tackling future restrictions in mappable LMEM size. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem

[PATCH v2 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-06 Thread Thomas Hellström
gem_exec_suspend@hang-SX subtests work, and suspend / resume works with a slightly modified GuC submission enabling patch series. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915

[PATCH v2 4/6] drm/i915/gt: Register the migrate contexts with their engines

2021-09-06 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). v3: - Reset contexts in the engine sanitize callback. (Chris Wilson) Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: T

[PATCH v2 5/6] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-06 Thread Thomas Hellström
ned-off-by: Thomas Hellström --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++- drivers/gpu/drm/i915/gt/intel_ring.c| 3 ++- 4 files changed, 17 insert

[PATCH v2 2/6] drm/i915/gem: Implement a function to process all gem objects of a region

2021-09-06 Thread Thomas Hellström
ction that does this for us and that takes an argument that defines the action to be performed on each object. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_region.c | 70 ++ drivers/gpu/drm/i915/gem/i915_gem_region.h | 33 ++ 2 files changed, 103

[PATCH v2 1/6] drm/i915/ttm: Implement a function to copy the contents of two TTM-base objects

2021-09-06 Thread Thomas Hellström
accelerated copies. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 69 + drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 4 ++ 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm

[PATCH v2 0/6] drm/i915: Suspend / resume backup- and restore of LMEM.

2021-09-06 Thread Thomas Hellström
. v2: - Some polishing of patch 4/6, see patch commit message for details (Chris Wilson) - Rework of patch 3/6. Thomas Hellström (6): drm/i915/ttm: Implement a function to copy the contents of two TTM-base objects drm/i915/gem: Implement a function to process all gem objects of a

[PATCH 6/6] drm/i915: Reduce the number of objects subject to memcpy recover

2021-09-02 Thread Thomas Hellström
with pinned page-table objects can be restored using the blitter. Performance-wise memcpy restore is probably as fast as gpu restore if not faster, but using gpu restore will help tackling future restrictions in mappable LMEM size. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem

[PATCH 5/6] drm/i915: Don't back up pinned LMEM context images and rings during suspend

2021-09-02 Thread Thomas Hellström
ned-off-by: Thomas Hellström --- .../gpu/drm/i915/gem/i915_gem_object_types.h| 17 ++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++ drivers/gpu/drm/i915/gt/intel_lrc.c | 3 ++- drivers/gpu/drm/i915/gt/intel_ring.c| 3 ++- 4 files changed, 17 insert

[PATCH 4/6] drm/i915/gt: Register the migrate contexts with their engines

2021-09-02 Thread Thomas Hellström
context. v2: - Don't reset the contexts on each __engine_unpark() but rather at resume time (Chris Wilson). Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Cc: Chris Wilson Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_context_types.h

[PATCH 3/6] drm/i915 Implement LMEM backup and restore for suspend / resume

2021-09-02 Thread Thomas Hellström
context is functional. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_pm.c| 46 + drivers/gpu/drm/i915/gem/i915_gem_pm.h| 1 + drivers/gpu/drm

<    7   8   9   10   11   12   13   14   15   16   >