[RFC PATCH] drm/ttm: Simplify the delayed destroy locking

2021-04-12 Thread Thomas Hellström
lists, sleeping eviction locks that are kept, optional drm_mm eviction roster usage and moving over to a completely lockless delayed destroy list even if the traversal order will then change because there is no llist_add_tail(). Cc: Christian König Cc: Daniel Vetter Signed-off-by: Thomas Hell

Re: [RFC PATCH] drm/ttm: Simplify the delayed destroy locking

2021-04-12 Thread Thomas Hellström
. Am 12.04.21 um 15:17 schrieb Thomas Hellström: This RFC needs some decent testing on a driver with bos that share reservation objects, and of course a check for whether I missed something obvious. The locking around delayed destroy is rather complex due to the fact that we want to individualize dma

Re: [RFC PATCH] drm/ttm: Simplify the delayed destroy locking

2021-04-12 Thread Thomas Hellström
On 4/12/21 4:21 PM, Christian König wrote: Am 12.04.21 um 16:16 schrieb Thomas Hellström: Hi, Christian, On 4/12/21 4:01 PM, Christian König wrote: Hi Thomas, well in general a good idea, but I'm working on a different plan for a while now. My idea here is that instead of the B

Re: [RFC PATCH] drm/ttm: Simplify the delayed destroy locking

2021-04-12 Thread Thomas Hellström
On Mon, 2021-04-12 at 17:43 +0200, Daniel Vetter wrote: > On Mon, Apr 12, 2021 at 04:21:37PM +0200, Christian König wrote: > > > > > > Am 12.04.21 um 16:16 schrieb Thomas Hellström: > > > Hi, Christian, > > > > > > On 4/12/21 4

[RFC PATCH] drm/i915: Simplify userptr locking

2021-04-12 Thread Thomas Hellström
ross drivers at some point. Cc: Maarten Lankhorst Cc: Daniel Vetter Cc: Dave Airlie Cc: dri-devel@lists.freedesktop.org Cc: Intel Graphics Development Signed-off-by: Thomas Hellström --- .../gpu/drm/i915/gem/i915_gem_execbuffer.c| 21 +++--- drivers/gpu/drm/i915/gem/i915_gem_object.h

[RFC] Cross-driver ww transaction lock lists

2021-04-13 Thread Thomas Hellström
Hi! During the dma_resv conversion of the i915 driver, we've been using ww transaction lock lists to keep track of ww_mutexes that are locked during the transaction so that they can be batch unlocked at suitable locations. Including also the LMEM/VRAM eviction we've ended up with two static lists

[PATCH] drm/i915: Simplify userptr locking

2021-04-27 Thread Thomas Hellström
Cc: Intel Graphics Development Signed-off-by: Thomas Hellström --- .../gpu/drm/i915/gem/i915_gem_execbuffer.c| 21 +++--- drivers/gpu/drm/i915/gem/i915_gem_object.h| 2 - drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 72 ++- drivers/gpu/drm/i915/i915_drv.h

Re: [PATCH 4/7] drm/i915/gem/ttm: Place new BOs in the requested region

2021-08-03 Thread Thomas Hellström
Hi, Jason, On 7/16/21 12:38 AM, Jason Ekstrand wrote: __i915_gem_ttm_object_init() was ignoring the placement requests coming from the client and always placing all BOs in SMEM upon creation. Instead, compute the requested placement set from the object and pass that into ttm_bo_init_reserved().

Re: [PATCH 4/7] drm/i915/gem/ttm: Place new BOs in the requested region

2021-08-03 Thread Thomas Hellström
On 8/4/21 8:49 AM, Thomas Hellström wrote: Hi, Jason, On 7/16/21 12:38 AM, Jason Ekstrand wrote: __i915_gem_ttm_object_init() was ignoring the placement requests coming from the client and always placing all BOs in SMEM upon creation. Instead, compute the requested placement set from the

Re: [PATCH 5/7] drm/i915/gem/ttm: Respect the objection region in placement_from_obj

2021-08-04 Thread Thomas Hellström
Hi, On 7/22/21 11:59 AM, Matthew Auld wrote: On Thu, 22 Jul 2021 at 10:49, Matthew Auld wrote: On Wed, 21 Jul 2021 at 21:11, Jason Ekstrand wrote: On Mon, Jul 19, 2021 at 8:35 AM Matthew Auld wrote: On Fri, 16 Jul 2021 at 20:49, Jason Ekstrand wrote: On Fri, Jul 16, 2021 at 1:45 PM Matth

