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

2021-09-07 Thread Matthew Auld
On 06/09/2021 17:55, Thomas Hellström wrote: An upcoming common pattern is to traverse the region object list and perform certain actions on all objects in a region. It's a little tricky to get the list locking right, in particular since a gem object may change region unless it's pinned or the ob

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

2021-09-07 Thread Matthew Auld
On 06/09/2021 17:55, 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

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

2021-09-08 Thread Matthew Auld
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 them up either. Introduce a new object flag, I915_BO_ALLOC_PM_VOLATILE meaning that an object is allowed to lose

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

2021-09-08 Thread Matthew Auld
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 them up either. Introduce a new object flag, I915_BO_ALLOC_PM_VOLATILE meaning that an object is allowed to lose

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

2021-09-08 Thread Matthew Auld
On 08/09/2021 13:26, Thomas Hellström wrote: 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 ba

Re: [PATCH 2/8] drm/ttm: add some general module kerneldoc

2021-09-08 Thread Matthew Auld
On Wed, 8 Sept 2021 at 14:29, Christian König wrote: > > For now just a brief description of what TTM is all about. > > Signed-off-by: Christian König Reviewed-by: Matthew Auld

i915 ttm_tt shmem backend

2021-09-09 Thread Matthew Auld
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 pressure. One idea for handling this is roughly some

Re: [PATCH] drm/i915/request: fix early tracepoints

2021-09-09 Thread Matthew Auld
On 08/09/2021 18:38, Daniel Vetter wrote: On Fri, Sep 03, 2021 at 12:24:05PM +0100, Matthew Auld wrote: Currently we blow up in trace_dma_fence_init, when calling into get_driver_name or get_timeline_name, since both the engine and context might be NULL(or contain some garbage address) in the

Re: i915 ttm_tt shmem backend

2021-09-09 Thread Matthew Auld
to work with pages from a shmem file. Hmm, what do you mean by reverse lookup functionality? Could you please point out where that is in the TTM code? > > Regards, > Christian. > > ____ > Von: Matthew Auld > Gesendet: Donnerstag, 9. September 2021

[PATCH 2/8] drm/ttm: add TTM_PAGE_FLAG_SHMEM

2021-09-13 Thread Matthew Auld
pping/index behaviour for their own purposes, so directly using shmem tt likely won't be usable there as-is. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_tt.c| 10 +- include/drm/ttm

[PATCH 1/8] drm/i915/gem: Break out some shmem backend utils

2021-09-13 Thread Matthew Auld
compute the page sizes using the dma segments rather than using the physical page address segments. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 182 +- 1 file changed, 107 insertions(+), 75

[PATCH 5/8] drm/i915: remember to call i915_sw_fence_fini

2021-09-13 Thread Matthew Auld
Fixes some object-debug splat which appeared while debugging something unrelated. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt

[PATCH 3/8] drm/i915/ttm: add tt shmem backend

2021-09-13 Thread Matthew Auld
For cached objects we can allocate our pages directly in shmem. This should make it possible(in a later patch) to utilise the existing i915-gem shrinker code for such objects. For now this is still disabled. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu

[PATCH 6/8] drm/i915: try to simplify make_{un}shrinkable

2021-09-13 Thread Matthew Auld
on nesting calls to shrink_pin. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c| 9 .../gpu/drm/i915/gem/i915_gem_object_types.h | 3 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 16 +- drivers/gpu/drm/i915/gem/i915_gem_shrin

[PATCH 4/8] drm/i915/ttm: use cached system pages when evicting lmem

2021-09-13 Thread Matthew Auld
This should let us do an accelerated copy directly to the shmem pages when temporarily moving lmem-only objects, where the i915-gem shrinker can later kick in to swap out the pages, if needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 8

[PATCH 7/8] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-13 Thread Matthew Auld
just gets migrated back to lmem when touched again. For such cases we can make the object visible as soon as we populate the TT with shmem pages, and then hide it again when doing the unpopulate. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.h | 1 + d

[PATCH 8/8] drm/i915/ttm: enable shmem tt backend

2021-09-13 Thread Matthew Auld
Enable 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 a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index dbf06a2af8bf

[PATCH v2 1/7] drm/i915/gem: Break out some shmem backend utils

2021-09-14 Thread Matthew Auld
compute the page sizes using the dma segments rather than using the physical page address segments. v2(Reported-by: kernel test robot ) - Make sure we initialise the mapping on the error path in shmem_get_pages() Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld Signed-off-by

