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

2021-10-27 Thread Matthew Auld
On Thu, 21 Oct 2021 at 13:54, Matthew Auld wrote: > > 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 Jani, would it make sense to cherr

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

2021-10-27 Thread Matthew Auld
On Wed, 27 Oct 2021 at 09:58, Jani Nikula wrote: > > On Wed, 27 Oct 2021, Matthew Auld wrote: > > On Thu, 21 Oct 2021 at 13:54, Matthew Auld wrote: > >> > >> wbinvd_on_all_cpus() is only defined on x86 it seems, plus we need to > >> include asm/smp.h h

Re: [Intel-gfx] [PATCH] drm/i915/gem: Remove gpu reloc workaround

2021-10-27 Thread Matthew Auld
On Wed, 27 Oct 2021 at 09:36, Thomas Hellström wrote: > > GPU relocs are gone. There should be no need for this workaround anymore. > Remove it. > > Signed-off-by: Thomas Hellström I was completely wrong here, sorry. Digging through the git history it looks like this came from: Commit 149c84077

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

2021-10-27 Thread Matthew Auld
On Wed, 27 Oct 2021 at 10:44, Jani Nikula wrote: > > On Wed, 27 Oct 2021, Matthew Auld wrote: > > On Wed, 27 Oct 2021 at 09:58, Jani Nikula > > wrote: > >> > >> On Wed, 27 Oct 2021, Matthew Auld wrote: > >> > On Thu, 2

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

2021-10-27 Thread Matthew Auld
efore the pages are populated. v2(Thomas): - Move setting cache_dirty out of the async portion, also add a comment for why that should still be safe. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_clflush.c | 10 +- 1 file changed, 9 inser

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

2021-10-27 Thread Matthew Auld
Should not be needed. Even with non-coherent display, we should be using device local-memory there, and not system memory. v2: also add a warning in i915_gem_clflush_object Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström #v1 --- drivers/gpu/drm/i915/gem

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

2021-10-27 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 Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_clflush.c

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

2021-10-27 Thread Matthew Auld
Move it next to its partner in crime; gpu_write_needs_clflush. For better readability lets keep gpu vs cpu at least in the same file. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 12 drivers/gpu

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

2021-10-27 Thread Matthew Auld
On Wed, 27 Oct 2021 at 15:54, Lucas De Marchi wrote: > > On Wed, Oct 27, 2021 at 08:57:48AM +0100, Matthew Auld wrote: > >On Thu, 21 Oct 2021 at 13:54, Matthew Auld wrote: > >> > >> wbinvd_on_all_cpus() is only defined on x86 it seems, plus we need

Re: [PATCH v2 1/3] drm/i915: Introduce refcounted sg-tables

2021-10-27 Thread Matthew Auld
On 27/10/2021 11:52, Thomas Hellström wrote: As we start to introduce asynchronous failsafe object migration, where we update the object state and then submit asynchronous commands we need to record what memory resources are actually used by various part of the command stream. Initially for three

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

2021-09-20 Thread Matthew Auld
contexts, like is already done for the kernel 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:

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