Re: [PATCH] drm/i915/gt: Potential error pointer dereference in pinned_context()

2021-08-13 Thread Thomas Hellström
&key, "migrate"); - i915_vm_put(ce->vm); + i915_vm_put(vm); return ce; } Thanks, Reviewed-by: Thomas Hellström

[PATCH v2 1/2] drm/i915/ttm: Reorganize the ttm move code somewhat

2021-08-13 Thread Thomas Hellström
In order to make the code a bit more readable and to facilitate async memcpy moves, reorganize the move code a little. Determine at an early stage whether to copy or to clear. v2: - Don't set up the memcpy iterators unless we are actually going to memcpy. Signed-off-by: Thomas Hell

[PATCH v2 0/2] drm/i915, drm/ttm: Update the ttm_move_memcpy() interface

2021-08-13 Thread Thomas Hellström
. Patch 1 reorganizes the i915 ttm move code a bit to make the change in patch 2 smaller. Patch 2 updates the ttm_move_memcpy() interface. v2: - Don't initialize memcpy iterators until they are actually needed (Patch 1). - Added proper R-B:s and Cc:s Thomas Hellström (2): drm/i91

[PATCH v2 2/2] drm/ttm, drm/i915: Update ttm_move_memcpy for async use

2021-08-13 Thread Thomas Hellström
kerneldoc that seems to have ended up with a stale version. Cc: Christian König Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 20 ++-- include/drm/ttm/ttm_bo_driver.h

[PATCH] drm/i915: Ditch the i915_gem_ww_ctx loop member

2021-08-16 Thread Thomas Hellström
_err variable running forever. Suggested-by: Maarten Lankhorst Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/i915_gem_ww.h | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_ww.h b/drivers/gpu/drm/i915/i915_gem

Re: [PATCH] drm/i915: Ditch the i915_gem_ww_ctx loop member

2021-08-16 Thread Thomas Hellström
On 8/16/21 3:25 PM, Matthew Auld wrote: On Mon, 16 Aug 2021 at 09:49, Thomas Hellström wrote: It's only used by the for_i915_gem_ww() macro and we can use the (typically) on-stack _err variable in its place. While initially setting the _err variable to -EDEADLK to enter the loop, we

Re: [PATCH] drm/i915: Ditch the i915_gem_ww_ctx loop member

2021-08-16 Thread Thomas Hellström
On 8/16/21 3:34 PM, Maarten Lankhorst wrote: Op 16-08-2021 om 15:30 schreef Thomas Hellström: On 8/16/21 3:25 PM, Matthew Auld wrote: On Mon, 16 Aug 2021 at 09:49, Thomas Hellström wrote: It's only used by the for_i915_gem_ww() macro and we can use the (typically) on-stack _err variab

[PATCH v2] drm/i915: Ditch the i915_gem_ww_ctx loop member

2021-08-16 Thread Thomas Hellström
tthew Auld Suggested-by: Maarten Lankhorst Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/i915_gem_ww.h | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_ww.h b/drivers/gpu/drm/i915/i915_gem_ww.h index f6

Re: [PATCH 1/2] drm/i915/buddy: add some pretty printing

2021-08-19 Thread Thomas Hellström
when TTM is unable to fulfil an allocation request for device > local-memory. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i915/i915_buddy.c | 45 +++ >  drivers/gpu/drm/i915/i915_buddy.h

Re: [PATCH] drm/i915/ttm: ensure we release the intel_memory_region

2021-08-19 Thread Thomas Hellström
hich doesn't do anything. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 7 +-- >  1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > b/

Re: [PATCH 2/2] drm/i915/debugfs: hook up ttm_resource_manager_debug

2021-08-19 Thread Thomas Hellström
On Wed, 2021-08-18 at 15:58 +0100, Matthew Auld wrote: > This should give a more complete view of the various bits of internal > resource manager state, for device local-memory. > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > --- >  drivers/gpu/drm/i91

Re: [PATCH v2 2/2] drm/i915/debugfs: hook up ttm_resource_manager_debug