[PATCH v2 2/7] drm/ttm: add TTM_PAGE_FLAG_SHMEM

2021-09-14 Thread Matthew Auld
pping/index behaviour for their own purposes, so directly using shmem tt likely won't be usable there as-is. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 ++-- drivers/gpu/drm/ttm/ttm_tt.c| 10 +- include/drm/ttm

[PATCH v2 3/7] drm/i915/ttm: add tt shmem backend

2021-09-14 Thread Matthew Auld
For cached objects we can allocate our pages directly in shmem. This should make it possible(in a later patch) to utilise the existing i915-gem shrinker code for such objects. For now this is still disabled. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu

[PATCH v2 7/7] drm/i915/ttm: enable shmem tt backend

2021-09-14 Thread Matthew Auld
Enable 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 a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index f02037a8cebd

[PATCH v2 4/7] drm/i915/ttm: use cached system pages when evicting lmem

2021-09-14 Thread Matthew Auld
This should let us do an accelerated copy directly to the shmem pages when temporarily moving lmem-only objects, where the i915-gem shrinker can later kick in to swap out the pages, if needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 8

[PATCH v2 6/7] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-14 Thread Matthew Auld
just gets migrated back to lmem when touched again. For such cases we can make the object visible as soon as we populate the TT with shmem pages, and then hide it again when doing the unpopulate. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.h | 1 + d

[PATCH v2 5/7] drm/i915: try to simplify make_{un}shrinkable

2021-09-14 Thread Matthew Auld
on nesting calls to shrink_pin. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c| 9 .../gpu/drm/i915/gem/i915_gem_object_types.h | 3 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 16 +- drivers/gpu/drm/i915/gem/i915_gem_shrin

Re: [PATCH v2 2/7] drm/ttm: add TTM_PAGE_FLAG_SHMEM

2021-09-14 Thread Matthew Auld
On Tue, 14 Sept 2021 at 10:03, Christian König wrote: > > Am 14.09.21 um 10:50 schrieb Matthew Auld: > > Add new flag to indicate special shmem based tt, which can directly > > handle swapping itself, and should be visible to some shrinker. > > > > As p

Re: [Intel-gfx] [PATCH] drm/i915: Add mmap lock around vma_lookup() to prevent lockdep splats

2021-09-15 Thread Matthew Auld
perf_selftests+0x20/0x20 [i915] > ? __i915_nop_setup+0x10/0x10 [i915] > __run_selftests.part.3+0x10d/0x172 [i915] > i915_live_selftests.cold.5+0x1f/0x47 [i915] > i915_pci_probe+0x93/0x1d0 [i915] > > Signed-off-by: Maarten Lankhorst > Closes: https://gitlab.freedesktop.org/drm/intel/issues/4129 Reviewed-by: Matthew Auld

[PATCH v3 01/12] drm/ttm: stop setting page->index for the ttm_tt

2021-09-15 Thread Matthew Auld
at in the next patch. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 -- drivers/gpu/drm/ttm/ttm_tt.c| 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm

[PATCH v3 02/12] drm/ttm: move ttm_tt_{add, clear}_mapping into amdgpu

2021-09-15 Thread Matthew Auld
later tries to touch them. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 27 - drivers/gpu/drm/ttm/ttm_tt.c| 25 --- 2 files changed, 26 insertions(+), 26 deletions(-)

[PATCH v3 03/12] drm/ttm: remove TTM_PAGE_FLAG_NO_RETRY

2021-09-15 Thread Matthew Auld
No longer used it seems. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- include/drm/ttm/ttm_tt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h index 89b15d673b22..842ce756213c 100644 --- a/include/drm/ttm

[PATCH v3 05/12] drm/ttm: add some kernel-doc for TTM_PAGE_FLAG_*

2021-09-15 Thread Matthew Auld
Move it to inline kernel-doc, otherwise we can't add empty lines it seems. Also drop the kernel-doc for pages_list, which doesn't seem to exist, and get rid of all the strange holes. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- include/drm/ttm/ttm

[PATCH v3 04/12] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-15 Thread Matthew Auld
It covers more than just ttm_bo_type_sg usage, like with say dma-buf, since one other user is userptr in amdgpu, and in the future we might have some more. Hence EXTERNAL is likely a more suitable name. Suggested-by: Christian König Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc

[PATCH v3 07/12] drm/i915/gem: Break out some shmem backend utils