2021-09-20 Thread Matthew Auld
allowed to lose its content on suspend. v3: - Slight documentation clarification (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-20 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

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

2021-09-20 Thread Matthew Auld
44,7 +644,7 @@ static int init_aliasing_ppgtt(struct i915_ggtt *ggtt) struct i915_ppgtt *ppgtt; int err; - ppgtt = i915_ppgtt_create(ggtt->vm.gt); + ppgtt = i915_ppgtt_create(ggtt->vm.gt, I915_BO_ALLOC_PM_EARLY); I guess could leave as flags=0, since appgtt is not relevant o

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

2021-09-21 Thread Matthew Auld
es array is never actually cleared in unpopulate this might lead to a nasty uaf. Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2") Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 - 1 file changed,

[PATCH v4 02/14] drm/ttm: stop setting page->index for the ttm_tt

2021-09-21 Thread Matthew Auld
at in the next patch. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: 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_

[PATCH v4 03/14] drm/ttm: move ttm_tt_{add, clear}_mapping into amdgpu

2021-09-21 Thread Matthew Auld
later tries to touch them. v2(Christian): - Drop the functions altogether and just inline modifying the page->mapping Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 15 ++- drivers/gpu/drm/ttm/ttm_tt.

[PATCH v4 04/14] drm/ttm: remove TTM_PAGE_FLAG_NO_RETRY

2021-09-21 Thread Matthew Auld
No longer used it seems. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: 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

[PATCH v4 05/14] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-21 Thread Matthew Auld
Suggested-by: Christian König Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_bo.c| 4 ++-- drivers/gpu/drm/radeon

[PATCH v4 06/14] drm/ttm: add some kernel-doc for TTM_TT_FLAG_*

2021-09-21 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. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- include/drm/ttm/ttm_tt.h | 57 ++---

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

2021-09-21 Thread Matthew Auld
handle objects which don't even have mm.pages, so bundling this into put_pages() would require somehow handling that edge case, hence just letting the ttm backend handle everything in try_to_writeback doesn't seem too bad. Signed-off-by: Matthew Auld Cc: Thomas Hellström

[PATCH v4 07/14] drm/ttm: add TTM_TT_FLAG_EXTERNAL_MAPPABLE

2021-09-21 Thread Matthew Auld
PABLE in the definition of EXTERNAL_MAPPABLE, just leave it the caller to handle this correctly, otherwise we might encounter subtle issues. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm

[PATCH v4 08/14] drm/i915/gem: Break out some shmem backend utils

2021-09-21 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 v4 11/14] drm/i915/ttm: use cached system pages when evicting lmem

2021-09-21 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 v4 10/14] drm/i915/ttm: hide shmem objects from TTM LRU

2021-09-21 Thread Matthew Auld
able to do the bo_unpin() from the unpopulate hook, but since that can be called from the BO destroy path we will likely go down in flames. An alternative is to maybe just add EXTERNAL objects to some bdev->external LRU in TTM, or just don't add them at all? Signed-off-by: Matthew

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

2021-09-21 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 v4 13/14] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-21 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 v4 14/14] drm/i915/ttm: enable shmem tt backend

2021-09-21 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 f68481b852ff

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

2021-09-21 Thread Matthew Auld
gine as NULL, but this does require adding some extra handling in get_driver_name etc. v2(Daniel): - Try to make the commit message less confusing Fixes: 855e39e65cfc ("drm/i915: Initialise basic fence before acquiring seqno") Signed-off-by: Matthew Auld Cc: Michael Mason Cc: Daniel

[PATCH] drm/i915/selftests: exercise shmem_writeback with THP

2021-09-21 Thread Matthew Auld
is now fixed. While the IGTs did eventually hit this(although not during pre-merge it seems), it's likely worthwhile adding some explicit coverage for this scenario in the shrink_thp selftest. References: https://gitlab.freedesktop.org/drm/intel/-/issues/4166 Signed-off-by: Matthew Aul

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

2021-09-22 Thread Matthew Auld
> not protected from eviction by fences. > > Cc: Matthew Brost > Fixes: 91160c839824 ("drm/i915: Take pinning into account in > __i915_gem_object_is_lmem") > > Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld

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

2021-09-22 Thread Matthew Auld
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, which > triggers a lockdep warning in __

Re: [PATCH v4 10/14] drm/i915/ttm: hide shmem objects from TTM LRU

2021-09-22 Thread Matthew Auld
On 21/09/2021 12:48, Christian König wrote: Am 21.09.21 um 13:01 schrieb Matthew Auld: This is probably a NAK. But ideally we need to somehow prevent TTM from seeing shmem objects when doing its LRU swap walk. Since these are EXTERNAL they are ignored anyway, but keeping them in the LRU seems

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

2021-09-23 Thread Matthew Auld
), increase the timeout before we mark the gt wedged and proceed. Signed-off-by: Thomas Hellström Acked-by: Matthew Auld --- 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

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

2021-09-23 Thread Matthew Auld
k the aliasing ppgtt page table flags for 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) v5: - Mark GuC LMEM objects