2021-08-19 Thread Thomas Hellström
On 8/19/21 11:34 AM, Matthew Auld wrote: This should give a more complete view of the various bits of internal resource manager state, for device local-memory. v2(Thomas): - Move the region printing into a nice helper Signed-off-by: Matthew Auld Cc: Thomas Hellström For the series (2

Un-acked TTM patch

2021-08-23 Thread Thomas Hellström
Hi, Chrstian I wonder whether you could Review / ack the second patch in this series, https://patchwork.freedesktop.org/patch/449868/?series=91893&rev=3 And also ack merging that through drm-intel-gt-next, Thanks, Thomas

Re: [PATCH 1/5] drm/ttm: add a weak BO reference to the resource v2

2021-08-23 Thread Thomas Hellström
Hi, Christian, Still working through some backlog and this series appears to have slipped under the radar. Still I think a cover letter would benefit reviewers... On Mon, 2021-07-19 at 13:51 +0200, Christian König wrote: > Keep track for which BO a resource was allocated. > This is necessary to

Re: [PATCH 4/5] drm/ttm: move the LRU into resource handling

2021-08-23 Thread Thomas Hellström
On Mon, 2021-07-19 at 13:51 +0200, Christian König wrote: > This way we finally fix the problem that new resource are > not immediately evict-able after allocation. > > That has caused numerous problems including OOM on GDS handling > and not being able to use TTM as general resource manager. > >

Re: Un-acked TTM patch

2021-08-23 Thread Thomas Hellström
On 8/23/21 11:10 AM, Christian König wrote: Hi Thomas, sorry for the delay. I was on vacation and still digging though everything. Just added an rb to the second patch, but can't find the first one anywhere in my mailbox. Going to double check that on patchwork instead. Did you had a cha

Re: [PATCH 1/5] drm/vmwgfx: unbind in vmw_ttm_unpopulate

2021-08-23 Thread Thomas Hellström
gfx/vmwgfx_ttm_buffer.c | 9 +++-- > >   1 file changed, 3 insertions(+), 6 deletions(-) > > Reviewed-by: Thomas Hellström

Re: [PATCH 1/3] drm/i915/selftests: Do not use import_obj uninitialized

2021-08-25 Thread Thomas Hellström
the locking and pin pattern for dma-buf (v8)") Reported-by: Dan Carpenter Signed-off-by: Nathan Chancellor Patch looks good to me. Reviewed-by: Thomas Hellström

Re: [PATCH 2/3] drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem()

2021-08-25 Thread Thomas Hellström
= 0 The test is expected to pass if i915_gem_prime_import() returns -EOPNOTSUPP so initialize err to zero in this case. Fixes: cdb35d1ed6d2 ("drm/i915/gem: Migrate to system at dma-buf attach time (v7)") Reported-by: Dan Carpenter Signed-off-by: Nathan Chancellor Reviewed-by: Thomas Hellström

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

2021-08-25 Thread Thomas Hellström
the kernel context. Cc: Tvrtko Ursulin Cc: Matthew Auld Cc: Maarten Lankhorst Cc: Brost Matthew Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/intel_context_types.h | 8 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 4 drivers/gpu/drm/i915/gt

[PATCH] drm/i915/gem: Fix the mman selftest

2021-08-26 Thread Thomas Hellström
been moved over to TTM yet, and user-space should not be able to create out of stolen LMEM anyway. Fixes: 7961c5b60f23 ("drm/i915: Add TTM offset argument to mmap.") Cc: Maarten Lankhorst Signed-off-by: Thomas Hellström --- .../drm/i915/gem/selftests/i915_gem_mman.c| 26

Re: [PATCH 2/2] drm/i915/debugfs: hook up ttm_resource_manager_debug

2021-08-26 Thread Thomas Hellström
On Thu, 2021-08-26 at 11:16 +0200, Daniel Vetter wrote: > On Thu, Aug 19, 2021 at 09:32:20AM +0200, Thomas Hellström wrote: > > On Wed, 2021-08-18 at 15:58 +0100, Matthew Auld wrote: > > > This should give a more complete view of the various bits of > > > internal > &

Re: [PATCH 2/2] drm/i915/debugfs: hook up ttm_resource_manager_debug

2021-08-26 Thread Thomas Hellström
On Thu, 2021-08-26 at 11:51 +0200, Thomas Hellström wrote: > On Thu, 2021-08-26 at 11:16 +0200, Daniel Vetter wrote: > > On Thu, Aug 19, 2021 at 09:32:20AM +0200, Thomas Hellström wrote: > > > On Wed, 2021-08-18 at 15:58 +0100, Matthew Auld wrote: > > > > This shoul

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

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

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

2021-08-26 Thread Thomas Hellström
On Thu, 2021-08-26 at 14:04 +0100, Tvrtko Ursulin wrote: > > On 26/08/2021 11:45, Thomas Hellström wrote: > > Pinned contexts, like the migrate contexts need reset after resume > > since their context image may have been lost. Also the GuC needs to > > register pinned

Re: [Intel-gfx] [PATCH v2] drm/i915/gt: Register the migrate contexts with their engines

2021-08-26 Thread Thomas Hellström
On Thu, 2021-08-26 at 14:44 +0200, Daniel Vetter wrote: > On Thu, Aug 26, 2021 at 12:45:14PM +0200, Thomas Hellström wrote: > > Pinned contexts, like the migrate contexts need reset after resume > > since their context image may have been lost. Also the GuC needs to > > reg

TTM tt size larger than buffer object?

2021-08-27 Thread Thomas Hellström
Hi, Christian. We have a use-case with i915 where the data representation of a buffer object is larger in system memory than in LMEM/VRAM. Hence we'd like to create a ttm_tt that is larger than the buffer object itself. Quickly auditing the TTM code it looks like that should be pretty safe, as

Latest i915 / TTM repo?

2021-03-22 Thread Thomas Hellström
Hi, Dave! I was wondering whether you code share the latest status and location of your latest i915/TTM code? Thanks, Thomas ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [Intel-gfx] [PATCH v9 32/70] drm/i915: Prepare for obj->mm.lock removal, v2.

2021-03-23 Thread Thomas Hellström
On Tue, 2021-03-23 at 16:18 +, Matthew Auld wrote: > On Tue, 23 Mar 2021 at 15:52, Maarten Lankhorst > wrote: > > > > From: Thomas Hellström > > > > Stolen objects need to lock, and we may call put_pages when > > refcount drops to 0, ensure all calls are

[PATCH 0/7] drm/i915: Move LMEM (VRAM) management over to TTM

2021-05-11 Thread Thomas Hellström
code. Intention is to follow up with - System memory support - TTM CPU pagefaulting - Pipelined accelerated moves / migration Thomas Hellström (7): drm/i915: Untangle the vma pages_mutex drm/i915: Don't free shared locks while shared drm/i915/ttm, drm/ttm: Initialize the ttm devic

[PATCH 2/7] drm/i915: Don't free shared locks while shared

2021-05-11 Thread Thomas Hellström
add an additional refcount, for GGTT we flush the object freeing workqueue before freeing the shared lock. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c| 3 ++ .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gt/intel_ggtt.c

[PATCH 1/7] drm/i915: Untangle the vma pages_mutex

2021-05-11 Thread Thomas Hellström
From: Thomas Hellström Any sleeping dma_resv lock taken while the vma pages_mutex is held will cause a lockdep splat. Move the i915_gem_object_pin_pages() call out of the pages_mutex critical section. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/i915_vma.c | 33

[PATCH 4/7] drm/i915/ttm: Embed a ttm buffer object in the i915 gem object

2021-05-11 Thread Thomas Hellström
other backends. To make this a bit more storage efficient for the other backends, we'd have to use a pointer for the gem object which would require a lot of changes in the driver. We postpone that for later. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c

[PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.

2021-05-11 Thread Thomas Hellström
that to the TTM api. Finally modify the mock region selftests somewhat to account for a fragmenting manager. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm

[PATCH 5/7] drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem

2021-05-11 Thread Thomas Hellström
ell define specialized (hopefully reusable) iterators for their particular environment. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 155 ++ .../gpu/dr

[PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-11 Thread Thomas Hellström
M LRU lists for now, meaning that we need some sort of mechanism to tell TTM they are not swappable. A longer term goal is to get rid of the short-term pinning. Remove the old lmem backend. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/Makefile

[PATCH 7/7] drm/i915/lmem: Verify checks for lmem residency

2021-05-11 Thread Thomas Hellström
Since objects can be migrated or evicted when not pinned or locked, update the checks for lmem residency or future residency so that the value returned is not immediately stale. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/gem

Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-11 Thread Thomas Hellström
On 5/11/21 4:09 PM, Christian König wrote: Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel): On 5/11/21 3:58 PM, Christian König wrote: Am 11.05.21 um 15:25 schrieb Thomas Hellström: Most logical place to introduce TTM buffer objects is as an i915 gem object backend. We need to add

Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-12 Thread Thomas Hellström
On Wed, 2021-05-12 at 08:57 +0200, Christian König wrote: > Am 11.05.21 um 16:28 schrieb Thomas Hellström: > > > > On 5/11/21 4:09 PM, Christian König wrote: > > > > > > > > > Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel): > > > &

Re: [Intel-gfx] [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-12 Thread Thomas Hellström
Hi, Matthew, Thanks for reviewing! On 5/12/21 1:45 PM, Matthew Auld wrote: On Tue, 11 May 2021 at 14:26, Thomas Hellström wrote: Most logical place to introduce TTM buffer objects is as an i915 gem object backend. We need to add some ops to account for added functionality like delayed delete

Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-12 Thread Thomas Hellström
On Wed, 2021-05-12 at 09:09 +0200, Christian König wrote: > Am 12.05.21 um 09:05 schrieb Thomas Hellström: > > On Wed, 2021-05-12 at 08:57 +0200, Christian König wrote: > > > Am 11.05.21 um 16:28 schrieb Thomas Hellström: > > > > On 5/11/21 4:09 PM, Christian König

Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend

2021-05-12 Thread Thomas Hellström
On 5/12/21 3:05 PM, Christian König wrote: Am 12.05.21 um 15:02 schrieb Thomas Hellström: On Wed, 2021-05-12 at 09:09 +0200, Christian König wrote: Am 12.05.21 um 09:05 schrieb Thomas Hellström: On Wed, 2021-05-12 at 08:57 +0200, Christian König wrote: Am 11.05.21 um 16:28 schrieb Thomas

Re: [Intel-gfx] [PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.

2021-05-17 Thread Thomas Hellström
On Wed, 2021-05-12 at 09:57 +0100, Matthew Auld wrote: > On Tue, 11 May 2021 at 14:26, Thomas Hellström > wrote: > > > > Temporarily remove the buddy allocator and related selftests > > and hook up the TTM range manager for i915 regions. > > > > In orde

Re: [Intel-gfx] [PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.

2021-05-17 Thread Thomas Hellström
On Mon, 2021-05-17 at 09:18 +0200, Thomas Hellström wrote: > On Wed, 2021-05-12 at 09:57 +0100, Matthew Auld wrote: > > On Tue, 11 May 2021 at 14:26, Thomas Hellström > > wrote: > > > > > > Temporarily remove the buddy allocator and related selftests > >

Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot

2021-05-17 Thread Thomas Hellström
On 5/17/21 3:11 PM, Christoph Hellwig wrote: On Mon, May 17, 2021 at 04:09:42PM +0300, Serge Belyshev wrote: Christoph Hellwig writes: As an ad-hoc experiment: can you replace the call to remap_pfn_range with remap_pfn_range_notrack (and export it if you build i915 modular) in remap_io_sg

Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot

2021-05-17 Thread Thomas Hellström
On 5/17/21 11:46 PM, Thomas Hellström wrote: On 5/17/21 3:11 PM, Christoph Hellwig wrote: On Mon, May 17, 2021 at 04:09:42PM +0300, Serge Belyshev wrote: Christoph Hellwig writes: As an ad-hoc experiment:  can you replace the call to remap_pfn_range with remap_pfn_range_notrack (and

Re: [Intel-gfx] [PATCH 5/7] drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem

2021-05-17 Thread Thomas Hellström
On 5/17/21 12:57 PM, Jani Nikula wrote: On Tue, 11 May 2021, Thomas Hellström wrote: The internal ttm_bo_util memcpy uses vmap functionality, and while it probably might be possible to use it for copying in- and out of sglist represented io memory, using io_mem_reserve() / io_mem_free

[PATCH v2 00/15] drm/i915: Move LMEM (VRAM) management over to TTM

2021-05-18 Thread Thomas Hellström
m_pfn Thomas Hellström (11): drm/i915: Untangle the vma pages_mutex drm/i915: Don't free shared locks while shared drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages drm/ttm: Export functions to initialize and finalize the ttm range manager standalone

[PATCH v2 01/15] drm/i915: Untangle the vma pages_mutex

2021-05-18 Thread Thomas Hellström
From: Thomas Hellström Any sleeping dma_resv lock taken while the vma pages_mutex is held will cause a lockdep splat. Move the i915_gem_object_pin_pages() call out of the pages_mutex critical section. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/i915_vma.c | 33

[PATCH v2 03/15] drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages

2021-05-18 Thread Thomas Hellström
All users of this function actually want the dma segment sizes, but that's not what's calculated. Fix that and rename the function to i915_sg_dma_sizes to reflect what's calculated. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 2 +- drivers/g

[PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone

2021-05-18 Thread Thomas Hellström
i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm

[PATCH v2 07/15] drm/ttm: Export ttm_bo_tt_destroy()

2021-05-18 Thread Thomas Hellström
For the upcoming kmapping i915 memcpy_move, export ttm_bo_tt_destroy(). A future change might be to move the new memcpy_move into ttm, replacing the old ioremapping one. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion

[PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem

2021-05-18 Thread Thomas Hellström
es on memremap functionality, and that don't want to use scatterlists for VRAM may well define specialized (hopefully reusable) iterators for their particular environment. Cc: Christian König Signed-off-by: Thomas Hellström --- v2: - Move new TTM exports to a separate commit. (Reported by Chris

[PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers

2021-05-18 Thread Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions. Also modify the mock region selftests somewhat to account for a fragmenting manager. Signed-off-by: Thomas Hellström --- v2: - Fix an error unwind in lmem_get_pages() (Reported by

[PATCH v2 02/15] drm/i915: Don't free shared locks while shared

2021-05-18 Thread Thomas Hellström
add an additional refcount, for GGTT we take additional measures to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown Signed-off-by: Thomas Hellström --- v2: Try harder to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown. --- drivers/gpu

[PATCH v2 06/15] drm/i915/ttm: Embed a ttm buffer object in the i915 gem object

2021-05-18 Thread Thomas Hellström
other backends. To make this a bit more storage efficient for the other backends, we'd have to use a pointer for the gem object which would require a lot of changes in the driver. We postpone that for later. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gem/i915_gem_object.c

[PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
From: Maarten Lankhorst This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers. Also clarify the documentation a bit, especially related to VM_FAULT_RETRY. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 4 +- drivers/

[PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
eviction_valuable path is run. Finally export ttm_tt_unpopulate() and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out. Cc: Christian König Signed-off-by: Thomas Hell

[PATCH v2 14/15] drm/i915: Use ttm mmap handling for ttm bo's.

2021-05-18 Thread Thomas Hellström
From: Maarten Lankhorst Use the ttm handlers for servicing page faults, and vm_access. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 17 ++- drivers/gpu/drm/i915/gem/i915_gem_mman.h | 2 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + dri

[PATCH v2 12/15] drm/i915: Disable mmap ioctl for gen12+

2021-05-18 Thread Thomas Hellström
From: Maarten Lankhorst The paltform should exclusively use mmap_offset, one less path to worry about for discrete. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c

[PATCH v2 10/15] drm/i915/ttm: Introduce a TTM i915 gem object backend

2021-05-18 Thread Thomas Hellström
porting of GGTT bindings to TTM. Remove the old lmem backend. Signed-off-by: Thomas Hellström --- v2: - Break out needed TTM functionality to a separate patch (Reported by Christian König). - Fix an unhandled error (Reported by Matthew Auld and Maarten Lankhorst) - Remove a stray leftover sg_table

[PATCH v2 15/15] drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn

2021-05-18 Thread Thomas Hellström
From: Maarten Lankhorst Instead of walking the sg table manually, use our caching helpers to do the sgt caching. To prevent lifetime issues of ttm_bo vs i915_gem_object, we will use a separate member, instead of re-using the dma page member. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm

[PATCH v2 11/15] drm/i915/lmem: Verify checks for lmem residency

2021-05-18 Thread Thomas Hellström
Since objects can be migrated or evicted when not pinned or locked, update the checks for lmem residency or future residency so that the value returned is not immediately stale. Signed-off-by: Thomas Hellström --- v2: Simplify i915_gem_object_migratable() (Reported by Mattew Auld) --- drivers

Re: [Intel-gfx] [PATCH v2 12/15] drm/i915: Disable mmap ioctl for gen12+

2021-05-18 Thread Thomas Hellström
On 5/18/21 10:26 AM, Thomas Hellström wrote: From: Maarten Lankhorst The paltform should exclusively use mmap_offset, one less path to worry about for discrete. s/paltform/platform/ Signed-off-by: Maarten Lankhorst Otherwise, Reviewed-by: Thomas Hellström --- drivers/gpu/drm

Re: [Intel-gfx] [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
+ Christian König On 5/18/21 10:26 AM, Thomas Hellström wrote: From: Maarten Lankhorst This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers. Also clarify the documentation a bit, especially related to VM_FAULT_RETRY. Signed-off-by: Maarten Lankhorst

Re: [Intel-gfx] [PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers

2021-05-18 Thread Thomas Hellström
On 5/18/21 11:09 AM, Matthew Auld wrote: On Tue, 18 May 2021 at 09:27, Thomas Hellström wrote: Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions. Also modify the mock region selftests somewhat to account for a fragmenting manager

Re: [Intel-gfx] [PATCH v2 14/15] drm/i915: Use ttm mmap handling for ttm bo's.

2021-05-18 Thread Thomas Hellström
On 5/18/21 10:27 AM, Thomas Hellström wrote: From: Maarten Lankhorst Use the ttm handlers for servicing page faults, and vm_access. Signed-off-by: Maarten Lankhorst LGTM. Just need to make sure we don't forget about the caching. Reviewed-by: Thomas Hellström --- drivers/gp

Re: [Intel-gfx] [PATCH v2 15/15] drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn

2021-05-18 Thread Thomas Hellström
On 5/18/21 10:27 AM, Thomas Hellström wrote: From: Maarten Lankhorst Instead of walking the sg table manually, use our caching helpers to do the sgt caching. To prevent lifetime issues of ttm_bo vs i915_gem_object, we will use a separate member, instead of re-using the dma page member

Re: [PATCH v2 01/15] drm/i915: Untangle the vma pages_mutex

2021-05-18 Thread Thomas Hellström
On 5/18/21 1:12 PM, Maarten Lankhorst wrote: Hey, This needs a small fix, otherwise looks good. Op 18-05-2021 om 10:26 schreef Thomas Hellström: From: Thomas Hellström Any sleeping dma_resv lock taken while the vma pages_mutex is held will cause a lockdep splat. Move the

Re: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem

2021-05-18 Thread Thomas Hellström
On 5/18/21 1:55 PM, Christian König wrote: Am 18.05.21 um 10:26 schrieb Thomas Hellström: The internal ttm_bo_util memcpy uses vmap functionality, and while it probably might be possible to use it for copying in- and out of sglist represented io memory, using io_mem_reserve() / io_mem_free

Re: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem

2021-05-18 Thread Thomas Hellström
On 5/18/21 2:09 PM, Christian König wrote: Am 18.05.21 um 14:04 schrieb Thomas Hellström: On 5/18/21 1:55 PM, Christian König wrote: Am 18.05.21 um 10:26 schrieb Thomas Hellström: The internal ttm_bo_util memcpy uses vmap functionality, and while it probably might be possible to use it

Re: [PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone

2021-05-18 Thread Thomas Hellström
On 5/18/21 1:51 PM, Christian König wrote: Am 18.05.21 um 10:26 schrieb Thomas Hellström: i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to

Re: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem

2021-05-18 Thread Thomas Hellström
On 5/18/21 3:08 PM, Christian König wrote: Am 18.05.21 um 14:52 schrieb Thomas Hellström: On 5/18/21 2:09 PM, Christian König wrote: Am 18.05.21 um 14:04 schrieb Thomas Hellström: On 5/18/21 1:55 PM, Christian König wrote: Am 18.05.21 um 10:26 schrieb Thomas Hellström: The internal

Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot

2021-05-18 Thread Thomas Hellström
On 5/18/21 3:24 PM, Christoph Hellwig wrote: On Tue, May 18, 2021 at 08:46:44AM +0200, Thomas Hellström wrote: And worse, if we prefault a user-space buffer object map using remap_io_sg() and then zap some ptes using madvise(), the next time those ptes are accessed, we'd trigger a new ca

Re: [Intel-gfx] [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
ed at multiple offsets and  the vma->private is not a bo... Thanks, Thomas Am 18.05.21 um 10:59 schrieb Thomas Hellström: + Christian König On 5/18/21 10:26 AM, Thomas Hellström wrote: From: Maarten Lankhorst This allows other drivers that may not setup the vma in the same way to use

Re: [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:07 PM, Christian König wrote: Am 18.05.21 um 16:55 schrieb Thomas Hellström: From: Maarten Lankhorst This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers. Uff can you please explain why exactly you need that? Providing the BO is not

Re: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
On 5/18/21 10:26 AM, Thomas Hellström wrote: We are calling the eviction_valuable driver callback at eviction time to determine whether we actually can evict a buffer object. The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other

Re: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:18 PM, Christian König wrote: Am 18.05.21 um 17:15 schrieb Thomas Hellström: On 5/18/21 10:26 AM, Thomas Hellström wrote: We are calling the eviction_valuable driver callback at eviction time to determine whether we actually can evict a buffer object. The upcoming i915 TTM

Re: [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:17 PM, Christian König wrote: Am 18.05.21 um 17:11 schrieb Thomas Hellström: On 5/18/21 5:07 PM, Christian König wrote: Am 18.05.21 um 16:55 schrieb Thomas Hellström: From: Maarten Lankhorst This allows other drivers that may not setup the vma in the same way to use the

Re: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:28 PM, Christian König wrote: Am 18.05.21 um 17:20 schrieb Thomas Hellström: On 5/18/21 5:18 PM, Christian König wrote: Am 18.05.21 um 17:15 schrieb Thomas Hellström: On 5/18/21 10:26 AM, Thomas Hellström wrote: We are calling the eviction_valuable driver callback at

Re: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:42 PM, Christian König wrote: Am 18.05.21 um 17:38 schrieb Thomas Hellström: On 5/18/21 5:28 PM, Christian König wrote: Am 18.05.21 um 17:20 schrieb Thomas Hellström: On 5/18/21 5:18 PM, Christian König wrote: Am 18.05.21 um 17:15 schrieb Thomas Hellström: On 5/18/21 10

Re: [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
On 5/18/21 5:29 PM, Christian König wrote: Am 18.05.21 um 17:25 schrieb Thomas Hellström: On 5/18/21 5:17 PM, Christian König wrote: Am 18.05.21 um 17:11 schrieb Thomas Hellström: On 5/18/21 5:07 PM, Christian König wrote: Am 18.05.21 um 16:55 schrieb Thomas Hellström: From: Maarten

Re: [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.

2021-05-18 Thread Thomas Hellström
On 5/18/21 7:17 PM, Christian König wrote: Am 18.05.21 um 19:10 schrieb Thomas Hellström: On 5/18/21 5:29 PM, Christian König wrote: Am 18.05.21 um 17:25 schrieb Thomas Hellström: On 5/18/21 5:17 PM, Christian König wrote: Am 18.05.21 um 17:11 schrieb Thomas Hellström: On 5/18/21 5

Re: [Intel-gfx] [PATCH 4/4] i915: fix remap_io_sg to verify the pgprot

2021-05-18 Thread Thomas Hellström
On 5/18/21 3:23 PM, Christoph Hellwig wrote: On Mon, May 17, 2021 at 11:46:35PM +0200, Thomas Hellström wrote: Apart from the caching aliasing Mattew brought up, doesn't the remap_pfn_range_xxx() family require the mmap_sem held in write mode since it modifies the vma structure? remap_

Re: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-18 Thread Thomas Hellström
On 5/18/21 6:30 PM, Christian König wrote: Am 18.05.21 um 18:07 schrieb Thomas Hellström: On 5/18/21 5:42 PM, Christian König wrote: Am 18.05.21 um 17:38 schrieb Thomas Hellström: On 5/18/21 5:28 PM, Christian König wrote: Am 18.05.21 um 17:20 schrieb Thomas Hellström: On 5/18/21 5:18

Re: [Intel-gfx] [PATCH v2 10/15] drm/i915/ttm: Introduce a TTM i915 gem object backend

2021-05-19 Thread Thomas Hellström
Thanks a lot for reviewing, Matthew! On 5/19/21 11:53 AM, Matthew Auld wrote: On Tue, 18 May 2021 at 09:28, Thomas Hellström wrote: Most logical place to introduce TTM buffer objects is as an i915 gem object backend. We need to add some ops to account for added functionality like delayed

[RFC PATCH 0/5] Core TTM changes for i915 TTM enabling

2021-05-20 Thread Thomas Hellström
f the i915 series. Cc: Christian König Cc: Dave Airlie Cc: Daniel Vetter Thomas Hellström (5): drm/ttm: Add a generic TTM memcpy move for page-based iomem drm, drm/i915: Move the memcpy_from_wc functionality to core drm drm/ttm: Use drm_memcpy_from_wc for TTM bo moves drm/ttm: Documen

[RFC PATCH 1/5] drm/ttm: Add a generic TTM memcpy move for page-based iomem

2021-05-20 Thread Thomas Hellström
iomap tagged pointers. Ideally we should extend the core memremap functions to also accept uncached memory and kmap_local functionality. Then we could strip a lot of code. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo_util.c

[RFC PATCH 4/5] drm/ttm: Document and optimize ttm_bo_pipeline_gutting()

2021-05-20 Thread Thomas Hellström
call to ttm_tt_create() fails. Finally reuse ttm_bo_pipeline_gutting() in ttm_bo_evict(). Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/ttm/ttm_bo.c | 20 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 63 --- drivers/gpu/drm/ttm

[RFC PATCH 5/5] drm/ttm, drm/amdgpu: Allow the driver some control over swapping

2021-05-20 Thread Thomas Hellström
eviction_valuable path is run. Finally make sure we don't try to swapout a bo that was recently purged and therefore unpopulated. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++ drivers/gpu/drm/ttm/ttm_bo.c

  1   2   3   4   5   6   7   8   9   10   >