2021-09-15 Thread Matthew Auld
compute the page sizes using the dma segments rather than using the physical page address segments. v2(Reported-by: kernel test robot ) - Make sure we initialise the mapping on the error path in shmem_get_pages() Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld Signed-off-by

[PATCH v3 09/12] drm/i915/ttm: use cached system pages when evicting lmem

2021-09-15 Thread Matthew Auld
This should let us do an accelerated copy directly to the shmem pages when temporarily moving lmem-only objects, where the i915-gem shrinker can later kick in to swap out the pages, if needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 8

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

2021-09-15 Thread Matthew Auld
userptr). In the next patch we want 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 Cc: Christian

[PATCH v3 10/12] drm/i915: try to simplify make_{un}shrinkable

2021-09-15 Thread Matthew Auld
on nesting calls to shrink_pin. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c| 9 .../gpu/drm/i915/gem/i915_gem_object_types.h | 3 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 16 +- drivers/gpu/drm/i915/gem/i915_gem_shrin

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

2021-09-15 Thread Matthew Auld
For cached objects we can allocate our pages directly in shmem. This should make it possible(in a later patch) to utilise the existing i915-gem shrinker code for such objects. For now this is still disabled. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu

[PATCH v3 11/12] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-15 Thread Matthew Auld
just gets migrated back to lmem when touched again. For such cases we can make the object visible as soon as we populate the TT with shmem pages, and then hide it again when doing the unpopulate. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.h | 1 + d

[PATCH v3 12/12] drm/i915/ttm: enable shmem tt backend

2021-09-15 Thread Matthew Auld
Enable 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 a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index e758de336b96

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

2021-09-16 Thread Matthew Auld
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 3 11:17:18 2014 +0100 drm/ttm: Refuse

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