[PATCH] drm/i915: remember to call i915_sw_fence_fini

2021-09-24 Thread Matthew Auld
Seems to fix some object-debug splat which appeared while debugging something unrelated. v2: s/guc_blocked/guc_state.blocked/ Signed-off-by: Matthew Auld Cc: Ville Syrjälä Cc: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a

[PATCH v5 02/13] drm/ttm: stop setting page->index for the ttm_tt

2021-09-27 Thread Matthew Auld
at in the next patch. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: 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_

[PATCH v5 01/13] drm/ttm: stop calling tt_swapin in vm_access

2021-09-27 Thread Matthew Auld
es array is never actually cleared in unpopulate this might lead to a nasty uaf. Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2") Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: Thomas Hellström Reviewed-by: Christian König ---

[PATCH v5 06/13] drm/ttm: add some kernel-doc for TTM_TT_FLAG_*

2021-09-27 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. v2(Christian): - Add a note that FLAG_SWAPPED shouldn't need to be touched by drivers. - Mention what FLAG_POPULATED does. Signed-

[PATCH v5 03/13] drm/ttm: move ttm_tt_{add, clear}_mapping into amdgpu

2021-09-27 Thread Matthew Auld
later tries to touch them. v2(Christian): - Drop the functions altogether and just inline modifying the page->mapping Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 15 ++- dr

[PATCH v5 05/13] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-27 Thread Matthew Auld
Suggested-by: Christian König Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_bo.c| 4

[PATCH v5 04/13] drm/ttm: remove TTM_PAGE_FLAG_NO_RETRY

2021-09-27 Thread Matthew Auld
No longer used it seems. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Reviewed-by: 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

[PATCH v5 08/13] drm/i915/gem: Break out some shmem backend utils

2021-09-27 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 v5 09/13] drm/i915/ttm: add tt shmem backend

2021-09-27 Thread Matthew Auld
to come up with something better later. 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/i91

[PATCH v5 07/13] drm/ttm: add TTM_TT_FLAG_EXTERNAL_MAPPABLE

2021-09-27 Thread Matthew Auld
PABLE in the definition of EXTERNAL_MAPPABLE, just leave it the caller to handle this correctly, otherwise we might encounter subtle issues. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm

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

2021-09-27 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 v5 10/13] drm/i915: try to simplify make_{un}shrinkable

2021-09-27 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 v5 11/13] drm/i915/ttm: make evicted shmem pages visible to the shrinker

2021-09-27 Thread Matthew Auld
don't touch the shrinker LRU more than needed. v2(Thomas) - Handle managing 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/i91

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

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

Re: [Intel-gfx] [PATCH v5 01/13] drm/ttm: stop calling tt_swapin in vm_access

2021-09-27 Thread Matthew Auld
On Mon, 27 Sept 2021 at 12:47, Christian König wrote: > > Any objections that I just push patches 1-7 to drm-misc-next? Please go ahead Christian. Thanks. > > Christian. > > Am 27.09.21 um 13:41 schrieb Matthew Auld: > > In commit: > > > > commit 09ac

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

