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

2021-10-18 Thread Matthew Auld
-in, 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_shmem.c

[Intel-gfx] [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: Matthew Auld

[Intel-gfx] [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 Auld

[Intel-gfx] [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

[Intel-gfx] [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 file

[Intel-gfx] [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 file

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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/

[Intel-gfx] [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

[Intel-gfx] [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

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

2021-10-18 Thread Matthew Auld
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 Hellström Cc: Christian K

[Intel-gfx] [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

[Intel-gfx] [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

Re: [Intel-gfx] [PATCH] drm/i915/selftests: Wait request to finish

2021-10-18 Thread Matthew Auld
On 18/10/2021 04:42, Oak Zeng wrote: Caller of function igt_gpu_fill_dw assumes when this function returns, the gpu command to fill dword is already finished. Caller usually checks the GPU filling result immediately, see the usage in function __igt_write_huge. If there is no wait, when function

Re: [Intel-gfx] [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

Re: [Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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/

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

2021-10-11 Thread Matthew Auld
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 Hellström Cc: Christian K

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

Re: [Intel-gfx] ✗ Fi.CI.IGT: failure for series starting with [v7,1/8] drm/i915/gem: Break out some shmem backend utils

2021-10-07 Thread Matthew Auld
On Wed, 6 Oct 2021 at 16:26, Patchwork wrote: > *Patch Details* > *Series:* series starting with [v7,1/8] drm/i915/gem: Break out some > shmem backend utils > *URL:* https://patchwork.freedesktop.org/series/95501/ > *State:* failure > *Details:* >

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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 +++ .../

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [PATCH v7 2/8] drm/i915/ttm: add tt shmem backend

2021-10-06 Thread Matthew Auld
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 Hellström Cc: Christian K

[Intel-gfx] [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

[Intel-gfx] [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/

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [PATCH v6 2/8] drm/i915/ttm: add tt shmem backend

2021-10-05 Thread Matthew Auld
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 Hellström Cc: Christian K

[Intel-gfx] [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

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-gfx@lists.freedesktop.org Cc: dri-de

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

2021-10-01 Thread Matthew Auld
() 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/gem/i915_gem_object.h | 5

Re: [Intel-gfx] [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: [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-ti

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 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

[Intel-gfx] [PATCH 3/3] drm/ttm: add TTM_TT_FLAG_EXTERNAL_MAPPABLE

2021-09-29 Thread Matthew Auld
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_tt.c

[Intel-gfx] [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-off-by: Matthew

[Intel-gfx] [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

Re: [Intel-gfx] [PATCH 08/19] drm/i915: Fix runtime pm handling in i915_gem_shrink

2021-09-29 Thread Matthew Auld
On Wed, 29 Sept 2021 at 09:37, Matthew Auld wrote: > > On Mon, 30 Aug 2021 at 13:10, Maarten Lankhorst > wrote: > > > > We forgot to call intel_runtime_pm_put on error, fix it! > > > > Signed-off-by: Maarten Lankhorst > > Fixes: cf41a8f1dc1e ("drm

Re: [Intel-gfx] [PATCH 08/19] drm/i915: Fix runtime pm handling in i915_gem_shrink

2021-09-29 Thread Matthew Auld
On Mon, 30 Aug 2021 at 13:10, Maarten Lankhorst wrote: > > We forgot to call intel_runtime_pm_put on error, fix it! > > Signed-off-by: Maarten Lankhorst > Fixes: cf41a8f1dc1e ("drm/i915: Finally remove obj->mm.lock.") > Cc: Thomas Hellström > Cc: Daniel Vetter > Cc: # v5.13+ How does the err

Re: [Intel-gfx] [PATCH 04/19] drm/i915: Remove gen6_ppgtt_unpin_all

2021-09-29 Thread Matthew Auld
On Mon, 30 Aug 2021 at 13:09, Maarten Lankhorst wrote: > > gen6_ppgtt_unpin_all is unused, kill it. > > Signed-off-by: Maarten Lankhorst Reviewed-by: Matthew Auld > --- > drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 11 --- > drivers/gpu/drm/i915/gt/gen6_ppgtt.h | 1

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

2021-09-28 Thread Matthew Auld
spin_unlock(>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

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

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

2021-09-27 Thread Matthew Auld
esting 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_shrinker.c

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

2021-09-27 Thread Matthew Auld
o we 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/i915_gem

[Intel-gfx] [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

[Intel-gfx] [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

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

2021-09-27 Thread Matthew Auld
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/i915/gem/i915_gem_

[Intel-gfx] [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-off-by: Matthew

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

2021-09-27 Thread Matthew Auld
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_tt.c

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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

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

2021-09-27 Thread Matthew Auld
ter 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 ++- drivers

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

2021-09-27 Thread Matthew Auld
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 --- dri

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

2021-09-27 Thread Matthew Auld
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_vm.c

[Intel-gfx] [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

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

2021-09-23 Thread Matthew Auld
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

Re: [Intel-gfx] [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: [Intel-gfx] [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: [Intel-gfx] [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: [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

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

2021-09-21 Thread Matthew Auld
that 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 Auld Cc

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

2021-09-21 Thread Matthew Auld
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 Vetter Reviewed-by: Daniel Vetter

[Intel-gfx] [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

[Intel-gfx] [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

[Intel-gfx] [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 Cc: Chris

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

2021-09-21 Thread Matthew Auld
esting 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_shrinker.c

[Intel-gfx] [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

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

2021-09-21 Thread Matthew Auld
to be 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 Auld

[Intel-gfx] [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

[Intel-gfx] [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

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

2021-09-21 Thread Matthew Auld
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_tt.c

[Intel-gfx] [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 ++-- 1

[Intel-gfx] [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

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

2021-09-21 Thread Matthew Auld
ter 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.c

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

2021-09-21 Thread Matthew Auld
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_vm.c

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

2021-09-21 Thread Matthew Auld
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, 5 de

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

2021-09-20 Thread Matthew Auld
reate(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 on discrete/modern hw(?). Reviewed-by: Matthew Auld if (IS_ERR(ppgtt)) return PTR_ERR(ppgtt); diff --git

Re: [Intel-gfx] [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

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

2021-09-20 Thread Matthew Auld
to lose its content on suspend. v3: - Slight documentation clarification (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld

Re: [Intel-gfx] [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: Brost

Re: [Intel-gfx] [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

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

2021-09-16 Thread Matthew Auld
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: [Intel-gfx] [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: [Intel-gfx] [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

[Intel-gfx] [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

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