2021-09-16 Thread Matthew Auld
for operation, so make sure we can disable accelerated copies. v2: - Fix a missing return value check (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld

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

2021-09-16 Thread Matthew Auld
ned or the object lock is held. Define a function 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

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

2021-09-17 Thread Matthew Auld
submission. v2: - Major refactor to make sure gem_exec_suspend@hang-SX subtests work, and suspend / resume works with a slightly modified GuC submission enabling patch series. v3: - Fix a potential use-after-free (Matthew Auld) - Use i915_gem_object_create_shmem() instead of

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

2021-10-11 Thread Matthew Auld
The comment here is no longer accurate, since the current shrinker code requires a full ref before touching any objects. Also unset_pages() should already do the required make_unshrinkable() for us, if needed, which is also nicely balanced with set_pages(). Signed-off-by: Matthew Auld Cc: Thomas

[PATCH v8 1/8] drm/i915/gem: Break out some shmem backend utils

2021-10-11 Thread Matthew Auld
compute the page sizes using the dma segments rather than using the physical page address segments. v2(Reported-by: kernel test robot ) - Make sure we initialise the mapping on the error path in shmem_get_pages() Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld Signed-off-by

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

2021-10-11 Thread Matthew Auld
We already do this when mapping the pages. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: 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(-) diff --git a/drivers/gpu/drm/i915/gt

[PATCH v8 2/8] drm/i915/ttm: add tt shmem backend

2021-10-11 Thread Matthew Auld
to come up with something better later. v4(Thomas): - s/PCI_DMA/DMA/. Also drop NO_KERNEL_MAPPING and NO_WARN, which apparently doesn't do anything with streaming mappings. - Just pass along the error for ->truncate, and assume nothing. Signed-off-by: Matthew Auld Cc: Thomas Hellst

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

2021-10-11 Thread Matthew Auld
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/i915_gem_object_types.h | 24 +- drivers/gpu/drm/i915

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

2021-10-11 Thread Matthew Auld
ttm_move (Thomas) Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström #v4 --- drivers/gpu/drm/i915/gem/i915_gem_object.h| 8 ++ .../gpu/drm/i915/gem/i915_gem_object_types.h | 14 +++- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 5 +- drivers/

[PATCH v8 7/8] drm/i915/ttm: use cached system pages when evicting lmem

2021-10-11 Thread Matthew Auld
This should let us do an accelerated copy directly to the shmem pages when temporarily moving lmem-only objects, where the i915-gem shrinker can later kick in to swap out the pages, if needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm

[PATCH v8 8/8] drm/i915/ttm: enable shmem tt backend

2021-10-11 Thread Matthew Auld
Turn on the shmem tt backend, and enable shrinking. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b

Re: [PATCH 03/14] drm/i915/xehpsdv: enforce min GTT alignment

2021-10-13 Thread Matthew Auld
On 13/10/2021 14:38, Daniel Vetter wrote: On Mon, Oct 11, 2021 at 09:41:44PM +0530, Ramalingam C wrote: From: Matthew Auld For local-memory objects we need to align the GTT addresses to 64K, both for the ppgtt and ggtt. Signed-off-by: Matthew Auld Signed-off-by: Stuart Summers Signed-off

Re: [PATCH 03/14] drm/i915/xehpsdv: enforce min GTT alignment

2021-10-14 Thread Matthew Auld
On 14/10/2021 14:33, Daniel Vetter wrote: On Wed, Oct 13, 2021 at 03:13:33PM +0100, Matthew Auld wrote: On 13/10/2021 14:38, Daniel Vetter wrote: On Mon, Oct 11, 2021 at 09:41:44PM +0530, Ramalingam C wrote: From: Matthew Auld For local-memory objects we need to align the GTT addresses to

[PATCH v9 2/8] drm/i915/ttm: add tt shmem backend

2021-10-18 Thread Matthew Auld
to come up with something better later. v4(Thomas): - s/PCI_DMA/DMA/. Also drop NO_KERNEL_MAPPING and NO_WARN, which apparently doesn't do anything with streaming mappings. - Just pass along the error for ->truncate, and assume nothing. Signed-off-by: Matthew Auld Cc: Thomas Hellst

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

2021-10-18 Thread Matthew Auld
We already do this when mapping the pages. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: 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(-) diff --git a/drivers/gpu/drm/i915/gt

[PATCH v9 1/8] drm/i915/gem: Break out some shmem backend utils

2021-10-18 Thread Matthew Auld
compute the page sizes using the dma segments rather than using the physical page address segments. v2(Reported-by: kernel test robot ) - Make sure we initialise the mapping on the error path in shmem_get_pages() Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld Signed-off-by

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

2021-10-18 Thread Matthew Auld
ttm_move (Thomas) v6(Reported-by: kernel test robot ): - Remove unused i915_tt Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström #v4 --- drivers/gpu/drm/i915/gem/i915_gem_object.h| 8 ++ .../gpu/drm/i915/gem/i915_gem_object_types.h | 14 ++- drivers/

[PATCH v9 7/8] drm/i915/ttm: use cached system pages when evicting lmem

2021-10-18 Thread Matthew Auld
This should let us do an accelerated copy directly to the shmem pages when temporarily moving lmem-only objects, where the i915-gem shrinker can later kick in to swap out the pages, if needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm

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

2021-10-18 Thread Matthew Auld
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/i915_gem_object_types.h | 24 +- drivers/gpu/drm/i915

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

2021-10-18 Thread Matthew Auld
The comment here is no longer accurate, since the current shrinker code requires a full ref before touching any objects. Also unset_pages() should already do the required make_unshrinkable() for us, if needed, which is also nicely balanced with set_pages(). Signed-off-by: Matthew Auld Cc: Thomas

[PATCH v9 8/8] drm/i915/ttm: enable shmem tt backend

2021-10-18 Thread Matthew Auld
Turn on the shmem tt backend, and enable shrinking. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b

[PATCH 1/9] drm/i915: mark dmabuf objects as ALLOC_USER

2021-10-18 Thread Matthew Auld
These are userspace objects, so mark them as such. In a later patch it's useful to determine how paranoid we need to be when managing cache flushes. In theory no functional changes. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 3 ++- 1

[PATCH 2/9] drm/i915: mark userptr objects as ALLOC_USER

2021-10-18 Thread Matthew Auld
These are userspace objects, so mark them as such. In a later patch it's useful to determine how paranoid we need to be when managing cache flushes. In theory no functional changes. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 ++- 1

[PATCH 6/9] drm/i915/shmem: ensure flush during swap-in on non-LLC

2021-10-18 Thread Matthew Auld
, and since execbuf binds the object before doing the async flush, there is a potential race window. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_sh

[PATCH 3/9] drm/i915: extract bypass-llc check into helper

2021-10-18 Thread Matthew Auld
It looks like we will need this in some more places, so extract as a helper. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 26 ++ drivers/gpu/drm/i915/gem/i915_gem_object.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_shmem.c

[PATCH 5/9] drm/i915/userptr: add paranoid flush-on-acquire

2021-10-18 Thread Matthew Auld
Even though userptr objects are always coherent with the GPU, with no way for userspace to change this with the set_caching ioctl, even on non-LLC platforms, there is still the 'Bypass LCC' mocs setting, which might permit reading the contents of main memory directly. Signed-off-by: Ma

[PATCH 4/9] drm/i915/dmabuf: add paranoid flush-on-acquire

2021-10-18 Thread Matthew Auld
As pointed out by Thomas, we likely need to flush the pages here if the GPU can read the page contents directly from main memory. Underneath we don't know what the sg_table is pointing to, so just add a wbinvd_on_all_cpus() here, for now. Reported-by: Thomas Hellström Signed-off-by: Matthew

[PATCH 8/9] drm/i915: mark up internal objects with start_cpu_write

2021-10-18 Thread Matthew Auld
l volatile objects, such that we can re-acquire new pages, if so desired, without needing a new object. As a result we should probably be paranoid here and put the object back into the CPU domain when discarding the pages, and also correctly set cache_dirty, if required. Signed-off-by: Matthew Auld

[PATCH 9/9] drm/i915/selftests: mark up hugepages object with start_cpu_write

2021-10-18 Thread Matthew Auld
Just like we do for internal objects. Also just use i915_gem_object_set_cache_coherency() here. No need for over-flushing on LLC platforms. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 7 ++- 1 file changed, 6 insertions(+), 1

[PATCH 7/9] drm/i915: expand on the kernel-doc for cache_dirty

2021-10-18 Thread Matthew Auld
Add some details around non-LLC platforms and cflushing, when dealing with the flush-on-acquire, which is potentially security sensitive. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Daniel Vetter --- .../gpu/drm/i915/gem/i915_gem_execbuffer.c| 11 .../gpu/drm/i915/gem

Re: [PATCH] remove duplicate include in mock_region.c

2021-10-19 Thread Matthew Auld
le should ideally be prefixed with 'drm/i915:'. Can fix up when pushing though. Thanks, Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/selftests/mock_region.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/mock_region.c b/drivers/gpu/drm/i915

Re: drm/i915: remove duplicate include in mock_region.c

2021-10-20 Thread Matthew Auld
On 20/10/2021 09:04, Ran Jianping wrote: From: ran jianping 'drm/ttm/ttm_placement.h' included in 'drivers/gpu/drm/i915/selftests/mock_region.c' is duplicated. It is also included on the 9 line. Reported-by: Zeal Robot Signed-off-by: ran jianping Pushed to drm-intel-gt-next. Thanks. ---

[PATCH 1/4] drm/i915/clflush: fixup handling of cache_dirty

2021-10-21 Thread Matthew Auld
efore the pages are populated. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_clflush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_clflush.c b/drivers/gpu/drm/i915/gem/i915_gem_clflush.c

[PATCH 2/4] drm/i915/clflush: disallow on discrete

2021-10-21 Thread Matthew Auld
, so there should in theory be no conceivable reason to ever call i915_gem_clflush_object() on discrete. References: https://gitlab.freedesktop.org/drm/intel/-/issues/4320 Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_clflush.c | 6 -- 1 file changed, 4

[PATCH 3/4] drm/i915: move cpu_write_needs_clflush

2021-10-21 Thread Matthew Auld
Move it next to its partner in crime; gpu_write_needs_clflush. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 12 drivers/gpu/drm/i915/gem/i915_gem_object.h | 15 ++- drivers/gpu/drm/i915/i915_gem.c| 2

[PATCH 4/4] drm/i915: stop setting cache_dirty on discrete

2021-10-21 Thread Matthew Auld
Should not be needed. Even with non-coherent display, we should be using device local-memory there, and not system memory. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 10 ++ drivers/gpu/drm/i915/gem/i915_gem_object.c | 7

[PATCH 1/2] drm/i915/dmabuf: fix broken build

2021-10-21 Thread Matthew Auld
wbinvd_on_all_cpus() is only defined on x86 it seems, plus we need to include asm/smp.h here. Reported-by: kernel test robot Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu

[PATCH 2/2] drm/i915/dmabuf: drop the flush on discrete

2021-10-21 Thread Matthew Auld
We were overzealous here; even though discrete is non-LLC, it should still be always coherent. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem

Re: [PATCH 03/28] drm/i915: Remove dma_resv_prune

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:36, Maarten Lankhorst wrote: > > The signaled bit is already used for quick testing if a fence is signaled. Why do we need this change? Can you add some more details to the commit please? > > Signed-off-by: Maarten Lankhorst > --- > drivers/gpu/drm/i915/Makefile

Re: [Intel-gfx] [PATCH 07/28] drm/i915: Create a dummy object for gen6 ppgtt

2021-10-21 Thread Matthew Auld
struct sg_table *pages) > +{ > +} > + > +static const struct drm_i915_gem_object_ops pd_dummy_obj_ops = { > + .name = "pd_dummy_obj", > + .flags = I915_GEM_OBJECT_IS_SHRINKABLE, I would assume we don't want this dummy object to be considered for shrinking?

Re: [PATCH 08/28] drm/i915: Create a full object for mock_ring, v2.

2021-10-21 Thread Matthew Auld
goto err; > + > + return vma; > + > +err: > + i915_gem_object_put(obj); > + return vma; > +} > + > static struct intel_ring *mock_ring(struct intel_engine_cs *engine) > { > - const unsigned long sz = PAGE_SIZE / 2; > +

Re: [Intel-gfx] [PATCH 09/28] drm/i915: vma is always backed by an object.

2021-10-21 Thread Matthew Auld
m_cache *slab_vmas; > > -struct i915_vma *i915_vma_alloc(void) > +static struct i915_vma *i915_vma_alloc(void) > { > return kmem_cache_zalloc(slab_vmas, GFP_KERNEL); > } > > -void i915_vma_free(struct i915_vma *vma) > +static void i915_vma_free(struct i915_vm

Re: [Intel-gfx] [PATCH 10/28] drm/i915: Change shrink ordering to use locking around unbinding.

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Call drop_pages with the gem object lock held, instead of the other > way around. This will allow us to drop the vma bindings with the > gem object lock held. > > We plan to require the object lock for unpinning in the future, > and this i

Re: [Intel-gfx] [PATCH 13/28] drm/i915: Remove pages_mutex and intel_gtt->vma_ops.set/clear_pages members

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:36, Maarten Lankhorst wrote: > > Big delta, but boils down to moving set_pages to i915_vma.c, and removing > the special handling, all callers use the defaults anyway. We only remap > in ggtt, so default case will fall through. > > Because we still don't require locking i

Re: [Intel-gfx] [PATCH 14/28] drm/i915: Take object lock in i915_ggtt_pin if ww is not set

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > i915_vma_wait_for_bind needs the vma lock held, fix the caller. > > Signed-off-by: Maarten Lankhorst > --- > drivers/gpu/drm/i915/i915_vma.c | 40 +++-- > 1 file changed, 28 insertions(+), 12 deletions(-) > >

Re: [Intel-gfx] [PATCH 15/28] drm/i915: Add lock for unbinding to i915_gem_object_ggtt_pin_ww

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Signed-off-by: Maarten Lankhorst Needs a proper commit message. > --- > drivers/gpu/drm/i915/i915_gem.c | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/

Re: [Intel-gfx] [PATCH 16/28] drm/i915: Rework context handling in hugepages selftests

2021-10-21 Thread Matthew Auld
est is separated, it's a lot better to use > i915_live_selftests, so each subtest starts with a clean slate, and a > clean address space. > > Signed-off-by: Maarten Lankhorst Reviewed-by: Matthew Auld

Re: [Intel-gfx] [PATCH 18/28] drm/i915: Take trylock during eviction, v2.

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Now that freeing objects takes the object lock when destroying the > backing pages, we can confidently take the object lock even for dead > objects. > > Use this fact to take the object lock in the shrinker, without requiring > a reference

Re: [Intel-gfx] [PATCH 19/28] drm/i915: Pass trylock context to callers

2021-10-21 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Signed-off-by: Maarten Lankhorst Needs a proper commit message.

Re: [Intel-gfx] [PATCH] drm/i195: Remove some dead struct fwd decl from i915_drv.h

2021-10-22 Thread Matthew Auld
On Fri, 22 Oct 2021 at 09:22, Daniel Vetter wrote: > > Gone with userptr rewrite by Maarten in ed29c2691188 ("drm/i915: Fix > userptr so we do not have to worry about obj->mm.lock, v7.") > > Signed-off-by: Daniel Vetter > Cc: Maarten Lankhorst s/i195/i

Re: [PATCH 2/2] drm/i915/dmabuf: drop the flush on discrete

2021-10-22 Thread Matthew Auld
On 22/10/2021 10:26, Thomas Hellström wrote: Hi, Matt On 10/21/21 14:53, Matthew Auld wrote: We were overzealous here; even though discrete is non-LLC, it should still be always coherent. Signed-off-by: Matthew Auld Cc: Thomas Hellström ---   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 3

Re: [Intel-gfx] [PATCH 13/28] drm/i915: Remove pages_mutex and intel_gtt->vma_ops.set/clear_pages members

2021-10-22 Thread Matthew Auld
On Thu, 21 Oct 2021 at 18:30, Matthew Auld wrote: > > On Thu, 21 Oct 2021 at 11:36, Maarten Lankhorst > wrote: > > > > Big delta, but boils down to moving set_pages to i915_vma.c, and removing > > the special handling, all callers use the defaults anyway. We only re

Re: [Intel-gfx] [PATCH 25/28] drm/i915: Require object lock when freeing pages during destruction

2021-10-22 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > TTM already requires this, and we require it for delayed destroy. > > Signed-off-by: Maarten Lankhorst Reviewed-by: Matthew Auld

[PATCH 1/2] drm/i915/gtt: flush the scratch page

2021-10-22 Thread Matthew Auld
The scratch page is directly visible in the users address space, and while this is forced as CACHE_LLC, by the kernel, we still have to contend with things like "Bypass-LLC" MOCS. So just flush no matter what. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Chris Wilson Cc: Ra

[PATCH 2/2] drm/i915/gtt: stop caching the scratch page

2021-10-22 Thread Matthew Auld
Normal users shouldn't be hitting this, likely this would indicate a userspace bug. So don't bother caching, which should be safe now that we manually flush the page. Suggested-by: Chris Wilson Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Chris Wilson Cc: Ramalingam C --

Re: [PATCH v2 07/17] drm/i915: Add vm min alignment support

2021-10-22 Thread Matthew Auld
On 21/10/2021 15:26, Ramalingam C wrote: From: Bommu Krishnaiah Replace the hard coded 4K alignment value with vm->min_alignment. Cc: Wilson Chris P Signed-off-by: Bommu Krishnaiah Signed-off-by: Ramalingam C Reviewed-by: Matthew Auld Although likely want to squash patch patches 3

Re: [PATCH v2 06/17] drm/i915/xehpsdv: support 64K GTT pages

2021-10-22 Thread Matthew Auld
On 21/10/2021 15:26, Ramalingam C wrote: From: Matthew Auld XEHPSDV optimises 64K GTT pages for local-memory, since everything should be allocated at 64K granularity. We say goodbye to sparse entries, and instead get a compact 256B page-table for 64K pages, which should be more cache friendly

Re: [PATCH] drm/i915/selftests: Fix inconsistent IS_ERR and PTR_ERR

2021-10-25 Thread Matthew Auld
On 22/10/2021 13:06, Kai Song wrote: Fix inconsistent IS_ERR and PTR_ERR in i915_gem_dmabuf.c Signed-off-by: Kai Song Pushed to drm-intel-gt-next. Thanks. --- drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driv

Re: [PATCH 28/28] drm/i915: Remove short-term pins from execbuf, v4.

2021-10-25 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Add a flag PIN_VALIDATE, to indicate we don't need to pin and only > protected by the object lock. > > This removes the need to unpin, which is done by just releasing the > lock. > > eb_reserve is slightly reworked for readability, but the

Re: [PATCH 21/28] drm/i915: Drain the ttm delayed workqueue too

2021-10-25 Thread Matthew Auld
On Thu, 21 Oct 2021 at 11:37, Maarten Lankhorst wrote: > > Be thorough.. > > Signed-off-by: Maarten Lankhorst Is this strictly needed for something? Needs a proper commit message anyway. > --- > drivers/gpu/drm/i915/i915_drv.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gp

Re: [PATCH] drm/i915: Use ERR_CAST instead of ERR_PTR(PTR_ERR())

2021-10-25 Thread Matthew Auld
On 25/10/2021 12:32, Wan Jiabing wrote: Fix following coccicheck warning: ./drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:3117:15-22: WARNING: ERR_CAST can be used with eb->requests[i]. Signed-off-by: Wan Jiabing Pushed to drm-intel-gt-next. Thanks. --- drivers/gpu/drm/i915/gem/i915_gem_

<    1   2   3   4   5   6   7   8   9   10   >