2021-09-28 Thread Matthew Auld
obj_link))) { GEM_BUG_ON(vma->obj != obj); spin_unlock(&obj->vma.lock); - __i915_vma_put(vma); Unrelated change? Not seeing any DG1 machines in CI currently, so assuming this was tested locally, Reviewed-by: Matthew Auld

[PATCH 1/3] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-29 Thread Matthew Auld
Suggested-by: Christian König Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_bo.c| 4

[PATCH 2/3] drm/ttm: add some kernel-doc for TTM_TT_FLAG_*

2021-09-29 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. v2(Christian): - Add a note that FLAG_SWAPPED shouldn't need to be touched by drivers. - Mention what FLAG_POPULATED does. Signed-

[PATCH 3/3] drm/ttm: add TTM_TT_FLAG_EXTERNAL_MAPPABLE

2021-09-29 Thread Matthew Auld
PABLE in the definition of EXTERNAL_MAPPABLE, just leave it the caller to handle this correctly, otherwise we might encounter subtle issues. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 -- drivers/gpu/drm/ttm/ttm

Re: [Intel-gfx] [PATCH v5 01/13] drm/ttm: stop calling tt_swapin in vm_access

2021-09-29 Thread Matthew Auld
On Wed, 29 Sept 2021 at 13:01, Christian König wrote: > > Am 27.09.21 um 18:14 schrieb Matthew Auld: > > On Mon, 27 Sept 2021 at 12:47, Christian König > > wrote: > >> Any objections that I just push patches 1-7 to drm-misc-next? > > Please go ahead Christ

Re: [Intel-gfx] [PATCH 1/3] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-30 Thread Matthew Auld
!(clear && ttm && !(ttm->page_flags & TTM_PAGE_FLAG_ZERO_ALLOC))) | ^~~~ | TTM_TT_FLAG_ZERO_ALLOC Do we just need to revert the bad commit in drm-rerere, rebuild tip, and try again? If so I can try to attempt this. > > Christian. > > Am 29.09.21 um 15:26 schrieb

Re: [Intel-gfx] [PATCH 1/3] drm/ttm: s/FLAG_SG/FLAG_EXTERNAL/

2021-09-30 Thread Matthew Auld
On Thu, 30 Sept 2021 at 08:45, Christian König wrote: > > Am 30.09.21 um 09:42 schrieb Matthew Auld: > > On Thu, 30 Sept 2021 at 08:28, Christian König > > wrote: > >> I pushed those to drm-misc-next and fixed the i915 merge fallout in > >> drm-tip. >

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

2021-09-30 Thread Matthew Auld
On 30/09/2021 11:04, Michel Dänzer wrote: On 2021-09-29 13:54, Thomas Hellström wrote: On Mon, 2021-09-27 at 12:41 +0100, Matthew Auld wrote: 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

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

2021-10-01 Thread Matthew Auld
ject_free_mmaps() in __i915_gem_object_pages_fini() to make sure we don't inadvertedly introduce a race. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld #v1 R-b still stands. --- drivers/gpu/drm/i915/gem/i915_gem_object.c | 43 +++--- drivers/gpu/drm/i915/g

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

2021-10-05 Thread Matthew Auld
] drm/i915/ttm: add tt shmem backend 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

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

2021-10-05 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 v6 4/8] drm/i915: drop unneeded make_unshrinkable in free_object

2021-10-05 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 v6 2/8] drm/i915/ttm: add tt shmem backend

2021-10-05 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 v6 3/8] drm/i915/gtt: drop unneeded make_unshrinkable

2021-10-05 Thread Matthew Auld
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(-) diff --git a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c b/drivers/gpu/drm/i915/gt

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

2021-10-05 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 --- .../gpu/drm/i915/gem/i915_gem_object_types.h | 24 +- drivers/gpu/drm/i915/gem/i915_gem_shrinker.c | 31

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

2021-10-05 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 v6 6/8] drm/i915/ttm: move shrinker management into adjust_lru

2021-10-05 Thread Matthew Auld
, 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/gpu/drm/i915/gem/i915_gem_pages.c | 5 +- drivers/

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

2021-10-05 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 v7 1/8] drm/i915/gem: Break out some shmem backend utils

2021-10-06 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 v7 3/8] drm/i915/gtt: drop unneeded make_unshrinkable

2021-10-06 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 v7 4/8] drm/i915: drop unneeded make_unshrinkable in free_object

2021-10-06 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 v7 2/8] drm/i915/ttm: add tt shmem backend

2021-10-06 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 v7 5/8] drm/i915: add some kernel-doc for shrink_pin and friends

2021-10-06 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 v7 6/8] drm/i915/ttm: move shrinker management into adjust_lru

2021-10-06 Thread Matthew Auld
, which actually seems to fit quite well for what we want here. v4(Thomas): - Just use a simple boolean for tracking ttm_shrinkable. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.h| 8 +++ .../

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

2021-10-06 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 v7 8/8] drm/i915/ttm: enable shmem tt backend

2021-10-06 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] drm/i915/buddy: fixup potential uaf

2022-01-17 Thread Matthew Auld
("drm/i915: buddy allocator") Signed-off-by: Matthew Auld Cc: Arunpravin Cc: Christian König --- drivers/gpu/drm/i915/i915_buddy.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_buddy.c b/drivers/gpu/drm/i915/i915_buddy.c ind

Re: [PATCH] drm/i915: Fix vma resource freeing

2022-01-20 Thread Matthew Auld
On 19/01/2022 17:47, Thomas Hellström wrote: In some cases we use leftover kfree() instead of i915_vma_resource_free(). Fix this. Fixes: Fixes: 2f6b90da9192 ("drm/i915: Use vma resources for async unbinding") Reported-by: Robert Beckett Cc: Matthew Auld Signed-off-by: Thomas

Re: [PATCH v2 1/4] drm/i915: enforce min GTT alignment for discrete cards

2022-01-20 Thread Matthew Auld
On 20/01/2022 13:15, Robert Beckett wrote: On 20/01/2022 11:46, Ramalingam C wrote: On 2022-01-18 at 17:50:34 +, Robert Beckett wrote: From: Matthew Auld For local-memory objects we need to align the GTT addresses to 64K, both for the ppgtt and ggtt. We need to support vm

Re: [PATCH v2 1/4] drm/i915: enforce min GTT alignment for discrete cards

2022-01-20 Thread Matthew Auld
On 20/01/2022 15:44, Robert Beckett wrote: On 20/01/2022 14:59, Matthew Auld wrote: On 20/01/2022 13:15, Robert Beckett wrote: On 20/01/2022 11:46, Ramalingam C wrote: On 2022-01-18 at 17:50:34 +, Robert Beckett wrote: From: Matthew Auld For local-memory objects we need to align

Re: [PATCH v2 1/4] drm/i915: enforce min GTT alignment for discrete cards

2022-01-20 Thread Matthew Auld
On 20/01/2022 16:09, Robert Beckett wrote: On 20/01/2022 15:58, Matthew Auld wrote: On 20/01/2022 15:44, Robert Beckett wrote: On 20/01/2022 14:59, Matthew Auld wrote: On 20/01/2022 13:15, Robert Beckett wrote: On 20/01/2022 11:46, Ramalingam C wrote: On 2022-01-18 at 17:50:34 +

Re: [PATCH v9 4/6] drm: implement a method to free unused pages

2022-01-20 Thread Matthew Auld
On 19/01/2022 11:37, Arunpravin wrote: On contiguous allocation, we round up the size to the *next* power of 2, implement a function to free the unused pages after the newly allocate block. v2(Matthew Auld): - replace function name 'drm_buddy_free_unused_pages' with drm_buddy_

Re: [PATCH v9 2/6] drm: improve drm_buddy_alloc function

2022-01-21 Thread Matthew Auld
to i915 driver v3(Matthew Auld): - Fix alignment issues and remove unnecessary list_empty check - add more validation checks for input arguments - make alloc_range() block allocations as bottom-up - optimize order computation logic - replace uint64_t with u64, which is preferred in

Re: [PATCH v9 3/6] drm: implement top-down allocation method

2022-01-21 Thread Matthew Auld
drm_buddy_free() request and split up of larger blocks for a single page request. v2: - Fix alignment issues(Matthew Auld) - Remove unnecessary list_empty check(Matthew Auld) - merged the below patch to see the feature in action - add top-down alloc support to i915 driver Signed-off-by

Re: [PATCH] drm/i915/selftests: Use less in contexts steal guc id test

2022-01-25 Thread Matthew Auld
ake the test pass on systems with a small LMEM BAR(256M), where before it was just running out of memory, Reviewed-by: Matthew Auld > --- > drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/gt

[PATCH] drm/i915/selftests: fix error handling in guc_steal_ids

2022-01-25 Thread Matthew Auld
Ensure we drop the reference to the last rq, otherwise we are leaking the context etc. Also don't zero the previous valid context. Signed-off-by: Matthew Auld Cc: Matthew Brost --- drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --

[PATCH 00/20] Initial support for small BAR recovery

2022-01-26 Thread Matthew Auld
Starting from DG2 we will have resizable BAR support for device local-memory, but in some cases the final BAR size might still be smaller than the total local-memory size. In such cases only part of local-memory will be CPU accessible, while the remainder is only accessible via the GPU. This series

[PATCH 04/20] drm/i915: add io_size plumbing

2022-01-26 Thread Matthew Auld
With small LMEM-BAR we need to be able to differentiate between the total size of LMEM, and how much of it is CPU mappable. The end goal is to be able to utilize the entire range, even if part of is it not CPU accessible. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm

[PATCH 02/20] drm: implement top-down allocation method

2022-01-26 Thread Matthew Auld
split up of larger blocks for a single page request. v2: - Fix alignment issues(Matthew Auld) - Remove unnecessary list_empty check(Matthew Auld) - merged the below patch to see the feature in action - add top-down alloc support to i915 driver Signed-off-by: Arunpravin --- drivers/gpu

[PATCH 03/20] drm: implement a method to free unused pages

2022-01-26 Thread Matthew Auld
From: Arunpravin On contiguous allocation, we round up the size to the *next* power of 2, implement a function to free the unused pages after the newly allocate block. v2(Matthew Auld): - replace function name 'drm_buddy_free_unused_pages' with drm_buddy_block_trim - rep

[PATCH 01/20] drm: improve drm_buddy_alloc function

2022-01-26 Thread Matthew Auld
Auld): - Fix alignment issues and remove unnecessary list_empty check - add more validation checks for input arguments - make alloc_range() block allocations as bottom-up - optimize order computation logic - replace uint64_t with u64, which is preferred in the kernel v4(Matthew Auld

[PATCH 05/20] drm/i915/ttm: require mappable by default

2022-01-26 Thread Matthew Auld
this behaviour. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 4 drivers/gpu/drm/i915/intel_region_ttm.c | 5 + 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem

[PATCH 06/20] drm/i915: add I915_BO_ALLOC_TOPDOWN

2022-01-26 Thread Matthew Auld
If the user doesn't require CPU access for the buffer, then ALLOC_TOPDOWN should be used, in order to prioritise allocating in the non-mappable portion of LMEM. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 15 +++ dr

[PATCH 08/20] drm/i915/buddy: adjust res->start

2022-01-26 Thread Matthew Auld
in an actual move, instead of being turned into a noop. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/dr

[PATCH 09/20] drm/i915/buddy: tweak 2big check

2022-01-26 Thread Matthew Auld
Otherwise we get -EINVAL, instead of the more useful -E2BIG if the allocation doesn't fit within the pfn range, like with mappable lmem. The hugepages selftest, for example, needs this to know if a smaller size is needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gp

[PATCH 07/20] drm/i915/buddy: track available visible size

2022-01-26 Thread Matthew Auld
for when deciding if we should attempt to evict certain buffers. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 55 ++- drivers/gpu/drm/i915/i915_ttm_buddy_manager.h | 8 ++- drivers/gpu/drm/i915/intel_region_ttm.c | 1

[PATCH 11/20] drm/i915/ttm: tweak priority hint selection

2022-01-26 Thread Matthew Auld
For some reason we are selecting PRIO_HAS_PAGES when we don't have mm.pages, and vice versa. Perhaps something else is going on here. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)

[PATCH 13/20] drm/i915/ttm: mappable migration on fault

2022-01-26 Thread Matthew Auld
placements permit it. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 58 ++--- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index

[PATCH 16/20] drm/i915/create: apply ALLOC_TOPDOWN by default

2022-01-26 Thread Matthew Auld
ce will be able to provide a hint if CPU access to the buffer is needed. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_create.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_create.c b/drivers/gpu/dr

[PATCH 12/20] drm/i915/ttm: make eviction mappable aware

2022-01-26 Thread Matthew Auld
t way we hopefully victimize these last. Signed-off-by: Matthew Auld Cc: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 65 - 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i91

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