drm/i915: Move LMEM (VRAM) management over to TTM
Subsystems (5)
Thomas Hellström
reviewercover drm/i915: Move LMEM (VRAM) management over to TTM
This is an initial patch series to move discrete memory management over to TTM. It will be followed up shortly with adding more functionality.
The buddy allocator is temporarily removed along with its selftests and It is replaced with the TTM range manager and some selftests are adjusted to account for introduced fragmentation. Work is ongoing to reintroduce the buddy allocator as a TTM resource manager.
A new memcpy ttm move is introduced that uses kmap_local() functionality rather than vmap(). Among other things stated in the patch commit message it helps us deal with page-pased LMEM memory. It is generic enough to replace the ttm memcpy move with some additional work if so desired. On x86 it also enables prefetching reads from write-combined memory.
Finally the old i915 gem object LMEM backend is replaced with a i915 gem object TTM backend and some additional i915 gem object ops are introduced to support the added functionality.
Currently it is used only to support management and eviction of the LMEM region, but work is underway to extend the support to system memory. In this way we use TTM the way it was originally intended, having the GPU binding taken care of by driver 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 device and memory managers. drm/i915/ttm: Embed a ttm buffer object in the i915 gem object drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based
iomem
drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend drm/i915/lmem: Verify checks for lmem residency
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 4 +- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 71 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 161 +++- drivers/gpu/drm/i915/gem/i915_gem_object.h | 13 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 37 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 126 +-- drivers/gpu/drm/i915/gem/i915_gem_region.h | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 9 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 534 ++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 155 ++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 141 ++++ drivers/gpu/drm/i915/gt/intel_ggtt.c | 13 +- drivers/gpu/drm/i915/gt/intel_gt.c | 2 - drivers/gpu/drm/i915/gt/intel_gtt.c | 45 +- drivers/gpu/drm/i915/gt/intel_gtt.h | 29 +- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 30 +- drivers/gpu/drm/i915/i915_buddy.c | 435 ---------- drivers/gpu/drm/i915/i915_buddy.h | 131 --- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/i915_gem.c | 6 +- drivers/gpu/drm/i915/i915_globals.c | 1 - drivers/gpu/drm/i915/i915_globals.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.c | 70 ++ drivers/gpu/drm/i915/i915_scatterlist.h | 35 + drivers/gpu/drm/i915/i915_vma.c | 33 +- drivers/gpu/drm/i915/intel_memory_region.c | 181 ++-- drivers/gpu/drm/i915/intel_memory_region.h | 45 +- drivers/gpu/drm/i915/intel_region_ttm.c | 247 ++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 32 + drivers/gpu/drm/i915/selftests/i915_buddy.c | 789 ------------------ .../drm/i915/selftests/i915_mock_selftests.h | 1 - .../drm/i915/selftests/intel_memory_region.c | 133 +-- drivers/gpu/drm/i915/selftests/mock_region.c | 51 +- drivers/gpu/drm/ttm/ttm_bo.c | 13 + drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- include/drm/ttm/ttm_bo_driver.h | 23 + include/drm/ttm/ttm_device.h | 9 + 46 files changed, 1876 insertions(+), 1879 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.h create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h delete mode 100644 drivers/gpu/drm/i915/i915_buddy.c delete mode 100644 drivers/gpu/drm/i915/i915_buddy.h create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.c create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.h delete mode 100644 drivers/gpu/drm/i915/selftests/i915_buddy.c
Signature · 6 lines
2.30.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH 1/7 drm/i915: Untangle the vma pages_mutex
From: Thomas Hellström <[email protected]>
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.
--- drivers/gpu/drm/i915/i915_vma.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_vma.c +19 -14
@@ -800,32 +800,37 @@ static bool try_qad_pin(struct i915_vma *vma, unsigned int flags)static int vma_get_pages (struct i915_vma *vma) {int err =0 ; +bool pinned_pages = false;if (atomic_add_unless (&vma->pages_count,1 ,0 ))return 0 ; +if (vma->obj) { + err =i915_gem_object_pin_pages (vma->obj); +if (err) +return err; + pinned_pages = true; + } +/* Allocations ahoy! */ -if (mutex_lock_interruptible (&vma->pages_mutex)) -return -EINTR ; +if (mutex_lock_interruptible (&vma->pages_mutex)) { + err = -EINTR ; + goto unpin; + }if (!atomic_read (&vma->pages_count)) { -if (vma->obj) { - err =i915_gem_object_pin_pages (vma->obj); -if (err) - goto unlock; - } - err = vma->ops->set_pages (vma); -if (err) { -if (vma->obj) -i915_gem_object_unpin_pages (vma->obj); +if (err) goto unlock; - } + pinned_pages = false; }atomic_inc (&vma->pages_count); unlock:mutex_unlock (&vma->pages_mutex); +unpin: +if (pinned_pages) +__i915_gem_object_unpin_pages (vma->obj);return err; }
@@ -838,10 +843,10 @@ static void __vma_put_pages(struct i915_vma *vma, unsigned int count)if (atomic_sub_return (count, &vma->pages_count) ==0 ) { vma->ops->clear_pages (vma);GEM_BUG_ON (vma->pages); -if (vma->obj) -i915_gem_object_unpin_pages (vma->obj); }mutex_unlock (&vma->pages_mutex); +if (vma->obj) +i915_gem_object_unpin_pages (vma->obj); }static void vma_put_pages (struct i915_vma *vma)
Signature · 6 lines
2.30.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH 2/7 drm/i915: Don't free shared locks while shared
In reply to Thomas HellströmWe are currently sharing the VM reservation locks across a number of gem objects with page-table memory. Since TTM will individiualize the reservation locks when freeing objects, including accessing the shared locks, make sure that the shared locks are not freed until that is done. For PPGTT we add an additional refcount, for GGTT we flush the object freeing workqueue before freeing the shared lock.
--- 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 | 13 ++++-- drivers/gpu/drm/i915/gt/intel_gtt.c | 45 +++++++++++++++---- drivers/gpu/drm/i915/gt/intel_gtt.h | 29 +++++++++++- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- 6 files changed, 80 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +3 -0
@@ -252,6 +252,9 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,if (obj->mm.n_placements >1 )kfree (obj->mm.placements); +if (obj->resv_shared_from) +i915_vm_resv_put (obj->resv_shared_from); +/* But keep the pointer alive for RCU-protected lookups */ call_rcu (&obj->rcu, __i915_gem_free_object_rcu);cond_resched ();
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
@@ -149,6 +149,7 @@ struct drm_i915_gem_object {* when i915_gem_ww_ctx_backoff() or i915_gem_ww_ctx_fini() are called. */ struct list_head obj_link; +struct dma_resv *resv_shared_from;union {struct rcu_head rcu;
drivers/gpu/drm/i915/gt/intel_ggtt.c +10 -3
@@ -746,7 +746,13 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)mutex_unlock (&ggtt->vm.mutex);i915_address_space_fini (&ggtt->vm); -dma_resv_fini (&ggtt->vm.resv); +/* +* Make sure our pagetable gem objects have been freed, +* so that nobody shares our reservation object anymore. +*/ +i915_gem_flush_free_objects (ggtt->vm.i915); +GEM_WARN_ON (kref_read (&ggtt->vm.resv_ref) !=1 ); +dma_resv_fini (&ggtt->vm._resv);arch_phys_wc_del (ggtt->mtrr);
@@ -829,6 +835,7 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size)return -ENOMEM ; } +kref_init (&ggtt->vm.resv_ref); ret =setup_scratch_page (&ggtt->vm);if (ret) {drm_err (&i915->drm,"Scratch setup failed\n" );
@@ -1135,7 +1142,7 @@ static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt) ggtt->vm.gt = gt; ggtt->vm.i915 = i915; ggtt->vm.dma = i915->drm.dev; -dma_resv_init (&ggtt->vm.resv); +dma_resv_init (&ggtt->vm._resv);if (INTEL_GEN (i915) <=5 ) ret =i915_gmch_probe (ggtt);
@@ -1144,7 +1151,7 @@ static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)else ret =gen8_gmch_probe (ggtt);if (ret) { -dma_resv_fini (&ggtt->vm.resv); +dma_resv_fini (&ggtt->vm._resv);return ret; }
drivers/gpu/drm/i915/gt/intel_gtt.c +37 -8
88 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gtt.h +28 -1
@@ -245,7 +245,9 @@ struct i915_address_space {atomic_t open;struct mutex mutex;/* protects vma and our lists */ -struct dma_resv resv;/* reservation lock for all pd objects, and buffer pool */ + +struct kref resv_ref;/* kref to keep the reservation lock alive. */ +struct dma_resv _resv;/* reservation lock for all pd objects, and buffer pool */ #define VM_CLASS_GGTT 0#define VM_CLASS_PPGTT 1#define VM_CLASS_DPT 2
@@ -404,13 +406,38 @@ i915_vm_get(struct i915_address_space *vm)return vm; } +/** +* i915_vm_resv_get - Obtain a reference on the vm's reservation lock +* @vm: The vm whose reservation lock we want to share. +* +* Return: A pointer to the vm's reservation lock. +*/ +static inline struct dma_resv *i915_vm_resv_get (struct i915_address_space *vm) +{ +kref_get (&vm->resv_ref); +return &vm->_resv; +} +void i915_vm_release (struct kref *kref); +void i915_vm_resv_release (struct kref *kref); +static inline void i915_vm_put (struct i915_address_space *vm) {kref_put (&vm->ref, i915_vm_release); } +/** +* i915_vm_resv_put - Release a reference on the vm's reservation lock +* @resv: Pointer to a reservation lock obtained from i915_vm_resv_get() +*/ +static inline void i915_vm_resv_put (struct dma_resv *resv) +{ +struct i915_address_space *vm =container_of (resv,typeof (*vm), _resv); + +kref_put (&vm->resv_ref, i915_vm_resv_release); +} +static inline struct i915_address_space *i915_vm_open (struct i915_address_space *vm) {
drivers/gpu/drm/i915/gt/intel_ppgtt.c +1 -1
@@ -307,7 +307,7 @@ void ppgtt_init(struct i915_ppgtt *ppgtt, struct intel_gt *gt) ppgtt->vm.dma = i915->drm.dev; ppgtt->vm.total =BIT_ULL (INTEL_INFO (i915)->ppgtt_size); -dma_resv_init (&ppgtt->vm.resv); +dma_resv_init (&ppgtt->vm._resv);i915_address_space_init (&ppgtt->vm,VM_CLASS_PPGTT ); ppgtt->vm.vma_ops.bind_vma = ppgtt_bind_vma;
Signature · 1 line
2.30.2
Thomas Hellström
reviewerPATCH 4/7 drm/i915/ttm: Embed a ttm buffer object in the i915 gem object
In reply to Thomas HellströmEmbed a struct ttm_buffer_object into the i915 gem object, making sure we alias the gem object part. It's a bit unfortunate that the struct ttm_buffer_ojbect embeds a gem object since we otherwise could make the TTM part private to the TTM backend, and use the usual i915 gem object for the 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.
--- drivers/gpu/drm/i915/gem/i915_gem_object.c | 7 +++++++ drivers/gpu/drm/i915/gem/i915_gem_object_types.h | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +7 -0
@@ -62,6 +62,13 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,const struct drm_i915_gem_object_ops *ops, struct lock_class_key *key, unsigned flags) { +/* +* A gem object is embedded both in a struct ttm_buffer_object :/ and +* in a drm_i915_gem_object. Make sure they are aliased. +*/ + BUILD_BUG_ON(offsetof(typeof(*obj), base) != + offsetof(typeof(*obj), __do_not_access.base)); +spin_lock_init (&obj->vma.lock);INIT_LIST_HEAD (&obj->vma.list);
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +11 -1
@@ -10,6 +10,7 @@#include <linux/mmu_notifier.h> #include <drm/drm_gem.h> +#include <drm/ttm/ttm_bo_api.h> #include <uapi/drm/i915_drm.h> #include "i915_active.h"
@@ -99,7 +100,16 @@ struct i915_gem_object_page_iter { };struct drm_i915_gem_object { -struct drm_gem_object base; +/* +* We might have reason to revisit the below since it wastes +* a lot of space for non-ttm gem objects. +* In any case, always use the accessors for the ttm_buffer_object +* when accessing it. +*/ +union { +struct drm_gem_object base; +struct ttm_buffer_object __do_not_access; + };const struct drm_i915_gem_object_ops *ops;
Signature · 1 line
2.30.2
Thomas Hellström
reviewerPATCH 3/7 drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.
In reply to Thomas HellströmTemporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
In order to support some of the mock region-related selftests, we need to be able to initialize the TTM range-manager standalone without a struct ttm_device. Add two functions to allow that to the TTM api.
Finally modify the mock region selftests somewhat to account for a fragmenting manager.
--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 58 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 6 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 120 --- drivers/gpu/drm/i915/gem/i915_gem_region.h | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 9 +- drivers/gpu/drm/i915/gt/intel_gt.c | 2 - drivers/gpu/drm/i915/gt/intel_region_lmem.c | 27 +- drivers/gpu/drm/i915/i915_buddy.c | 435 ---------- drivers/gpu/drm/i915/i915_buddy.h | 131 --- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_globals.c | 1 - drivers/gpu/drm/i915/i915_globals.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.c | 70 ++ drivers/gpu/drm/i915/i915_scatterlist.h | 35 + drivers/gpu/drm/i915/intel_memory_region.c | 180 ++-- drivers/gpu/drm/i915/intel_memory_region.h | 44 +- drivers/gpu/drm/i915/intel_region_ttm.c | 246 ++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 29 + drivers/gpu/drm/i915/selftests/i915_buddy.c | 789 ------------------ .../drm/i915/selftests/i915_mock_selftests.h | 1 - .../drm/i915/selftests/intel_memory_region.c | 133 +-- drivers/gpu/drm/i915/selftests/mock_region.c | 51 +- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- include/drm/ttm/ttm_bo_driver.h | 23 + 31 files changed, 715 insertions(+), 1771 deletions(-) delete mode 100644 drivers/gpu/drm/i915/i915_buddy.c delete mode 100644 drivers/gpu/drm/i915/i915_buddy.h create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.c create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.h delete mode 100644 drivers/gpu/drm/i915/selftests/i915_buddy.c
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -26,6 +26,7 @@ config DRM_I915 select SND_HDA_I915 if SND_HDA_CORE select CEC_CORE if CEC_NOTIFIER select VMAP_PFN + select DRM_TTM help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
drivers/gpu/drm/i915/Makefile +1 -1
@@ -50,6 +50,7 @@ i915-y += i915_drv.o \ intel_memory_region.o \ intel_pch.o \ intel_pm.o \ + intel_region_ttm.o \ intel_runtime_pm.o \ intel_sideband.o \ intel_step.o \
@@ -160,7 +161,6 @@ gem-y += \ i915-y += \ $(gem-y) \ i915_active.o \ - i915_buddy.o \ i915_cmd_parser.o \ i915_gem_evict.o \ i915_gem_gtt.o \
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +56 -2
72 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +4 -2
@@ -232,10 +232,12 @@ struct drm_i915_gem_object {* Memory region for this object. */ struct intel_memory_region *region; +/** -* List of memory region blocks allocated for this object. +* Memory manager node allocated for this object. */ -struct list_head blocks; +void *st_mm_node; +/** * Element within memory_region->objects or region->purgeable * if the object is marked as DONTNEED. Access is protected by
drivers/gpu/drm/i915/gem/i915_gem_pages.c +2 -1
@@ -473,7 +473,8 @@ __i915_gem_object_get_sg(struct drm_i915_gem_object *obj,might_sleep ();GEM_BUG_ON (n >= obj->base.size >>PAGE_SHIFT ); -GEM_BUG_ON (!i915_gem_object_has_pinned_pages (obj)); +if (!i915_gem_object_has_pinned_pages (obj)) +assert_object_held (obj);/* As we iterate forward through the sg, we record each entry in a * radixtree for quick repeated (backwards) lookups. If we have seen
drivers/gpu/drm/i915/gem/i915_gem_region.c +0 -120
129 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_region.h +0 -4
@@ -12,10 +12,6 @@ struct intel_memory_region;struct drm_i915_gem_object ;struct sg_table ; -int i915_gem_object_get_pages_buddy (struct drm_i915_gem_object *obj); -void i915_gem_object_put_pages_buddy (struct drm_i915_gem_object *obj, -struct sg_table *pages); -void i915_gem_object_init_memory_region (struct drm_i915_gem_object *obj,struct intel_memory_region *mem);void i915_gem_object_release_memory_region (struct drm_i915_gem_object *obj);
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +3 -1
@@ -628,11 +628,13 @@ static const struct intel_memory_region_ops shmem_region_ops = { .init_object = shmem_object_init, }; -struct intel_memory_region *i915_gem_shmem_setup (struct drm_i915_private *i915) +struct intel_memory_region *i915_gem_shmem_setup (struct drm_i915_private *i915, +u16 type,u16 instance) {return intel_memory_region_create (i915,0 ,totalram_pages () <<PAGE_SHIFT ,PAGE_SIZE ,0 , + type, instance, &shmem_region_ops); }
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +6 -4
@@ -770,7 +770,8 @@ static const struct intel_memory_region_ops i915_region_stolen_lmem_ops = { };struct intel_memory_region * -i915_gem_stolen_lmem_setup (struct drm_i915_private *i915) +i915_gem_stolen_lmem_setup (struct drm_i915_private *i915,u16 type, +u16 instance) {struct intel_uncore *uncore = &i915->uncore;struct pci_dev *pdev =to_pci_dev (i915->drm.dev);
@@ -788,6 +789,7 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915) mem =intel_memory_region_create (i915, lmem_base, lmem_size,I915_GTT_PAGE_SIZE_4K , io_start, + type, instance, &i915_region_stolen_lmem_ops);if (IS_ERR (mem))return mem;
@@ -809,14 +811,15 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915) }struct intel_memory_region * -i915_gem_stolen_smem_setup (struct drm_i915_private *i915) +i915_gem_stolen_smem_setup (struct drm_i915_private *i915,u16 type, +u16 instance) {struct intel_memory_region *mem; mem =intel_memory_region_create (i915, intel_graphics_stolen_res.start,resource_size (&intel_graphics_stolen_res), -PAGE_SIZE ,0 , +PAGE_SIZE ,0 , type, instance, &i915_region_stolen_smem_ops);if (IS_ERR (mem))return mem;
@@ -824,7 +827,6 @@ i915_gem_stolen_smem_setup(struct drm_i915_private *i915)intel_memory_region_set_name (mem,"stolen-system" ); mem->private = true; -return mem; }
drivers/gpu/drm/i915/gem/i915_gem_stolen.h +7 -2
@@ -21,8 +21,13 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv, u64 end);void i915_gem_stolen_remove_node (struct drm_i915_private *dev_priv,struct drm_mm_node *node); -struct intel_memory_region *i915_gem_stolen_smem_setup (struct drm_i915_private *i915); -struct intel_memory_region *i915_gem_stolen_lmem_setup (struct drm_i915_private *i915); +struct intel_memory_region * +i915_gem_stolen_smem_setup (struct drm_i915_private *i915,u16 type, +u16 instance); +struct intel_memory_region * +i915_gem_stolen_lmem_setup (struct drm_i915_private *i915,u16 type, +u16 instance); +struct drm_i915_gem_object *i915_gem_object_create_stolen (struct drm_i915_private *dev_priv,resource_size_t size);
drivers/gpu/drm/i915/gt/intel_gt.c +0 -2
@@ -68,8 +68,6 @@ int intel_gt_probe_lmem(struct intel_gt *gt) id =INTEL_REGION_LMEM ; mem->id = id; - mem->type =INTEL_MEMORY_LOCAL ; - mem->instance =0 ;intel_memory_region_set_name (mem,"local%u" , mem->instance);
drivers/gpu/drm/i915/gt/intel_region_lmem.c +21 -6
@@ -5,6 +5,8 @@#include "i915_drv.h" #include "intel_memory_region.h" +#include "intel_region_lmem.h" +#include "intel_region_ttm.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" #include "intel_region_lmem.h"
@@ -66,9 +68,9 @@ static void release_fake_lmem_bar(struct intel_memory_region *mem)static void region_lmem_release (struct intel_memory_region *mem) { -release_fake_lmem_bar (mem); +intel_region_ttm_fini (mem);io_mapping_fini (&mem->iomap); -intel_memory_region_release_buddy (mem); +release_fake_lmem_bar (mem); } static int
@@ -83,12 +85,21 @@ region_lmem_init(struct intel_memory_region *mem)if (!io_mapping_init_wc (&mem->iomap, mem->io_start, -resource_size (&mem->region))) -return -EIO ; +resource_size (&mem->region))) { + ret = -EIO ; + goto out_no_io; + } - ret =intel_memory_region_init_buddy (mem); + ret =intel_region_ttm_init (mem);if (ret) -io_mapping_fini (&mem->iomap); + goto out_no_buddy; + +return 0 ; + +out_no_buddy: +io_mapping_fini (&mem->iomap); +out_no_io: +release_fake_lmem_bar (mem);return ret; }
@@ -127,6 +138,8 @@ intel_gt_setup_fake_lmem(struct intel_gt *gt) mappable_end,PAGE_SIZE , io_start, +INTEL_MEMORY_LOCAL , +0 , &intel_region_lmem_ops);if (!IS_ERR (mem)) { drm_info(&i915->drm, "Intel graphics fake LMEM: %pR\n",
@@ -198,6 +211,8 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) lmem_size,I915_GTT_PAGE_SIZE_4K , io_start, +INTEL_MEMORY_LOCAL , +0 , &intel_region_lmem_ops);if (IS_ERR (mem))return mem;
drivers/gpu/drm/i915/i915_buddy.c deleted +0 -435
435 lines not on this page · raw message
drivers/gpu/drm/i915/i915_buddy.h deleted +0 -131
131 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drv.c +8 -0
@@ -84,6 +84,7 @@#include "intel_gvt.h" #include "intel_memory_region.h" #include "intel_pm.h" +#include "intel_region_ttm.h" #include "intel_sideband.h" #include "vlv_suspend.h"
@@ -335,6 +336,10 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)if (ret <0 ) goto err_workqueues; + ret =intel_region_ttm_device_init (dev_priv); +if (ret) + goto err_ttm; +intel_wopcm_init_early (&dev_priv->wopcm);intel_gt_init_early (&dev_priv->gt, dev_priv);
@@ -359,6 +364,8 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv) err_gem:i915_gem_cleanup_early (dev_priv);intel_gt_driver_late_release (&dev_priv->gt); +intel_region_ttm_device_fini (dev_priv); +err_ttm:vlv_suspend_cleanup (dev_priv); err_workqueues:i915_workqueues_cleanup (dev_priv);
@@ -376,6 +383,7 @@ static void i915_driver_late_release(struct drm_i915_private *dev_priv)intel_power_domains_cleanup (dev_priv);i915_gem_cleanup_early (dev_priv);intel_gt_driver_late_release (&dev_priv->gt); +intel_region_ttm_device_fini (dev_priv);vlv_suspend_cleanup (dev_priv);i915_workqueues_cleanup (dev_priv);
drivers/gpu/drm/i915/i915_drv.h +6 -1
@@ -60,6 +60,7 @@#include <drm/drm_atomic.h> #include <drm/drm_connector.h> #include <drm/i915_mei_hdcp_interface.h> +#include <drm/ttm/ttm_device.h> #include "i915_params.h" #include "i915_reg.h"
@@ -1166,6 +1167,9 @@ struct drm_i915_private {/* Mutex to protect the above hdcp component related values. */ struct mutex hdcp_comp_mutex; +/* The TTM device structure. */ +struct ttm_device bdev; + I915_SELFTEST_DECLARE(struct i915_selftest_stash selftest;)/*
@@ -1751,7 +1755,8 @@ void i915_gem_cleanup_userptr(struct drm_i915_private *dev_priv);void i915_gem_init_early (struct drm_i915_private *dev_priv);void i915_gem_cleanup_early (struct drm_i915_private *dev_priv); -struct intel_memory_region *i915_gem_shmem_setup (struct drm_i915_private *i915); +struct intel_memory_region *i915_gem_shmem_setup (struct drm_i915_private *i915, +u16 type,u16 instance);static inline void i915_gem_drain_freed_objects (struct drm_i915_private *i915) {
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -1109,6 +1109,7 @@ int i915_gem_init(struct drm_i915_private *dev_priv) }i915_gem_drain_freed_objects (dev_priv); +return ret; }
drivers/gpu/drm/i915/i915_globals.c +0 -1
@@ -87,7 +87,6 @@ static void __i915_globals_cleanup(void)static __initconst int (*const initfn[])(void ) = { i915_global_active_init, - i915_global_buddy_init, i915_global_context_init, i915_global_gem_context_init, i915_global_objects_init,
drivers/gpu/drm/i915/i915_globals.h +0 -1
@@ -27,7 +27,6 @@ void i915_globals_exit(void);/* constructors */ int i915_global_active_init (void ); -int i915_global_buddy_init (void );int i915_global_context_init (void );int i915_global_gem_context_init (void );int i915_global_objects_init (void );
drivers/gpu/drm/i915/i915_scatterlist.c +70 -0
82 lines not on this page · raw message
drivers/gpu/drm/i915/i915_scatterlist.h +35 -0
@@ -13,6 +13,8 @@#include "i915_gem.h" +struct drm_mm_node ; +/* * Optimised SGL iterator for GEM objects */
@@ -133,4 +135,37 @@ static inline unsigned int i915_sg_segment_size(void)bool i915_sg_trim (struct sg_table *orig_st); +/** +* i915_sg_dma_page_sizes - Calculate page sizes from a scatterlist +* @sg: The scatterlist from which to calculate page sizes +* +* Return: a value with bits sets for relevant page sizes. +*/ +static inline unsigned int i915_sg_dma_page_sizes (struct scatterlist *sg) +{ +unsigned int page_sizes; + + page_sizes =0 ; +while (sg) { +GEM_BUG_ON (sg->offset); +GEM_BUG_ON (!IS_ALIGNED (sg->dma_length,PAGE_SIZE )); + page_sizes |= sg->dma_length; + sg =__sg_next (sg); + } + +/* +* Is this necessary to support building large GPU pages from +* even larger segments? +*/ + +if (page_sizes >SZ_64K ) + page_sizes |=SZ_64K ; +if (page_sizes >SZ_2M ) + page_sizes |=SZ_2M ; + +return page_sizes; +} + +struct sg_table *i915_sg_from_mm_node (const struct drm_mm_node *node, +u64 region_start);#endif
drivers/gpu/drm/i915/intel_memory_region.c +51 -129
245 lines not on this page · raw message
drivers/gpu/drm/i915/intel_memory_region.h +23 -21
94 lines not on this page · raw message
drivers/gpu/drm/i915/intel_region_ttm.c new file +246 -0
246 lines not on this page · raw message
drivers/gpu/drm/i915/intel_region_ttm.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ +#ifndef _INTEL_REGION_TTM_H_ +#define _INTEL_REGION_TTM_H_ + +#include <linux/types.h> + +struct drm_i915_private ; +struct intel_memory_region ; + +int intel_region_ttm_device_init (struct drm_i915_private *dev_priv); + +void intel_region_ttm_device_fini (struct drm_i915_private *dev_priv); + +int intel_region_ttm_init (struct intel_memory_region *mem); + +void intel_region_ttm_fini (struct intel_memory_region *mem); + +struct sg_table *intel_region_ttm_node_to_st (struct intel_memory_region *mem, +void *node); + +void *intel_region_ttm_node_alloc (struct intel_memory_region *mem, +resource_size_t size, +unsigned int flags); +void intel_region_ttm_node_free (struct intel_memory_region *mem, +void *node); +#endif /* _INTEL_REGION_TTM_H_ */
drivers/gpu/drm/i915/selftests/i915_buddy.c deleted +0 -789
789 lines not on this page · raw message
drivers/gpu/drm/i915/selftests/i915_mock_selftests.h +0 -1
@@ -33,5 +33,4 @@ selftest(evict, i915_gem_evict_mock_selftests) selftest(gtt, i915_gem_gtt_mock_selftests) selftest(hugepages, i915_gem_huge_page_mock_selftests) selftest(contexts, i915_gem_context_mock_selftests) -selftest(buddy, i915_buddy_mock_selftests)selftest (memory_region, intel_memory_region_mock_selftests)
drivers/gpu/drm/i915/selftests/intel_memory_region.c +40 -93
213 lines not on this page · raw message
drivers/gpu/drm/i915/selftests/mock_region.c +44 -7
81 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_range_manager.c +38 -17
93 lines not on this page · raw message
include/drm/ttm/ttm_bo_driver.h +23 -0
@@ -321,6 +321,20 @@ int ttm_range_man_init(struct ttm_device *bdev, unsigned type, bool use_tt, unsigned long p_size); +/** +* ttm_range_man_init_standalone - Initialize a ttm range manager without +* device interaction. +* @size: Size of the area to be managed in pages. +* @use_tt: The memory type requires tt backing. +* +* This function is intended for selftests. It initializes a range manager +* without any device interaction. +* +* Return: pointer to a range manager on success. Error pointer on failure. +*/ +struct ttm_resource_manager * +ttm_range_man_init_standalone (unsigned long size,bool use_tt); +/** * ttm_range_man_fini *
@@ -332,4 +346,13 @@ int ttm_range_man_init(struct ttm_device *bdev,int ttm_range_man_fini (struct ttm_device *bdev,unsigned type); +/** +* ttm_range_man_fini_standalone +* @man: The range manager +* +* Tear down a range manager initialized with +* ttm_range_manager_init_standalone(). +*/ +void ttm_range_man_fini_standalone (struct ttm_resource_manager *man); +#endif
Signature · 1 line
2.30.2
Thomas Hellström
reviewerPATCH 5/7 drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem
In reply to Thomas HellströmThe 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() callbacks, that would cause problems with fault().
Instead, implement a method mapping page-by-page using kmap_local() semantics. As an additional benefit we then avoid the occasional global TLB flushes of vmap() and consuming vmap space, elimination of a critical point of failure and with a slight change of semantics we could also push the memcpy out async for testing and async driver develpment purposes. Pushing out async can be done since there is no memory allocation going on that could violate the dma_fence lockdep rules.
Note that drivers that don't want to use struct io_mapping but relies on memremap functionality, and that don't want to use scatterlists for VRAM may well define specialized (hopefully reusable) iterators for their particular environment.
--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 155 ++++++++++++++++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 141 ++++++++++++++++ drivers/gpu/drm/ttm/ttm_bo.c | 1 + 4 files changed, 298 insertions(+) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \ gem/i915_gemfs.o
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c new file +155 -0
155 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +141 -0
141 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_bo.c +1 -0
@@ -1221,3 +1221,4 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)ttm_tt_destroy (bo->bdev, bo->ttm); bo->ttm =NULL ; } +EXPORT_SYMBOL (ttm_bo_tt_destroy);
Signature · 1 line
2.30.2
Thomas Hellström
reviewerPATCH 6/7 drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
In reply to Thomas HellströmMost 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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy TTM_TT memory type. We reserve that for future porting of GGTT bindings to TTM.
There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 83 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 126 +++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 9 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 18 + drivers/gpu/drm/i915/gem/i915_gem_region.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 534 ++++++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ drivers/gpu/drm/i915/gt/intel_region_lmem.c | 3 +- drivers/gpu/drm/i915/i915_gem.c | 5 +- drivers/gpu/drm/i915/intel_memory_region.c | 1 - drivers/gpu/drm/i915/intel_memory_region.h | 1 - drivers/gpu/drm/i915/intel_region_ttm.c | 5 +- drivers/gpu/drm/i915/intel_region_ttm.h | 7 +- drivers/gpu/drm/ttm/ttm_bo.c | 12 + include/drm/ttm/ttm_device.h | 9 + 17 files changed, 733 insertions(+), 140 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm.o \ gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0 -83
96 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_lmem.h +0 -5
@@ -26,9 +26,4 @@ i915_gem_object_create_lmem(struct drm_i915_private *i915,resource_size_t size, unsigned int flags); -int __i915_gem_lmem_object_init (struct intel_memory_region *mem, -struct drm_i915_gem_object *obj, -resource_size_t size, -unsigned int flags); -#endif /* !__I915_GEM_LMEM_H */
drivers/gpu/drm/i915/gem/i915_gem_object.c +87 -39
165 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_object.h +9 -0
@@ -200,6 +200,9 @@ static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj)static inline void i915_gem_object_unlock (struct drm_i915_gem_object *obj) { +if (obj->ops->adjust_lru) + obj->ops->adjust_lru (obj); +dma_resv_unlock (obj->base.resv); }
@@ -587,6 +590,12 @@ int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset,bool i915_gem_object_is_shmem (const struct drm_i915_gem_object *obj); +void __i915_gem_free_object_rcu (struct rcu_head *head); + +void __i915_gem_free_object (struct drm_i915_gem_object *obj); + +bool i915_gem_object_evictable (struct drm_i915_gem_object *obj); +#ifdef CONFIG_MMU_NOTIFIER static inline bool i915_gem_object_is_userptr (struct drm_i915_gem_object *obj)
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +18 -0
@@ -63,6 +63,20 @@ struct drm_i915_gem_object_ops { const struct drm_i915_gem_pwrite *arg);int (*dmabuf_export)(struct drm_i915_gem_object *obj); + +/** +* adjust_lru - notify that the madvise value was updated +* @obj: The gem object +* +* The madvise value may have been updated, or object was recently +* referenced so act accordingly (Perhaps changing an LRU list etc). +*/ +void (*adjust_lru)(struct drm_i915_gem_object *obj); + +/** +* delayed_free - Override the default delayed free implementation +*/ +void (*delayed_free)(struct drm_i915_gem_object *obj);void (*release)(struct drm_i915_gem_object *obj);const char *name;/* friendly name for debug, e.g. lockdep classes */
@@ -307,6 +321,10 @@ struct drm_i915_gem_object { bool dirty:1; } mm; +struct { +struct sg_table *cached_io_st; + } ttm; +/** Record of address bit 17 of each page at last unbind. */ unsigned long *bit_17;
drivers/gpu/drm/i915/gem/i915_gem_region.c +1 -5
@@ -18,11 +18,7 @@ void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,mutex_lock (&mem->objects.lock); -if (obj->flags &I915_BO_ALLOC_VOLATILE ) -list_add (&obj->mm.region_link, &mem->objects.purgeable); -else -list_add (&obj->mm.region_link, &mem->objects.list); - +list_add (&obj->mm.region_link, &mem->objects.list);mutex_unlock (&mem->objects.lock); }
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +534 -0
534 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_ttm.h new file +48 -0
48 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_region_lmem.c +2 -1
@@ -9,6 +9,7 @@#include "intel_region_ttm.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" +#include "gem/i915_gem_ttm.h" #include "intel_region_lmem.h" static int init_fake_lmem_bar (struct intel_memory_region *mem)
@@ -107,7 +108,7 @@ region_lmem_init(struct intel_memory_region *mem)static const struct intel_memory_region_ops intel_region_lmem_ops = { .init = region_lmem_init, .release = region_lmem_release, - .init_object = __i915_gem_lmem_object_init, + .init_object = __i915_gem_ttm_object_init, }; struct intel_memory_region *
drivers/gpu/drm/i915/i915_gem.c +4 -1
@@ -1005,8 +1005,11 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data, } } -if (obj->mm.madv != __I915_MADV_PURGED) +if (obj->mm.madv != __I915_MADV_PURGED) { obj->mm.madv = args->madv; +if (obj->ops->adjust_lru) + obj->ops->adjust_lru (obj); + }if (i915_gem_object_has_pages (obj)) {struct list_head *list;
drivers/gpu/drm/i915/intel_memory_region.c +0 -1
@@ -149,7 +149,6 @@ intel_memory_region_create(struct drm_i915_private *i915,mutex_init (&mem->objects.lock);INIT_LIST_HEAD (&mem->objects.list); -INIT_LIST_HEAD (&mem->objects.purgeable);INIT_LIST_HEAD (&mem->reserved);mutex_init (&mem->mm_lock);
drivers/gpu/drm/i915/intel_memory_region.h +0 -1
@@ -100,7 +100,6 @@ struct intel_memory_region {struct {struct mutex lock;/* Protects access to objects */ struct list_head list; -struct list_head purgeable; } objects;size_t chunk_size;
drivers/gpu/drm/i915/intel_region_ttm.c +3 -2
@@ -10,8 +10,7 @@#include "intel_region_ttm.h" -/* A Zero-initialized driver for now. We don't have a TTM backend yet. */ -static struct ttm_device_funcs i915_ttm_bo_driver; +extern struct ttm_device_funcs i915_ttm_bo_driver;/** * DOC: TTM support structure
@@ -198,6 +197,7 @@ struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem,return i915_sg_from_mm_node (node, mem->region.start); } +#ifdef CONFIG_DRM_I915_SELFTEST /** * intel_region_ttm_node_alloc - Allocate memory resources from a region * @mem: The memory region,
@@ -244,3 +244,4 @@ void *intel_region_ttm_node_alloc(struct intel_memory_region *mem, ret = -ENXIO ; return ret ? ERR_PTR(ret) : res.mm_node; } +#endif
drivers/gpu/drm/i915/intel_region_ttm.h +5 -2
@@ -21,9 +21,12 @@ void intel_region_ttm_fini(struct intel_memory_region *mem);struct sg_table *intel_region_ttm_node_to_st (struct intel_memory_region *mem,void *node); +void intel_region_ttm_node_free (struct intel_memory_region *mem, +void *node); + +#ifdef CONFIG_DRM_I915_SELFTEST void *intel_region_ttm_node_alloc (struct intel_memory_region *mem,resource_size_t size,unsigned int flags); -void intel_region_ttm_node_free (struct intel_memory_region *mem, -void *node); +#endif #endif /* _INTEL_REGION_TTM_H_ */
drivers/gpu/drm/ttm/ttm_bo.c +12 -0
@@ -1150,6 +1150,14 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,return -EBUSY ; } +if (bo->bdev->funcs->swap_possible) { +if (!bo->bdev->funcs->swap_possible (bo)) { +if (locked) +dma_resv_unlock (bo->base.resv); +return -EBUSY ; + } + } +if (bo->deleted) {ttm_bo_cleanup_refs (bo, false, false, locked);ttm_bo_put (bo);
@@ -1200,6 +1208,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,if (bo->bdev->funcs->swap_notify) bo->bdev->funcs->swap_notify (bo); +/* The call to swap_notify may have purged the bo */ +if (!bo->ttm) + goto out; + ret =ttm_tt_swapout (bo->bdev, bo->ttm, gfp_flags); out:
include/drm/ttm/ttm_device.h +9 -0
@@ -181,6 +181,15 @@ struct ttm_device_funcs {*/ void (*delete_mem_notify)(struct ttm_buffer_object *bo); +/** +* struct ttm_bo_driver member swap_possible +* +* @bo: the buffer object to be evicted +* +* Check with the driver if it is possible to swap out a BO. +*/ +bool (*swap_possible)(struct ttm_buffer_object *bo); +/** * notify the driver that we're about to swap out this bo */
Signature · 6 lines
2.30.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH 7/7 drm/i915/lmem: Verify checks for lmem residency
In reply to Thomas HellströmSince 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.
--- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 42 +++++++++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_object.c | 29 ++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++ 4 files changed, 75 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
@@ -11615,7 +11615,7 @@ intel_user_framebuffer_create(struct drm_device *dev,/* object is backed with LMEM for discrete */ i915 =to_i915 (obj->base.dev); -if (HAS_LMEM (i915) && !i915_gem_object_is_lmem (obj)) { +if (HAS_LMEM (i915) && !i915_gem_object_validates_to_lmem (obj)) {/* object is "remote", not in local memory */ i915_gem_object_put (obj);return ERR_PTR (-EREMOTE );
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +41 -1
51 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_object.c +29 -0
@@ -458,6 +458,35 @@ bool i915_gem_object_evictable(struct drm_i915_gem_object *obj)return pin_count ==0 ; } +/** +* i915_gem_object_migratable - Whether the object is migratable out of the +* current region. +* @obj: Pointer to the object. +* +* Return: Whether the object is allowed to be resident in other +* regions than the current while pages are present. +*/ +bool i915_gem_object_migratable (struct drm_i915_gem_object *obj) +{ +struct intel_memory_region *mr =READ_ONCE (obj->mm.region); +struct intel_memory_region *placement; +int i; + +if (!mr) +return false; + +if (!obj->mm.n_placements) +return false; + +for (i =0 ; i < obj->mm.n_placements; ++i) { + placement = obj->mm.placements[i]; +if (placement != mr) +return true; + } + +return false; +} +void i915_gem_init__objects (struct drm_i915_private *i915) {INIT_WORK (&i915->mm.free_work, __i915_gem_free_work);
drivers/gpu/drm/i915/gem/i915_gem_object.h +4 -0
@@ -596,6 +596,10 @@ void __i915_gem_free_object(struct drm_i915_gem_object *obj);bool i915_gem_object_evictable (struct drm_i915_gem_object *obj); +bool i915_gem_object_migratable (struct drm_i915_gem_object *obj); + +bool i915_gem_object_validates_to_lmem (struct drm_i915_gem_object *obj); +#ifdef CONFIG_MMU_NOTIFIER static inline bool i915_gem_object_is_userptr (struct drm_i915_gem_object *obj)
Signature · 1 line
2.30.2
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
In reply to Thomas HellströmAm 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 13 lines
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.
Quoted 6 lines
There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
Well just use the eviction_valuable interface for this.
In general please make separate patches for the TTM changes and for the i915 changes using them for easier review.
Christian.
Quoted 1,150 lines
Remove the old lmem backend.
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 83 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 126 +++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 9 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 18 + drivers/gpu/drm/i915/gem/i915_gem_region.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 534 ++++++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ drivers/gpu/drm/i915/gt/intel_region_lmem.c | 3 +- drivers/gpu/drm/i915/i915_gem.c | 5 +- drivers/gpu/drm/i915/intel_memory_region.c | 1 - drivers/gpu/drm/i915/intel_memory_region.h | 1 - drivers/gpu/drm/i915/intel_region_ttm.c | 5 +- drivers/gpu/drm/i915/intel_region_ttm.h | 7 +- drivers/gpu/drm/ttm/ttm_bo.c | 12 + include/drm/ttm/ttm_device.h | 9 + 17 files changed, 733 insertions(+), 140 deletions(-)create mode 100644
drivers/gpu/drm/i915/gem/i915_gem_ttm.ccreate mode 100644drivers/gpu/drm/i915/gem/i915_gem_ttm.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm.o \ gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0
-83@@ -4,73 +4,10 @@*/ #include "intel_memory_region.h" -#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" -static void lmem_put_pages (struct drm_i915_gem_object *obj, -struct sg_table *pages) -{ -intel_region_ttm_node_free (obj->mm.region, obj->mm.st_mm_node); - obj->mm.dirty = false; -sg_free_table (pages); -kfree (pages); -} - -static int lmem_get_pages (struct drm_i915_gem_object *obj) -{ -unsigned int flags; -struct sg_table *pages; - - flags =I915_ALLOC_MIN_PAGE_SIZE ; -if (obj->flags &I915_BO_ALLOC_CONTIGUOUS ) - flags |=I915_ALLOC_CONTIGUOUS ; - - obj->mm.st_mm_node =intel_region_ttm_node_alloc (obj->mm.region, - obj->base.size, - flags); -if (IS_ERR (obj->mm.st_mm_node)) -return PTR_ERR (obj->mm.st_mm_node); - -/* Range manager is always contigous */ -if (obj->mm.region->is_range_manager) - obj->flags |=I915_BO_ALLOC_CONTIGUOUS ; - pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); -if (IS_ERR (pages)) -return PTR_ERR (pages); - -__i915_gem_object_set_pages (obj, pages, -i915_sg_dma_page_sizes (pages->sgl)); - -if (obj->flags &I915_BO_ALLOC_CPU_CLEAR ) { -void __iomem *vaddr = -i915_gem_object_lmem_io_map (obj,0 , obj->base.size); - -if (!vaddr) { -struct sg_table *pages = -__i915_gem_object_unset_pages (obj); - -if (!IS_ERR_OR_NULL (pages)) -lmem_put_pages (obj, pages); - } - -memset_io (vaddr,0 , obj->base.size); -io_mapping_unmap (vaddr); - } - -return 0 ; -} - -const struct drm_i915_gem_object_ops i915_gem_lmem_obj_ops = { - .name ="i915_gem_object_lmem" , - .flags =I915_GEM_OBJECT_HAS_IOMEM , - - .get_pages = lmem_get_pages, - .put_pages = lmem_put_pages, - .release = i915_gem_object_release_memory_region, -}; -void __iomem * i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj, unsigned long n,@@ -102,23 +39,3 @@ i915_gem_object_create_lmem(struct drm_i915_private *i915,return i915_gem_object_create_region (i915->mm.regions[INTEL_REGION_LMEM ], size, flags); } - -int __i915_gem_lmem_object_init (struct intel_memory_region *mem, -struct drm_i915_gem_object *obj, -resource_size_t size, -unsigned int flags) -{ -static struct lock_class_key lock_class; -struct drm_i915_private *i915 = mem->i915; - -drm_gem_private_object_init (&i915->drm, &obj->base, size); -i915_gem_object_init (obj, &i915_gem_lmem_obj_ops, &lock_class, flags); - - obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; - -i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); - -i915_gem_object_init_memory_region (obj, mem); - -return 0 ; -}drivers/gpu/drm/i915/gem/i915_gem_lmem.h +0
-5@@ -26,9 +26,4 @@ i915_gem_object_create_lmem(struct drm_i915_private *i915,resource_size_t size, unsigned int flags); -int __i915_gem_lmem_object_init (struct intel_memory_region *mem, -struct drm_i915_gem_object *obj, -resource_size_t size, -unsigned int flags); -#endif /* !__I915_GEM_LMEM_H */ drivers/gpu/drm/i915/gem/i915_gem_object.c +87
-39@@ -172,7 +172,7 @@ static void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *f } } -static void __i915_gem_free_object_rcu (struct rcu_head *head) +void __i915_gem_free_object_rcu (struct rcu_head *head) {struct drm_i915_gem_object *obj =container_of (head,typeof (*obj), rcu);@@ -208,59 +208,70 @@ static void __i915_gem_object_free_mmaps(struct drm_i915_gem_object *obj) } } -static void __i915_gem_free_objects (struct drm_i915_private *i915, -struct llist_node *freed) +void __i915_gem_free_object (struct drm_i915_gem_object *obj) { -struct drm_i915_gem_object *obj, *on; +trace_i915_gem_object_destroy (obj); -llist_for_each_entry_safe (obj, on, freed, freed) { -trace_i915_gem_object_destroy (obj); +if (!list_empty (&obj->vma.list)) { +struct i915_vma *vma; + +/* +* Note that the vma keeps an object reference while +* it is active, so it *should* not sleep while we +* destroy it. Our debug code errs insits it *might*. +* For the moment, play along. +*/ +spin_lock (&obj->vma.lock); +while ((vma =list_first_entry_or_null (&obj->vma.list, + struct i915_vma, + obj_link))) { +GEM_BUG_ON (vma->obj != obj); +spin_unlock (&obj->vma.lock); -if (!list_empty (&obj->vma.list)) { -struct i915_vma *vma; +__i915_vma_put (vma); -/* -* Note that the vma keeps an object reference while -* it is active, so it *should* not sleep while we -* destroy it. Our debug code errs insits it *might*. -* For the moment, play along. -*/ spin_lock (&obj->vma.lock); -while ((vma =list_first_entry_or_null (&obj->vma.list, - struct i915_vma, - obj_link))) { -GEM_BUG_ON (vma->obj != obj); -spin_unlock (&obj->vma.lock); + } +spin_unlock (&obj->vma.lock); + } -__i915_vma_put (vma); +__i915_gem_object_free_mmaps (obj); -spin_lock (&obj->vma.lock); - } -spin_unlock (&obj->vma.lock); - } +GEM_BUG_ON (!list_empty (&obj->lut_list)); -__i915_gem_object_free_mmaps (obj); +atomic_set (&obj->mm.pages_pin_count,0 ); +__i915_gem_object_put_pages (obj); +GEM_BUG_ON (i915_gem_object_has_pages (obj)); +bitmap_free (obj->bit_17); -GEM_BUG_ON (!list_empty (&obj->lut_list)); +if (obj->base.import_attach) +drm_prime_gem_destroy (&obj->base,NULL ); -atomic_set (&obj->mm.pages_pin_count,0 ); -__i915_gem_object_put_pages (obj); -GEM_BUG_ON (i915_gem_object_has_pages (obj)); -bitmap_free (obj->bit_17); +drm_gem_free_mmap_offset (&obj->base); -if (obj->base.import_attach) -drm_prime_gem_destroy (&obj->base,NULL ); +if (obj->ops->release) + obj->ops->release (obj); -drm_gem_free_mmap_offset (&obj->base); +if (obj->mm.n_placements >1 ) +kfree (obj->mm.placements); -if (obj->ops->release) - obj->ops->release (obj); +if (obj->resv_shared_from) +i915_vm_resv_put (obj->resv_shared_from); -if (obj->mm.n_placements >1 ) -kfree (obj->mm.placements); +} + +static void __i915_gem_free_objects (struct drm_i915_private *i915, +struct llist_node *freed) +{ +struct drm_i915_gem_object *obj, *on; -if (obj->resv_shared_from) -i915_vm_resv_put (obj->resv_shared_from); +llist_for_each_entry_safe (obj, on, freed, freed) { +might_sleep (); +if (obj->ops->delayed_free) { + obj->ops->delayed_free (obj); +continue ; + } +__i915_gem_free_object (obj);/* But keep the pointer alive for RCU-protected lookups */ call_rcu (&obj->rcu, __i915_gem_free_object_rcu);@@ -318,6 +329,7 @@ static void i915_gem_free_object(struct drm_gem_object *gem_obj)* worker and performing frees directly from subsequent allocations for * crude but effective memory throttling. */ +if (llist_add (&obj->freed, &i915->mm.free_list))queue_work (i915->wq, &i915->mm.free_work); }@@ -410,6 +422,42 @@ int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset,return 0 ; } +/** +* i915_gem_object_evictable - Whether object is likely evictable after unbind. +* @obj: The object to check +* +* This function checks whether the object is likely unvictable after unbind. +* If the object is not locked when checking, the result is only advisory. +* If the object is locked when checking, and the function returns true, +* then an eviction should indeed be possible. But since unlocked vma +* unpinning and unbinding is currently possible, the object can actually +* become evictable even if this function returns false. +* +* Return: true if the object may be evictable. False otherwise. +*/ +bool i915_gem_object_evictable (struct drm_i915_gem_object *obj) +{ +struct i915_vma *vma; +int pin_count =atomic_read (&obj->mm.pages_pin_count); + +if (!pin_count) +return true; + +spin_lock (&obj->vma.lock); +list_for_each_entry (vma, &obj->vma.list, obj_link) { +if (i915_vma_is_pinned (vma)) { +spin_unlock (&obj->vma.lock); +return false; + } +if (atomic_read (&vma->pages_count)) + pin_count--; + } +spin_unlock (&obj->vma.lock); +GEM_WARN_ON (pin_count <0 ); + +return pin_count ==0 ; +} +void i915_gem_init__objects (struct drm_i915_private *i915) {INIT_WORK (&i915->mm.free_work, __i915_gem_free_work);drivers/gpu/drm/i915/gem/i915_gem_object.h +9
-0@@ -200,6 +200,9 @@ static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj)static inline void i915_gem_object_unlock (struct drm_i915_gem_object *obj) { +if (obj->ops->adjust_lru) + obj->ops->adjust_lru (obj); +dma_resv_unlock (obj->base.resv); }@@ -587,6 +590,12 @@ int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset,bool i915_gem_object_is_shmem (const struct drm_i915_gem_object *obj); +void __i915_gem_free_object_rcu (struct rcu_head *head); + +void __i915_gem_free_object (struct drm_i915_gem_object *obj); + +bool i915_gem_object_evictable (struct drm_i915_gem_object *obj); +#ifdef CONFIG_MMU_NOTIFIER static inline bool i915_gem_object_is_userptr (struct drm_i915_gem_object *obj)drivers/gpu/drm/i915/gem/i915_gem_object_types.h +18
-0@@ -63,6 +63,20 @@ struct drm_i915_gem_object_ops { const struct drm_i915_gem_pwrite *arg);int (*dmabuf_export)(struct drm_i915_gem_object *obj); + +/** +* adjust_lru - notify that the madvise value was updated +* @obj: The gem object +* +* The madvise value may have been updated, or object was recently +* referenced so act accordingly (Perhaps changing an LRU list etc). +*/ +void (*adjust_lru)(struct drm_i915_gem_object *obj); + +/** +* delayed_free - Override the default delayed free implementation +*/ +void (*delayed_free)(struct drm_i915_gem_object *obj);void (*release)(struct drm_i915_gem_object *obj);const char *name;/* friendly name for debug, e.g. lockdep classes */ @@ -307,6 +321,10 @@ struct drm_i915_gem_object { bool dirty:1; } mm; +struct { +struct sg_table *cached_io_st; + } ttm; +/** Record of address bit 17 of each page at last unbind. */ unsigned long *bit_17;drivers/gpu/drm/i915/gem/i915_gem_region.c +1
-5@@ -18,11 +18,7 @@ void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,mutex_lock (&mem->objects.lock); -if (obj->flags &I915_BO_ALLOC_VOLATILE ) -list_add (&obj->mm.region_link, &mem->objects.purgeable); -else -list_add (&obj->mm.region_link, &mem->objects.list); - +list_add (&obj->mm.region_link, &mem->objects.list);mutex_unlock (&mem->objects.lock); }drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +534
-0@@ -0,0 +1,534 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2021 Intel Corporation +*/ + +#include <drm/ttm/ttm_bo_driver.h> +#include <drm/ttm/ttm_placement.h> + +#include "i915_drv.h" +#include "intel_memory_region.h" +#include "intel_region_ttm.h" + +#include "gem/i915_gem_object.h" +#include "gem/i915_gem_region.h" +#include "gem/i915_gem_ttm.h" +#include "gem/i915_gem_ttm_bo_util.h" + +#define I915_PL_LMEM0 TTM_PL_PRIV +#define I915_PL_SYSTEM TTM_PL_SYSTEM +#define I915_PL_STOLEN TTM_PL_VRAM +#define I915_PL_GGTT TTM_PL_TT + +#define I915_TTM_PRIO_PURGE 0 +#define I915_TTM_PRIO_NO_PAGES 1 +#define I915_TTM_PRIO_HAS_PAGES 2 + +/** +* struct i915_ttm_tt - TTM page vector with additional private information +* @ttm: The base TTM page vector. +* @dev: The struct device used for dma mapping and unmapping. +* @cached_st: The cached scatter-gather table. +* +* Note that DMA may be going on right up to the point where the page- +* vector is unpopulated in delayed destroy. Hence keep the +* scatter-gather table mapped and cached up to that point. This is +* different from the cached gem object io scatter-gather table which +* doesn't have an associated dma mapping. +*/ +struct i915_ttm_tt { +struct ttm_tt ttm; +struct device *dev; +struct sg_table *cached_st; +}; + +static const struct ttm_place lmem0_sys_placement_flags[] = { + { + .fpfn =0 , + .lpfn =0 , + .mem_type =I915_PL_LMEM0 , + .flags =0 , + }, { + .fpfn =0 , + .lpfn =0 , + .mem_type =I915_PL_SYSTEM , + .flags =0 , + } +}; + +struct ttm_placement i915_lmem0_placement = { + .num_placement =1 , + .placement = &lmem0_sys_placement_flags[0 ], + .num_busy_placement =1 , + .busy_placement = &lmem0_sys_placement_flags[0 ], +}; + +struct ttm_placement i915_lmem0_sys_placement = { + .num_placement =1 , + .placement = &lmem0_sys_placement_flags[0 ], + .num_busy_placement =2 , + .busy_placement = &lmem0_sys_placement_flags[0 ], +}; + +struct ttm_placement i915_sys_placement = { + .num_placement =1 , + .placement = &lmem0_sys_placement_flags[1 ], + .num_busy_placement =1 , + .busy_placement = &lmem0_sys_placement_flags[1 ], +}; + +static void i915_ttm_adjust_lru (struct drm_i915_gem_object *obj); + +static struct ttm_tt *i915_ttm_tt_create (struct ttm_buffer_object *bo, +uint32_t page_flags) +{ +struct ttm_resource_manager *man = +ttm_manager_type (bo->bdev, bo->mem.mem_type); +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); +struct i915_ttm_tt *i915_tt; +int ret; + + i915_tt =kzalloc (sizeof (*i915_tt),GFP_KERNEL ); +if (!i915_tt) +return NULL ; + +if (obj->flags &I915_BO_ALLOC_CPU_CLEAR && + man->use_tt) + page_flags |=TTM_PAGE_FLAG_ZERO_ALLOC ; + + ret =ttm_tt_init (&i915_tt->ttm, bo, page_flags, ttm_cached); +if (ret) { +kfree (i915_tt); +return NULL ; + } + + i915_tt->dev = obj->base.dev->dev; + +return &i915_tt->ttm; +} + +static void i915_ttm_tt_unpopulate (struct ttm_device *bdev,struct ttm_tt *ttm) +{ +struct i915_ttm_tt *i915_tt =container_of (ttm,typeof (*i915_tt), ttm); + +if (i915_tt->cached_st) { +dma_unmap_sgtable (i915_tt->dev, i915_tt->cached_st, +DMA_BIDIRECTIONAL ,0 ); +sg_free_table (i915_tt->cached_st); +kfree (i915_tt->cached_st); + i915_tt->cached_st =NULL ; + } +ttm_pool_free (&bdev->pool, ttm); +} + +static void i915_ttm_tt_destroy (struct ttm_device *bdev,struct ttm_tt *ttm) +{ +struct i915_ttm_tt *i915_tt =container_of (ttm,typeof (*i915_tt), ttm); + +ttm_tt_destroy_common (bdev, ttm); +kfree (i915_tt); +} + +static bool i915_ttm_eviction_valuable (struct ttm_buffer_object *bo, +const struct ttm_place *place) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); + +/* Will do for now. Our pinned objects are still on TTM's LRU lists */ +if (!i915_gem_object_evictable (obj)) +return false; + +/* This isn't valid with a buddy allocator */ +return ttm_bo_eviction_valuable (bo, place); +} + +static void i915_ttm_evict_flags (struct ttm_buffer_object *bo, +struct ttm_placement *placement) +{ + *placement = i915_sys_placement; +} + +static int i915_ttm_move_notify (struct ttm_buffer_object *bo) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); +int ret; + + ret =i915_gem_object_unbind (obj,I915_GEM_OBJECT_UNBIND_ACTIVE ); +if (ret) +return ret; + + ret =__i915_gem_object_put_pages (obj); +if (ret) +return ret; + +return 0 ; +} + +static void i915_ttm_free_cached_io_st (struct drm_i915_gem_object *obj) +{ +if (obj->ttm.cached_io_st) { +sg_free_table (obj->ttm.cached_io_st); +kfree (obj->ttm.cached_io_st); + obj->ttm.cached_io_st =NULL ; + } +} + +static void i915_ttm_purge (struct drm_i915_gem_object *obj) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); + +if (obj->mm.madv == __I915_MADV_PURGED) +return ; + +i915_ttm_free_cached_io_st (obj); + +ttm_resource_free (bo, &bo->mem); +if (bo->ttm) +ttm_bo_tt_destroy (bo); + + obj->mm.madv = __I915_MADV_PURGED; +} + +static bool i915_ttm_swap_possible (struct ttm_buffer_object *bo) +{ +/* Will do for now. Our pinned objects are still on TTM's LRU lists */ +return i915_gem_object_evictable (i915_ttm_to_gem (bo)); +} + +static void i915_ttm_swap_notify (struct ttm_buffer_object *bo) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); +int ret =i915_ttm_move_notify (bo); + +GEM_WARN_ON (ret); +GEM_WARN_ON (obj->ttm.cached_io_st); +if (!ret && obj->mm.madv !=I915_MADV_WILLNEED ) +i915_ttm_purge (obj); +} + +static void i915_ttm_delete_mem_notify (struct ttm_buffer_object *bo) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); + +if (likely (obj)) { +/* This releases all gem object bindings to the backend. */ +__i915_gem_free_object (obj); + } +} + +static struct intel_memory_region * +i915_ttm_region (struct ttm_device *bdev,int ttm_mem_type) +{ +struct drm_i915_private *i915 =container_of (bdev,typeof (*i915), bdev); + +/* There's some room for optimization here... */ +GEM_BUG_ON (ttm_mem_type !=I915_PL_SYSTEM && + ttm_mem_type <I915_PL_LMEM0 ); +if (ttm_mem_type ==I915_PL_SYSTEM ) +return intel_memory_region_lookup (i915,INTEL_MEMORY_SYSTEM , +0 ); + +return intel_memory_region_lookup (i915,INTEL_MEMORY_LOCAL , + ttm_mem_type -I915_PL_LMEM0 ); +} + +static struct sg_table *i915_ttm_tt_get_st (struct ttm_tt *ttm) +{ +struct i915_ttm_tt *i915_tt =container_of (ttm,typeof (*i915_tt), ttm); +struct scatterlist *sg; +struct sg_table *st; +int ret; + +if (i915_tt->cached_st) +return i915_tt->cached_st; + + st =kzalloc (sizeof (*st),GFP_KERNEL ); +if (!st) +return ERR_PTR (-ENOMEM ); + + sg =__sg_alloc_table_from_pages + (st, ttm->pages, ttm->num_pages,0 , + (unsigned long ) ttm->num_pages <<PAGE_SHIFT , +i915_sg_segment_size (),NULL ,0 ,GFP_KERNEL ); +if (IS_ERR (sg)) { +kfree (st); +return ERR_CAST (sg); + } + + ret =dma_map_sgtable (i915_tt->dev, st,DMA_BIDIRECTIONAL ,0 ); +if (ret) { +sg_free_table (st); +kfree (st); +return ERR_PTR (ret); + } + + i915_tt->cached_st = st; +return st; +} + +static struct sg_table * +i915_ttm_resource_get_st (struct drm_i915_gem_object *obj, +struct ttm_resource *res) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); +struct ttm_resource_manager *man = +ttm_manager_type (bo->bdev, res->mem_type); +struct sg_table *st; + +if (man->use_tt) +return i915_ttm_tt_get_st (bo->ttm); + + st =kzalloc (sizeof (*st),GFP_KERNEL ); +if (!st) +return ERR_PTR (-ENOMEM ); + + st =intel_region_ttm_node_to_st (obj->mm.region, res->mm_node); +if (IS_ERR (st)) +return ERR_CAST (st); + +return st; +} + +static int i915_ttm_move (struct ttm_buffer_object *bo,bool evict, +struct ttm_operation_ctx *ctx, +struct ttm_resource *new_mem, +struct ttm_place *hop) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); +struct ttm_resource_manager *new_man = +ttm_manager_type (bo->bdev, new_mem->mem_type); +struct ttm_resource_manager *old_man = +ttm_manager_type (bo->bdev, bo->mem.mem_type); +struct intel_memory_region *new_reg, *old_reg; +union { +struct i915_ttm_kmap_iter_tt tt; +struct i915_ttm_kmap_iter_iomap io; + } _new_iter, _old_iter; +struct i915_ttm_kmap_iter *new_iter, *old_iter; +struct sg_table *new_st; +int ret; + + new_reg =i915_ttm_region (bo->bdev, new_mem->mem_type); + old_reg =i915_ttm_region (bo->bdev, bo->mem.mem_type); +GEM_BUG_ON (!new_reg || !old_reg); + +/* Sync for now. We could do the actual copy async. */ + ret =ttm_bo_wait_ctx (bo, ctx); +if (ret) +return ret; + + ret =i915_ttm_move_notify (bo); +if (ret) +return ret; + +if (obj->mm.madv !=I915_MADV_WILLNEED ) { +i915_ttm_purge (obj); +ttm_resource_free (bo, new_mem); +return 0 ; + } + +/* Populate ttm with pages if needed. Typically system memory. */ +if (new_man->use_tt && bo->ttm) { + ret =ttm_tt_populate (bo->bdev, bo->ttm, ctx); +if (ret) +return ret; + } + + new_st =i915_ttm_resource_get_st (obj, new_mem); +if (IS_ERR (new_st)) +return PTR_ERR (new_st); + + new_iter = new_man->use_tt ? +i915_ttm_kmap_iter_tt_init (&_new_iter.tt, bo->ttm) : +i915_ttm_kmap_iter_iomap_init (&_new_iter.io, &new_reg->iomap, + new_st, new_reg->region.start); + + old_iter = old_man->use_tt ? +i915_ttm_kmap_iter_tt_init (&_old_iter.tt, bo->ttm) : +i915_ttm_kmap_iter_iomap_init (&_old_iter.io, &old_reg->iomap, + obj->ttm.cached_io_st, + old_reg->region.start); + +i915_ttm_move_memcpy (bo, new_mem, new_iter, old_iter); +i915_ttm_free_cached_io_st (obj); + +if (!new_man->use_tt) + obj->ttm.cached_io_st = new_st; + +return 0 ; +} + +struct ttm_device_funcs i915_ttm_bo_driver = { + .ttm_tt_create = i915_ttm_tt_create, + .ttm_tt_unpopulate = i915_ttm_tt_unpopulate, + .ttm_tt_destroy = i915_ttm_tt_destroy, + .eviction_valuable = i915_ttm_eviction_valuable, + .evict_flags = i915_ttm_evict_flags, + .move = i915_ttm_move, + .verify_access =NULL , + .swap_possible = i915_ttm_swap_possible, + .swap_notify = i915_ttm_swap_notify, + .delete_mem_notify = i915_ttm_delete_mem_notify, +}; + +static int i915_ttm_get_pages (struct drm_i915_gem_object *obj) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); +struct ttm_operation_ctx ctx = { + .interruptible = true, + .no_wait_gpu = false, + }; +struct sg_table *st; +int ret; + +/* Swap in. */ +if (bo->ttm && (bo->ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )) { + ret =ttm_tt_populate (bo->bdev, bo->ttm, &ctx); +if (ret) +return ret; + } + +/* Move to the requested placement. */ + ret =ttm_bo_validate (bo, &i915_lmem0_placement, &ctx); +if (ret) +return ret; + +/* Object either has a page vector or is an iomem object */ + st = bo->ttm ?i915_ttm_tt_get_st (bo->ttm) : obj->ttm.cached_io_st; +if (IS_ERR (st)) +return PTR_ERR (st); + +__i915_gem_object_set_pages (obj, st,i915_sg_dma_page_sizes (st->sgl)); + +i915_ttm_adjust_lru (obj); + +return ret; +} + +static void i915_ttm_put_pages (struct drm_i915_gem_object *obj, +struct sg_table *st) +{ +/* +* We're currently not called from a shrinker, so put_pages() +* typically means the object is about to destroyed, or called +* from move_notify(). So just avoid doing much for now. +* If the object is not destroyed next, The TTM eviction logic +* and shrinkers will move it out if needed. +*/ + +i915_ttm_adjust_lru (obj); +} + +static void i915_ttm_adjust_lru (struct drm_i915_gem_object *obj) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); + +/* +* Don't manipulate the TTM LRUs while in TTM bo destruction. +* We're called through i915_ttm_delete_mem_notify(). +*/ +if (!kref_read (&bo->kref)) +return ; + +/* +* Put on the correct LRU list depending on the MADV status +*/ +spin_lock (&bo->bdev->lru_lock); +if (obj->mm.madv !=I915_MADV_WILLNEED ) { + bo->priority =I915_TTM_PRIO_PURGE ; + }else if (!i915_gem_object_has_pages (obj)) { +if (bo->priority <I915_TTM_PRIO_HAS_PAGES ) + bo->priority =I915_TTM_PRIO_HAS_PAGES ; + }else { +if (bo->priority >I915_TTM_PRIO_NO_PAGES ) + bo->priority =I915_TTM_PRIO_NO_PAGES ; + } + +ttm_bo_move_to_lru_tail (bo, &bo->mem,NULL ); +spin_unlock (&bo->bdev->lru_lock); +} + +/* +* TTM-backed gem object destruction requires some clarification. +* Basically we have two possibilities here. We can either rely on the +* i915 delayed destruction and put the TTM object when the object +* is idle. This would be detected by TTM which would bypass the +* TTM delayed destroy handling. The other approach is to put the TTM +* object early and rely on the TTM destroyed handling, and then free +* the leftover parts of the GEM object once TTM's destroyed list handling is +* complete. For now, we rely on the latter for two reasons: +* a) TTM can evict an object even when it's on the delayed destroy list, +* which in theory allows for complete eviction. +* b) There is work going on in TTM to allow freeing an object even when +* it's not idle, and using the TTM destroyed list handling could help us +* benefit from that. +*/ +static void i915_ttm_delayed_free (struct drm_i915_gem_object *obj) +{ +ttm_bo_put (i915_gem_to_ttm (obj)); +} + +static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = { + .name ="i915_gem_object_ttm" , + .flags =I915_GEM_OBJECT_HAS_IOMEM , + + .get_pages = i915_ttm_get_pages, + .put_pages = i915_ttm_put_pages, + .truncate = i915_ttm_purge, + .adjust_lru = i915_ttm_adjust_lru, + .delayed_free = i915_ttm_delayed_free, +}; + +void i915_ttm_bo_destroy (struct ttm_buffer_object *bo) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); + +i915_gem_object_release_memory_region (obj); +call_rcu (&obj->rcu, __i915_gem_free_object_rcu); +} + +/** +* __i915_gem_ttm_object_init - Initialize a ttm-backed i915 gem object +* @mem: The initial memory region for the object. +* @obj: The gem object. +* @size: Object size in bytes. +* @flags: gem object flags. +* +* Return: 0 on success, negative error code on failure. +*/ +int __i915_gem_ttm_object_init (struct intel_memory_region *mem, +struct drm_i915_gem_object *obj, +resource_size_t size, +unsigned int flags) +{ +static struct lock_class_key lock_class; +struct drm_i915_private *i915 = mem->i915; +size_t alignment =0 ; +int ret; + +/* Adjust alignment to GPU- and CPU huge page sizes. */ + +if (mem->is_range_manager) { +if (size >=SZ_1G ) + alignment =SZ_1G >>PAGE_SHIFT ; +else if (size >=SZ_2M ) + alignment =SZ_2M >>PAGE_SHIFT ; +else if (size >=SZ_64K ) + alignment =SZ_64K >>PAGE_SHIFT ; + } + +drm_gem_private_object_init (&i915->drm, &obj->base, size); +i915_gem_object_init (obj, &i915_gem_ttm_obj_ops, &lock_class, flags); +i915_gem_object_init_memory_region (obj, mem); +i915_gem_object_make_unshrinkable (obj); + + ret =ttm_bo_init (&i915->bdev,i915_gem_to_ttm (obj), size, + ttm_bo_type_kernel, &i915_sys_placement, alignment, + true,NULL ,NULL , i915_ttm_bo_destroy); + + obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; + +i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); + +return 0 ; +}drivers/gpu/drm/i915/gem/i915_gem_ttm.h new file +48
-0@@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ +#ifndef _I915_GEM_TTM_H_ +#define _I915_GEM_TTM_H_ + +#include "gem/i915_gem_object_types.h" + +/** +* i915_gem_to_ttm - Convert a struct drm_i915_gem_object to a +* struct ttm_buffer_object. +* @obj: Pointer to the gem object. +* +* Return: Pointer to the embedded struct ttm_buffer_object. +*/ +static inline struct ttm_buffer_object * +i915_gem_to_ttm (struct drm_i915_gem_object *obj) +{ +return &obj->__do_not_access; +} + +/* +* i915 ttm gem object destructor. Internal use only. +*/ +void i915_ttm_bo_destroy (struct ttm_buffer_object *bo); + +/** +* i915_ttm_to_gem - Convert a struct ttm_buffer_object to an embedding +* struct drm_i915_gem_object. +* +* Return: Pointer to the embedding struct ttm_buffer_object, or NULL +* if the object was not an i915 ttm object. +*/ +static inline struct drm_i915_gem_object * +i915_ttm_to_gem (struct ttm_buffer_object *bo) +{ +if (GEM_WARN_ON (bo->destroy != i915_ttm_bo_destroy)) +return NULL ; + + return container_of(bo, struct drm_i915_gem_object, __do_not_access); +} + +int __i915_gem_ttm_object_init (struct intel_memory_region *mem, +struct drm_i915_gem_object *obj, +resource_size_t size, +unsigned int flags); +#endif drivers/gpu/drm/i915/gt/intel_region_lmem.c +2
-1@@ -9,6 +9,7 @@#include "intel_region_ttm.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" +#include "gem/i915_gem_ttm.h" #include "intel_region_lmem.h" static int init_fake_lmem_bar (struct intel_memory_region *mem)@@ -107,7 +108,7 @@ region_lmem_init(struct intel_memory_region *mem)static const struct intel_memory_region_ops intel_region_lmem_ops = { .init = region_lmem_init, .release = region_lmem_release, - .init_object = __i915_gem_lmem_object_init, + .init_object = __i915_gem_ttm_object_init, }; struct intel_memory_region *drivers/gpu/drm/i915/i915_gem.c +4
-1@@ -1005,8 +1005,11 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data, } } -if (obj->mm.madv != __I915_MADV_PURGED) +if (obj->mm.madv != __I915_MADV_PURGED) { obj->mm.madv = args->madv; +if (obj->ops->adjust_lru) + obj->ops->adjust_lru (obj); + }if (i915_gem_object_has_pages (obj)) {struct list_head *list;drivers/gpu/drm/i915/intel_memory_region.c +0
-1@@ -149,7 +149,6 @@ intel_memory_region_create(struct drm_i915_private *i915,mutex_init (&mem->objects.lock);INIT_LIST_HEAD (&mem->objects.list); -INIT_LIST_HEAD (&mem->objects.purgeable);INIT_LIST_HEAD (&mem->reserved);mutex_init (&mem->mm_lock);drivers/gpu/drm/i915/intel_memory_region.h +0
-1@@ -100,7 +100,6 @@ struct intel_memory_region {struct {struct mutex lock;/* Protects access to objects */ struct list_head list; -struct list_head purgeable; } objects;size_t chunk_size;drivers/gpu/drm/i915/intel_region_ttm.c +3
-2@@ -10,8 +10,7 @@#include "intel_region_ttm.h" -/* A Zero-initialized driver for now. We don't have a TTM backend yet. */ -static struct ttm_device_funcs i915_ttm_bo_driver; +extern struct ttm_device_funcs i915_ttm_bo_driver;/** * DOC: TTM support structure @@ -198,6 +197,7 @@ struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem,return i915_sg_from_mm_node (node, mem->region.start); } +#ifdef CONFIG_DRM_I915_SELFTEST /** * intel_region_ttm_node_alloc - Allocate memory resources from a region * @mem: The memory region, @@ -244,3 +244,4 @@ void *intel_region_ttm_node_alloc(struct intel_memory_region *mem, ret = -ENXIO ; return ret ? ERR_PTR(ret) : res.mm_node; } +#endif drivers/gpu/drm/i915/intel_region_ttm.h +5
-2@@ -21,9 +21,12 @@ void intel_region_ttm_fini(struct intel_memory_region *mem);struct sg_table *intel_region_ttm_node_to_st (struct intel_memory_region *mem,void *node); +void intel_region_ttm_node_free (struct intel_memory_region *mem, +void *node); + +#ifdef CONFIG_DRM_I915_SELFTEST void *intel_region_ttm_node_alloc (struct intel_memory_region *mem,resource_size_t size,unsigned int flags); -void intel_region_ttm_node_free (struct intel_memory_region *mem, -void *node); +#endif #endif /* _INTEL_REGION_TTM_H_ */ drivers/gpu/drm/ttm/ttm_bo.c +12
-0@@ -1150,6 +1150,14 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,return -EBUSY ; } +if (bo->bdev->funcs->swap_possible) { +if (!bo->bdev->funcs->swap_possible (bo)) { +if (locked) +dma_resv_unlock (bo->base.resv); +return -EBUSY ; + } + } +if (bo->deleted) {ttm_bo_cleanup_refs (bo, false, false, locked);ttm_bo_put (bo);@@ -1200,6 +1208,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,if (bo->bdev->funcs->swap_notify) bo->bdev->funcs->swap_notify (bo); +/* The call to swap_notify may have purged the bo */ +if (!bo->ttm) + goto out; + ret =ttm_tt_swapout (bo->bdev, bo->ttm, gfp_flags); out:include/drm/ttm/ttm_device.h +2
-0@@ -181,6 +181,15 @@ struct ttm_device_funcs {*/ void (*delete_mem_notify)(struct ttm_buffer_object *bo); +/** +* struct ttm_bo_driver member swap_possible
include/drm/ttm/ttm_device.h struct ttm_device_funcs { · line 195
Quoted 10 lines
include/drm/ttm/ttm_device.h +7
-0+* +* @bo: the buffer object to be evicted +* +* Check with the driver if it is possible to swap out a BO. +*/ +bool (*swap_possible)(struct ttm_buffer_object *bo); +/** * notify the driver that we're about to swap out this bo */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Quoted 14 lines · Christian König
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 13 lines
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.
Quoted 8 lines
Quoted 6 lines
There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
Well just use the
eviction_valuableinterface for this.
Yes, we do that for vram/lmem eviction, but we have nothing similar for system swapping. Do I understand you correctly that you want me to add a call to eviction_valuable() also for that instead of swap_possible()?
Quoted 2 lines
In general please make separate patches for the TTM changes and for the i915 changes using them for easier review.
I'll respin with a split. Do you want me to do the same also for the other two patches that minmally touch TTM?
Thanks,
Thomas
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 23 lines · Christian König
Quoted 21 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 19 lines
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
Quoted 3 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar for system swapping. Do I understand you correctly that you want me to add a call to
eviction_valuable()also for that instead ofswap_possible()?
You should already have that. eviction_valuable is called in both cases.
Quoted 6 lines
Quoted 4 lines
In general please make separate patches for the TTM changes and for the i915 changes using them for easier review.
I'll respin with a split. Do you want me to do the same also for the other two patches that minmally touch TTM?
Yes, that makes it much easier to review the general usefulness of interface changes.
Thanks,
Christian.
Quoted 6 lines
Thanks,
Thomas
Thomas Hellström
reviewerRe: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Quoted 26 lines · Christian König
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 23 lines · Christian König
Quoted 21 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 19 lines
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar for system swapping. Do I understand you correctly that you want me to add a call to
eviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both cases.
Hmm. I can only see it called from ttm_mem_evict_first() which is not in the swapping path? Or do I miss something?
Thanks,
Thomas
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Move LMEM (VRAM) management over to TTM
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM
URL : https://patchwork.freedesktop.org/series/90022/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 7c8e78644333 drm/i915: Untangle the vma pages_mutex e148e51b2187 drm/i915: Don't free shared locks while shared 08fe6c5181ab drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers. -:69: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #69: FILE: drivers/gpu/drm/i915/gem/i915_gem_lmem.c:13: +static void lmem_put_pages(struct drm_i915_gem_object *obj, + struct sg_table *pages)
-:484: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #484:
deleted file mode 100644
-:1818: CHECK:LINE_SPACING: Please don't use multiple blank lines #1818: FILE: drivers/gpu/drm/i915/intel_region_ttm.c:145:
+
+
total: 0 errors, 1 warnings, 2 checks, 1636 lines checked7dc5b6bf9897 drm/i915/ttm: Embed a ttm buffer object in the i915 gem object 1cd13783b35c drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem -:43: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
-:157: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!ttm" #157: FILE: drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c:110:
+ (ttm == NULL || !ttm_tt_is_populated(ttm))) {
total: 0 errors, 1 warnings, 1 checks, 307 lines checked 1bdd626f1990 drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend -:266: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #266: FILE: drivers/gpu/drm/i915/gem/i915_gem_object.c:261:
+}
-:417: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #417:
new file mode 100644
-:672: CHECK:SPACING: No space is necessary after a cast #672: FILE: drivers/gpu/drm/i915/gem/i915_gem_ttm.c:251:
+ (unsigned long) ttm->num_pages << PAGE_SHIFT,
total: 0 errors, 1 warnings, 2 checks, 1016 lines checked bd0a5cd14b4e drm/i915/lmem: Verify checks for lmem residency
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Move LMEM (VRAM) management over to TTM
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM
URL : https://patchwork.freedesktop.org/series/90022/
State : warning
== Summary ==
$ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately. +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +./drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgv_sriovmsg.h:274:49: error: static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1345:25: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1345:25: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1345:25: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1346:17: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1346:17: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1346:17: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1405:17: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1405:17: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c:1405:17: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:287:16: error: incompatible types in comparison expression (different type sizes): +drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:287:16: unsigned long * +drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:287:16: unsigned long long * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:274:25: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:274:25: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:274:25: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:275:17: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:275:17: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:275:17: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:329:17: error: incompatible types in comparison expression (different address spaces): +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:329:17: struct dma_fence * +drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:329:17: struct dma_fence [noderef] __rcu * +drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h:90:56: error: marked inline, but without a definition +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB" +drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:270:49: error: static assertion failed: "amd_sriov_msg_vf2pf_in
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move LMEM (VRAM) management over to TTM
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM
URL : https://patchwork.freedesktop.org/series/90022/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10068 -> Patchwork_20100
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_20100 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_20100, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_20100:
### IGT changes ###
#### Possible regressions ####
* igt@core_hotunplug@unbind-rebind:
- fi-skl-6600u: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-skl-6600u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-skl-6600u/igt@[email protected]
- fi-cml-s: [PASS][3] -> [DMESG-WARN][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cml-s/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cml-s/igt@[email protected]
- fi-cml-u2: [PASS][5] -> [DMESG-WARN][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cml-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cml-u2/igt@[email protected]
- fi-icl-u2: [PASS][7] -> [DMESG-WARN][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-icl-u2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-icl-u2/igt@[email protected]
- fi-tgl-y: [PASS][9] -> [DMESG-WARN][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-tgl-y/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-tgl-y/igt@[email protected]
* igt@i915_selftest@live@gem:
- fi-snb-2520m: [PASS][11] -> [DMESG-FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-snb-2520m/igt@i915_selftest@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-snb-2520m/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@gt_lrc:
- fi-kbl-x1275: [PASS][13] -> [DMESG-FAIL][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-x1275/igt@i915_selftest@live@gt_lrc.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-x1275/igt@i915_selftest@live@gt_lrc.html
* igt@i915_selftest@live@gt_timelines:
- fi-skl-6700k2: [PASS][15] -> [DMESG-FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-skl-6700k2/igt@i915_selftest@live@gt_timelines.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-skl-6700k2/igt@i915_selftest@live@gt_timelines.html
- fi-cfl-8700k: [PASS][17] -> [DMESG-FAIL][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cfl-8700k/igt@i915_selftest@live@gt_timelines.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cfl-8700k/igt@i915_selftest@live@gt_timelines.html
* igt@i915_selftest@live@hugepages:
- fi-bdw-5557u: [PASS][19] -> [DMESG-FAIL][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bdw-5557u/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bdw-5557u/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-bwr-2160: [PASS][21] -> [FAIL][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bwr-2160/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bwr-2160/igt@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- fi-ilk-650: [PASS][23] -> [FAIL][24] +8 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-ilk-650/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-ilk-650/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-bsw-kefka: [PASS][25] -> [FAIL][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-kefka/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-kefka/igt@[email protected]
* igt@runner@aborted:
- fi-snb-2520m: NOTRUN -> [FAIL][27]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-snb-2520m/igt@[email protected]
#### Warnings ####
* igt@gem_exec_gttfill@basic:
- fi-ilk-650: [FAIL][28] ([i915#3457]) -> [FAIL][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-ilk-650/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-ilk-650/igt@[email protected]
* igt@i915_selftest@live@execlists:
- fi-cfl-8109u: [INCOMPLETE][30] -> [DMESG-FAIL][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cfl-8109u/igt@i915_selftest@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cfl-8109u/igt@i915_selftest@[email protected]
- fi-tgl-u2: [DMESG-FAIL][32] -> [INCOMPLETE][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-tgl-u2/igt@i915_selftest@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-tgl-u2/igt@i915_selftest@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@core_hotunplug@unbind-rebind:
- {fi-ehl-1}: [PASS][34] -> [DMESG-WARN][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-ehl-1/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-ehl-1/igt@[email protected]
* igt@i915_selftest@live@sanitycheck:
- {fi-tgl-dsi}: [PASS][36] -> [DMESG-FAIL][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-tgl-dsi/igt@i915_selftest@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-tgl-dsi/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_20100 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fence@basic-await@vcs0:
- fi-bsw-kefka: [PASS][38] -> [FAIL][39] ([i915#3457])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
* igt@gem_wait@busy@all:
- fi-bsw-nick: [PASS][40] -> [FAIL][41] ([i915#3177] / [i915#3457])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-nick/igt@gem_wait@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-nick/igt@gem_wait@[email protected]
* igt@gem_wait@wait@all:
- fi-bwr-2160: [PASS][42] -> [FAIL][43] ([i915#3457]) +1 similar issue
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bwr-2160/igt@gem_wait@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bwr-2160/igt@gem_wait@[email protected]
- fi-pnv-d510: [PASS][44] -> [FAIL][45] ([i915#3457]) +1 similar issue
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-pnv-d510/igt@gem_wait@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-pnv-d510/igt@gem_wait@[email protected]
- fi-bsw-nick: [PASS][46] -> [FAIL][47] ([i915#3457])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-nick/igt@gem_wait@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-nick/igt@gem_wait@[email protected]
* igt@i915_pm_rpm@module-reload:
- fi-icl-y: [PASS][48] -> [INCOMPLETE][49] ([i915#2405])
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-icl-y/igt@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-icl-y/igt@[email protected]
- fi-glk-dsi: [PASS][50] -> [DMESG-WARN][51] ([i915#1982])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-glk-dsi/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-glk-dsi/igt@[email protected]
* igt@i915_selftest@live@blt:
- fi-kbl-7500u: [PASS][52] -> [DMESG-FAIL][53] ([i915#2927])
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-7500u/igt@i915_selftest@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-7500u/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@gt_contexts:
- fi-bsw-kefka: [PASS][54] -> [DMESG-FAIL][55] ([i915#2927])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-kefka/igt@i915_selftest@live@gt_contexts.html
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-kefka/igt@i915_selftest@live@gt_contexts.html
- fi-bsw-nick: [PASS][56] -> [DMESG-FAIL][57] ([i915#2927])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-nick/igt@i915_selftest@live@gt_contexts.html
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-nick/igt@i915_selftest@live@gt_contexts.html
#### Possible fixes ####
* igt@gem_exec_fence@nb-await@bcs0:
- fi-bsw-nick: [FAIL][58] ([i915#3457]) -> [PASS][59] +1 similar issue
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-nick/igt@gem_exec_fence@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-nick/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@nb-await@rcs0:
- fi-glk-dsi: [FAIL][60] ([i915#3457]) -> [PASS][61] +3 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-glk-dsi/igt@gem_exec_fence@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-glk-dsi/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@nb-await@vcs0:
- fi-bsw-kefka: [FAIL][62] ([i915#3457]) -> [PASS][63] +1 similar issue
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@nb-await@vecs0:
- fi-bsw-n3050: [FAIL][64] ([i915#3457]) -> [PASS][65]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
* igt@kms_busy@basic@modeset:
- fi-ilk-650: [INCOMPLETE][66] ([i915#3457]) -> [PASS][67]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-ilk-650/igt@kms_busy@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-ilk-650/igt@kms_busy@[email protected]
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-7500u: [DMESG-FAIL][68] ([i915#165]) -> [PASS][69]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-7500u/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-7500u/igt@[email protected]
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-elk-e7500: [FAIL][70] -> [PASS][71]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-elk-e7500/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-elk-e7500/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-bwr-2160: [FAIL][72] -> [PASS][73]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bwr-2160/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bwr-2160/igt@[email protected]
#### Warnings ####
* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [FAIL][74] -> [FAIL][75] ([i915#3457])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-pnv-d510/igt@[email protected]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-pnv-d510/igt@[email protected]
* igt@i915_module_load@reload:
- fi-kbl-soraka: [DMESG-WARN][76] ([i915#1982]) -> [DMESG-WARN][77] ([i915#1982] / [i915#3457])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-soraka/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-soraka/igt@[email protected]
- fi-tgl-u2: [DMESG-WARN][78] ([k.org#205379]) -> [DMESG-WARN][79] ([i915#3457] / [k.org#205379])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-tgl-u2/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-tgl-u2/igt@[email protected]
- fi-bsw-kefka: [DMESG-FAIL][80] ([i915#1982]) -> [DMESG-WARN][81] ([i915#1982] / [i915#3457])
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bsw-kefka/igt@[email protected]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bsw-kefka/igt@[email protected]
* igt@i915_selftest@live@mman:
- fi-bwr-2160: [DMESG-FAIL][82] ([i915#3457]) -> [DMESG-WARN][83] ([i915#3457])
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-bwr-2160/igt@i915_selftest@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-bwr-2160/igt@i915_selftest@[email protected]
- fi-kbl-r: [DMESG-WARN][84] ([i915#3457]) -> [DMESG-FAIL][85] ([i915#3457])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-r/igt@i915_selftest@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-r/igt@i915_selftest@[email protected]
* igt@runner@aborted:
- fi-tgl-y: [FAIL][86] ([i915#1436] / [i915#2966]) -> [FAIL][87] ([i915#1602])
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-tgl-y/igt@[email protected]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-tgl-y/igt@[email protected]
- fi-skl-6600u: [FAIL][88] ([i915#1436] / [i915#3363]) -> [FAIL][89] ([i915#2283] / [i915#3363])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-skl-6600u/igt@[email protected]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-skl-6600u/igt@[email protected]
- fi-cfl-8109u: [FAIL][90] ([i915#3363]) -> [FAIL][91] ([i915#2426] / [i915#3363])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cfl-8109u/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cfl-8109u/igt@[email protected]
- fi-icl-u2: [FAIL][92] ([i915#2426] / [i915#2782] / [i915#3363]) -> [FAIL][93] ([i915#2283] / [i915#3363])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-icl-u2/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-icl-u2/igt@[email protected]
- fi-glk-dsi: [FAIL][94] ([i915#2426] / [i915#3363] / [k.org#202321]) -> [FAIL][95] ([i915#1814] / [i915#3363] / [k.org#202321])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-glk-dsi/igt@[email protected]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-glk-dsi/igt@[email protected]
- fi-kbl-soraka: [FAIL][96] ([i915#1436] / [i915#3363]) -> [FAIL][97] ([i915#2292] / [i915#3363] / [k.org#204565])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-kbl-soraka/igt@[email protected]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-kbl-soraka/igt@[email protected]
- fi-cml-u2: [FAIL][98] ([i915#3363]) -> [FAIL][99] ([i915#1602] / [i915#2283] / [i915#3363])
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cml-u2/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cml-u2/igt@[email protected]
- fi-cml-s: [FAIL][100] ([i915#3363]) -> [FAIL][101] ([i915#1602] / [i915#2283] / [i915#3363])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-cml-s/igt@[email protected]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-cml-s/igt@[email protected]
- fi-icl-y: [FAIL][102] ([i915#2782]) -> [FAIL][103] ([i915#1814])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10068/fi-icl-y/igt@[email protected]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/fi-icl-y/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[i915#1222]: https://gitlab.freedesktop.org/drm/intel/issues/1222
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#165]: https://gitlab.freedesktop.org/drm/intel/issues/165
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2283]: https://gitlab.freedesktop.org/drm/intel/issues/2283
[i915#2292]: https://gitlab.freedesktop.org/drm/intel/issues/2292
[i915#2405]: https://gitlab.freedesktop.org/drm/intel/issues/2405
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#2927]: https://gitlab.freedesktop.org/drm/intel/issues/2927
[i915#2966]: https://gitlab.freedesktop.org/drm/intel/issues/2966
[i915#3177]: https://gitlab.freedesktop.org/drm/intel/issues/3177
[i915#3276]: https://gitlab.freedesktop.org/drm/intel/issues/3276
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#3457]: https://gitlab.freedesktop.org/drm/intel/issues/3457
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
[k.org#204565]: https://bugzilla.kernel.org/show_bug.cgi?id=204565
[k.org#205379]: https://bugzilla.kernel.org/show_bug.cgi?id=205379
Participating hosts (48 -> 42)
------------------------------
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-skl-guc fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_10068 -> Patchwork_20100
CI-20190529: 20190529
CI_DRM_10068: f71e8fae425cfb4e06a68874bced2fb728638d2a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6082: 355269577baef0c5d8114e8851acaeac657e4fe6 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_20100: bd0a5cd14b4e85ee4083a9c089b38813a6724366 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
bd0a5cd14b4e drm/i915/lmem: Verify checks for lmem residency 1bdd626f1990 drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend 1cd13783b35c drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem 7dc5b6bf9897 drm/i915/ttm: Embed a ttm buffer object in the i915 gem object 08fe6c5181ab drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers. e148e51b2187 drm/i915: Don't free shared locks while shared7c8e78644333 drm/i915: Untangle the vma pages_mutex
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20100/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
In reply to Thomas HellströmAm 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 28 lines · Christian König
Quoted 26 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 23 lines · Christian König
Quoted 21 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 19 lines
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar for system swapping. Do I understand you correctly that you want me to add a call to
eviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both cases.Hmm. I can only see it called from
ttm_mem_evict_first()which is not in the swapping path? Or do I miss something?
Mhm, looks like my recollection was wrong. We should probably move the call into the ttm_bo_evict_swapout_allowable() function.
Christian.
Quoted 7 lines
Thanks,
Thomas
Thomas Hellström
reviewerRe: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Quoted 60 lines · Christian König
Am 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 59 lines · Christian König
Quoted 57 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 42 lines · Christian König
Quoted 40 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 38 lines
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 and LRU list manipulation.Initially we support only LMEM and SYSTEM memory, but SYSTEM
(which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system
region
over to the TTM system memory type in upcoming patches.We set up GPU bindings directly both from LMEM and from the system
region,
as there is no need to use the legacyTTM_TTmemory type. We reserve
that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory
buffer
objects and to refuse swapping of some objects:
Unfortunately i915
gem
still relies heavily on short-term object pinning, and we've
chosen to
keep short-term-pinned buffer objects on the TTM 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.Quoted 8 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar
for system swapping. Do I understand you correctly that you want me
to add a call toeviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both cases.
Quoted 7 lines
Quoted 3 lines
Hmm. I can only see it called from
ttm_mem_evict_first()which is not
in the swapping path? Or do I miss something?Mhm, looks like my recollection was wrong. We should probably move the
call into thettm_bo_evict_swapout_allowable()function.
Yes, I think we also need a convention whether it's called dma_resv locked or not, since the helper accesses bo->mem, which should really only be done under reservation. At the same point, there is value in calling this function while holding the LRU lock.
Also, I wonder whether implementations of this callback might encounter unexpected data when called from the swapout path, because at least the helper assumes it not in system memory, since it is accessing bo-
Quoted 1 line
mem.start.
So unless we use a separate callback for swapout, there's some auditing to be done.
Pls let me know what you think.
Thanks,
Thomas
Quoted 11 lines
Christian.
Quoted 7 lines
Thanks,
Thomas
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Am 12.05.21 um 09:05 schrieb Thomas Hellström:
Quoted 58 lines · Christian König
Quoted 57 lines
Am 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 56 lines · Christian König
Quoted 43 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 41 lines · Christian König
Quoted 40 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 22 lines
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 and LRU list manipulation.Initially we support only LMEM and SYSTEM memory, but SYSTEM
(which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system
region
over to the TTM system memory type in upcoming patches.We set up GPU bindings directly both from LMEM and from the system
region,
as there is no need to use the legacyTTM_TTmemory type. We reserve
that for future porting of GGTT bindings to TTM.Quoted 16 lines
There are some changes to TTM to allow for purging system memory
buffer
objects and to refuse swapping of some objects:
Unfortunately i915
gem
still relies heavily on short-term object pinning, and we've
chosen to
keep short-term-pinned buffer objects on the TTM 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.Well just use the
eviction_valuableinterface for this.Quoted 9 lines
Quoted 6 lines
Yes, we do that for vram/lmem eviction, but we have nothing similar
for system swapping. Do I understand you correctly that you want me
to add a call toeviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both cases.Hmm. I can only see it called from
ttm_mem_evict_first()which is not
in the swapping path? Or do I miss something?
Quoted 7 lines
Quoted 3 lines
Mhm, looks like my recollection was wrong. We should probably move the
call into thettm_bo_evict_swapout_allowable()function.Yes, I think we also need a convention whether it's called
dma_resvlocked or not, since the helper accessesbo->mem, which should really only be done under reservation. At the same point, there is value in calling this function while holding the LRU lock.
You actually need to call it while holding the lock because eviction otherwise ends up in an endless loop.
Trying to fix that for years, but so far no luck with that.
Quoted 6 lines
Also, I wonder whether implementations of this callback might encounter unexpected data when called from the swapout path, because at least the helper assumes it not in system memory, since it is accessing bo-
Quoted 1 line
mem.start.
So unless we use a separate callback for swapout, there's some auditing to be done.
Please audit the existing callbacks and move the callback into the function after doing that.
Thanks,
Christian.
Quoted 16 lines
Pls let me know what you think.
Thanks,
ThomasQuoted 8 lines
Christian.
Quoted 6 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 7/7] drm/i915/lmem: Verify checks for lmem residency
In reply to Thomas HellströmQuoted 105 lines · 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 <[email protected]>--- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 42 +++++++++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_object.c | 29 ++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++ 4 files changed, 75 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +1
-1@@ -11615,7 +11615,7 @@ intel_user_framebuffer_create(struct drm_device *dev,/* object is backed with LMEM for discrete */ i915 =to_i915 (obj->base.dev); -if (HAS_LMEM (i915) && !i915_gem_object_is_lmem (obj)) { +if (HAS_LMEM (i915) && !i915_gem_object_validates_to_lmem (obj)) {/* object is "remote", not in local memory */ i915_gem_object_put (obj);return ERR_PTR (-EREMOTE );drivers/gpu/drm/i915/gem/i915_gem_lmem.c +41
-1@@ -23,10 +23,50 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,return io_mapping_map_wc (&obj->mm.region->iomap, offset, size); } +/** +* i915_gem_object_validates_to_lmem - Whether the object is resident in +* lmem when pages are present. +* @obj: The object to check. +* +* Migratable objects residency may change from under us if the object is +* not pinned or locked. This function is intended to be used to check whether +* the object can only reside in lmem when pages are present. +* +* Return: Whether the object is always resident in lmem when pages are +* present. +*/ +bool i915_gem_object_validates_to_lmem (struct drm_i915_gem_object *obj) +{ +struct intel_memory_region *mr =READ_ONCE (obj->mm.region); + +return !i915_gem_object_migratable (obj) && + mr && (mr->type ==INTEL_MEMORY_LOCAL || + mr->type ==INTEL_MEMORY_STOLEN_LOCAL ); +} + +/** +* i915_gem_object_is_lmem - Whether the object is resident in +* lmem +* @obj: The object to check. +* +* Even if an object is allowed to migrate and change memory region, +* this function checks whether it will always be present in lmem when +* valid *or* if that's not the case, whether it's currently resident in lmem. +* For migratable and evictable objects, the latter only makes sense when +* the object is locked. +* +* Return: Whether the object migratable but resident in lmem, or not +* migratable and will be present in lmem when valid. +*/ bool i915_gem_object_is_lmem (struct drm_i915_gem_object *obj) { -struct intel_memory_region *mr = obj->mm.region; +struct intel_memory_region *mr =READ_ONCE (obj->mm.region); +#ifdef CONFIG_LOCKDEP +if (i915_gem_object_migratable (obj) && +i915_gem_object_evictable (obj)) +assert_object_held (obj); +#endif return mr && (mr->type ==INTEL_MEMORY_LOCAL || mr->type ==INTEL_MEMORY_STOLEN_LOCAL ); }drivers/gpu/drm/i915/gem/i915_gem_object.c +15
-0@@ -458,6 +458,35 @@ bool i915_gem_object_evictable(struct drm_i915_gem_object *obj)return pin_count ==0 ; } +/** +* i915_gem_object_migratable - Whether the object is migratable out of the +* current region. +* @obj: Pointer to the object. +* +* Return: Whether the object is allowed to be resident in other +* regions than the current while pages are present. +*/ +bool i915_gem_object_migratable (struct drm_i915_gem_object *obj) +{ +struct intel_memory_region *mr =READ_ONCE (obj->mm.region); +struct intel_memory_region *placement; +int i; + +if (!mr)
drivers/gpu/drm/i915/gem/i915_gem_object.c bool i915_gem_object_evictable(struct drm_i915_gem_object *obj) · line 485
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +10
-0+return false; + +if (!obj->mm.n_placements) +return false; + +for (i =0 ; i < obj->mm.n_placements; ++i) { + placement = obj->mm.placements[i]; +if (placement != mr) +return true; + }
Maybe this can simply be:
return obj->mm.n_placements > 1;
?
The uAPI guarantees that mm.placements are each unique.
Quoted 25 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +4
-0+ +return false; +} +void i915_gem_init__objects (struct drm_i915_private *i915) {INIT_WORK (&i915->mm.free_work, __i915_gem_free_work);drivers/gpu/drm/i915/gem/i915_gem_object.h +4
-1@@ -596,6 +596,10 @@ void __i915_gem_free_object(struct drm_i915_gem_object *obj);bool i915_gem_object_evictable (struct drm_i915_gem_object *obj); +bool i915_gem_object_migratable (struct drm_i915_gem_object *obj); + +bool i915_gem_object_validates_to_lmem (struct drm_i915_gem_object *obj); +#ifdef CONFIG_MMU_NOTIFIER static inline bool i915_gem_object_is_userptr (struct drm_i915_gem_object *obj) --2.30.2
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.
In reply to Thomas HellströmQuoted 117 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
In order to support some of the mock region-related selftests, we need to be able to initialize the TTM range-manager standalone without a struct
ttm_device. Add two functions to allow that to the TTM api.Finally modify the mock region selftests somewhat to account for a fragmenting manager.
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 58 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 6 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 120 --- drivers/gpu/drm/i915/gem/i915_gem_region.h | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 9 +- drivers/gpu/drm/i915/gt/intel_gt.c | 2 - drivers/gpu/drm/i915/gt/intel_region_lmem.c | 27 +- drivers/gpu/drm/i915/i915_buddy.c | 435 ---------- drivers/gpu/drm/i915/i915_buddy.h | 131 --- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_globals.c | 1 - drivers/gpu/drm/i915/i915_globals.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.c | 70 ++ drivers/gpu/drm/i915/i915_scatterlist.h | 35 + drivers/gpu/drm/i915/intel_memory_region.c | 180 ++-- drivers/gpu/drm/i915/intel_memory_region.h | 44 +- drivers/gpu/drm/i915/intel_region_ttm.c | 246 ++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 29 + drivers/gpu/drm/i915/selftests/i915_buddy.c | 789 ------------------ .../drm/i915/selftests/i915_mock_selftests.h | 1 - .../drm/i915/selftests/intel_memory_region.c | 133 +-- drivers/gpu/drm/i915/selftests/mock_region.c | 51 +- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- include/drm/ttm/ttm_bo_driver.h | 23 + 31 files changed, 715 insertions(+), 1771 deletions(-) delete mode 100644 drivers/gpu/drm/i915/i915_buddy.c delete mode 100644 drivers/gpu/drm/i915/i915_buddy.h create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.c create mode 100644 drivers/gpu/drm/i915/intel_region_ttm.h delete mode 100644 drivers/gpu/drm/i915/selftests/i915_buddy.cdrivers/gpu/drm/i915/Kconfig +1
-0@@ -26,6 +26,7 @@ config DRM_I915 select SND_HDA_I915 if SND_HDA_CORE select CEC_CORE if CEC_NOTIFIER select VMAP_PFN + select DRM_TTM help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/Makefile +1
-1@@ -50,6 +50,7 @@ i915-y += i915_drv.o \ intel_memory_region.o \ intel_pch.o \ intel_pm.o \ + intel_region_ttm.o \ intel_runtime_pm.o \ intel_sideband.o \ intel_step.o \@@ -160,7 +161,6 @@ gem-y += \ i915-y += \ $(gem-y) \ i915_active.o \ - i915_buddy.o \ i915_cmd_parser.o \ i915_gem_evict.o \ i915_gem_gtt.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +21
-0@@ -4,16 +4,70 @@*/ #include "intel_memory_region.h" +#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" +static void lmem_put_pages (struct drm_i915_gem_object *obj, +struct sg_table *pages) +{ +intel_region_ttm_node_free (obj->mm.region, obj->mm.st_mm_node); + obj->mm.dirty = false; +sg_free_table (pages); +kfree (pages); +} + +static int lmem_get_pages (struct drm_i915_gem_object *obj) +{ +unsigned int flags; +struct sg_table *pages; + + flags =I915_ALLOC_MIN_PAGE_SIZE ; +if (obj->flags &I915_BO_ALLOC_CONTIGUOUS ) + flags |=I915_ALLOC_CONTIGUOUS ; + + obj->mm.st_mm_node = intel_region_ttm_node_alloc(obj->mm.region, + obj->base.size,
drivers/gpu/drm/i915/gem/i915_gem_lmem.c line 41
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +10
-0+ flags); +if (IS_ERR (obj->mm.st_mm_node)) +return PTR_ERR (obj->mm.st_mm_node); + +/* Range manager is always contigous */ +if (obj->mm.region->is_range_manager) + obj->flags |=I915_BO_ALLOC_CONTIGUOUS ; + pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); +if (IS_ERR (pages)) +return PTR_ERR (pages);
error unwind?
Quoted 22 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +22
-0+ +__i915_gem_object_set_pages (obj, pages, +i915_sg_dma_page_sizes (pages->sgl)); + +if (obj->flags &I915_BO_ALLOC_CPU_CLEAR ) { +void __iomem *vaddr = +i915_gem_object_lmem_io_map (obj,0 , obj->base.size); + +if (!vaddr) { +struct sg_table *pages = +__i915_gem_object_unset_pages (obj); + +if (!IS_ERR_OR_NULL (pages)) +lmem_put_pages (obj, pages); + } + +memset_io (vaddr,0 , obj->base.size); +io_mapping_unmap (vaddr); + } + +return 0 ; +}
<snip>
Quoted 12 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +12
-0+/** +* i915_sg_dma_page_sizes - Calculate page sizes from a scatterlist +* @sg: The scatterlist from which to calculate page sizes +* +* Return: a value with bits sets for relevant page sizes. +*/ +static inline unsigned int i915_sg_dma_page_sizes (struct scatterlist *sg) +{ +unsigned int page_sizes; + + page_sizes =0 ; +while (sg) {
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +10
-0+GEM_BUG_ON (sg->offset); +GEM_BUG_ON (!IS_ALIGNED (sg->dma_length,PAGE_SIZE )); + page_sizes |= sg->dma_length; + sg =__sg_next (sg); + } + +/* +* Is this necessary to support building large GPU pages from +* even larger segments? +*/
We just need to know the above sg page_sizes, which is the mask of sg->dma_length for each sg. Later in __i915_gem_object_set_pages() we use this to determine the potential GPU page sizes for the object, depending on what the device supports. So the below stuff shouldn't be needed. Also we can just use i915_sg_page_sizes() here.
Although since we do have control over building the sg, we should ideally just pass in the sg_page_sizes to say i915_sg_from_mm_node() for it to fill in, instead of looping over the whole thing again, but that can be something to do in the future.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
In reply to Thomas HellströmQuoted 99 lines · Thomas Hellström
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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 <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 83 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 126 +++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 9 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 18 + drivers/gpu/drm/i915/gem/i915_gem_region.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 534 ++++++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ drivers/gpu/drm/i915/gt/intel_region_lmem.c | 3 +- drivers/gpu/drm/i915/i915_gem.c | 5 +- drivers/gpu/drm/i915/intel_memory_region.c | 1 - drivers/gpu/drm/i915/intel_memory_region.h | 1 - drivers/gpu/drm/i915/intel_region_ttm.c | 5 +- drivers/gpu/drm/i915/intel_region_ttm.h | 7 +- drivers/gpu/drm/ttm/ttm_bo.c | 12 + include/drm/ttm/ttm_device.h | 9 + 17 files changed, 733 insertions(+), 140 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm.o \ gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0
-28@@ -4,73 +4,10 @@*/ #include "intel_memory_region.h" -#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" -static void lmem_put_pages (struct drm_i915_gem_object *obj, -struct sg_table *pages) -{ -intel_region_ttm_node_free (obj->mm.region, obj->mm.st_mm_node); - obj->mm.dirty = false; -sg_free_table (pages); -kfree (pages); -} - -static int lmem_get_pages (struct drm_i915_gem_object *obj) -{ -unsigned int flags; -struct sg_table *pages; - - flags =I915_ALLOC_MIN_PAGE_SIZE ; -if (obj->flags &I915_BO_ALLOC_CONTIGUOUS ) - flags |=I915_ALLOC_CONTIGUOUS ; - - obj->mm.st_mm_node =intel_region_ttm_node_alloc (obj->mm.region, - obj->base.size, - flags); -if (IS_ERR (obj->mm.st_mm_node)) -return PTR_ERR (obj->mm.st_mm_node); - -/* Range manager is always contigous */ -if (obj->mm.region->is_range_manager) - obj->flags |=I915_BO_ALLOC_CONTIGUOUS ;
drivers/gpu/drm/i915/gem/i915_gem_lmem.c line 48
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0
-10- pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); -if (IS_ERR (pages)) -return PTR_ERR (pages); - -__i915_gem_object_set_pages (obj, pages, -i915_sg_dma_page_sizes (pages->sgl)); - -if (obj->flags &I915_BO_ALLOC_CPU_CLEAR ) { -void __iomem *vaddr = -i915_gem_object_lmem_io_map (obj,0 , obj->base.size);
Where did the object clearing go? I'm not seeing it in the new code.
<snip>
Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +6
-0+ +static struct sg_table * +i915_ttm_resource_get_st (struct drm_i915_gem_object *obj, +struct ttm_resource *res) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj);
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +10
-0+struct ttm_resource_manager *man = +ttm_manager_type (bo->bdev, res->mem_type); +struct sg_table *st; + +if (man->use_tt) +return i915_ttm_tt_get_st (bo->ttm); + + st =kzalloc (sizeof (*st),GFP_KERNEL ); +if (!st) +return ERR_PTR (-ENOMEM );
The st is already allocated below.
<snip>
Quoted 29 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +29
-0+ +/** +* __i915_gem_ttm_object_init - Initialize a ttm-backed i915 gem object +* @mem: The initial memory region for the object. +* @obj: The gem object. +* @size: Object size in bytes. +* @flags: gem object flags. +* +* Return: 0 on success, negative error code on failure. +*/ +int __i915_gem_ttm_object_init (struct intel_memory_region *mem, +struct drm_i915_gem_object *obj, +resource_size_t size, +unsigned int flags) +{ +static struct lock_class_key lock_class; +struct drm_i915_private *i915 = mem->i915; +size_t alignment =0 ; +int ret; + +/* Adjust alignment to GPU- and CPU huge page sizes. */ + +if (mem->is_range_manager) { +if (size >=SZ_1G ) + alignment =SZ_1G >>PAGE_SHIFT ; +else if (size >=SZ_2M ) + alignment =SZ_2M >>PAGE_SHIFT ; +else if (size >=SZ_64K ) + alignment =SZ_64K >>PAGE_SHIFT ;
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +10
-0+ } + +drm_gem_private_object_init (&i915->drm, &obj->base, size); +i915_gem_object_init (obj, &i915_gem_ttm_obj_ops, &lock_class, flags); +i915_gem_object_init_memory_region (obj, mem); +i915_gem_object_make_unshrinkable (obj); + + ret =ttm_bo_init (&i915->bdev,i915_gem_to_ttm (obj), size, + ttm_bo_type_kernel, &i915_sys_placement, alignment, + true,NULL ,NULL , i915_ttm_bo_destroy);
Handle the error?
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +7
-0+ + obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; + +i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); + +return 0 ; +}
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Hi, Matthew,
Thanks for reviewing!
Quoted 103 lines · Matthew Auld
Quoted 101 lines · Thomas Hellström
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 and LRU list manipulation.
Initially we support only LMEM and SYSTEM memory, but SYSTEM (which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem system region over to the TTM system memory type in upcoming patches.
We set up GPU bindings directly both from LMEM and from the system region, as there is no need to use the legacy
TTM_TTmemory type. We reserve that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system memory buffer objects and to refuse swapping of some objects: Unfortunately i915 gem still relies heavily on short-term object pinning, and we've chosen to keep short-term-pinned buffer objects on the TTM 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 <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 83 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 126 +++-- drivers/gpu/drm/i915/gem/i915_gem_object.h | 9 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 18 + drivers/gpu/drm/i915/gem/i915_gem_region.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 534 ++++++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ drivers/gpu/drm/i915/gt/intel_region_lmem.c | 3 +- drivers/gpu/drm/i915/i915_gem.c | 5 +- drivers/gpu/drm/i915/intel_memory_region.c | 1 - drivers/gpu/drm/i915/intel_memory_region.h | 1 - drivers/gpu/drm/i915/intel_region_ttm.c | 5 +- drivers/gpu/drm/i915/intel_region_ttm.h | 7 +- drivers/gpu/drm/ttm/ttm_bo.c | 12 + include/drm/ttm/ttm_device.h | 9 + 17 files changed, 733 insertions(+), 140 deletions(-)create mode 100644
drivers/gpu/drm/i915/gem/i915_gem_ttm.ccreate mode 100644drivers/gpu/drm/i915/gem/i915_gem_ttm.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm.o \ gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0
-31@@ -4,73 +4,10 @@*/ #include "intel_memory_region.h" -#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" -static void lmem_put_pages (struct drm_i915_gem_object *obj, -struct sg_table *pages) -{ -intel_region_ttm_node_free (obj->mm.region, obj->mm.st_mm_node); - obj->mm.dirty = false; -sg_free_table (pages); -kfree (pages); -} - -static int lmem_get_pages (struct drm_i915_gem_object *obj) -{ -unsigned int flags; -struct sg_table *pages; - - flags =I915_ALLOC_MIN_PAGE_SIZE ; -if (obj->flags &I915_BO_ALLOC_CONTIGUOUS ) - flags |=I915_ALLOC_CONTIGUOUS ; - - obj->mm.st_mm_node =intel_region_ttm_node_alloc (obj->mm.region, - obj->base.size, - flags); -if (IS_ERR (obj->mm.st_mm_node)) -return PTR_ERR (obj->mm.st_mm_node); - -/* Range manager is always contigous */ -if (obj->mm.region->is_range_manager) - obj->flags |=I915_BO_ALLOC_CONTIGUOUS ; - pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); -if (IS_ERR (pages)) -return PTR_ERR (pages);
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c line 48
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0
-7- -__i915_gem_object_set_pages (obj, pages, -i915_sg_dma_page_sizes (pages->sgl)); - -if (obj->flags &I915_BO_ALLOC_CPU_CLEAR ) { -void __iomem *vaddr = -i915_gem_object_lmem_io_map (obj,0 , obj->base.size);Where did the object clearing go? I'm not seeing it in the new code.
It's in the move callback with TTM. If the object had not been previously initialized, the copying is skipped, and a fill is done instead.
Quoted 12 lines
<snip>
Quoted 9 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +9
-0+ +static struct sg_table * +i915_ttm_resource_get_st (struct drm_i915_gem_object *obj, +struct ttm_resource *res) +{ +struct ttm_buffer_object *bo =i915_gem_to_ttm (obj); +struct ttm_resource_manager *man = +ttm_manager_type (bo->bdev, res->mem_type); +struct sg_table *st;
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +7
-0+ +if (man->use_tt) +return i915_ttm_tt_get_st (bo->ttm); + + st =kzalloc (sizeof (*st),GFP_KERNEL ); +if (!st) +return ERR_PTR (-ENOMEM );The st is already allocated below.
Will fix.
Quoted 35 lines
<snip>
Quoted 32 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +32
-0+ +/** +* __i915_gem_ttm_object_init - Initialize a ttm-backed i915 gem object +* @mem: The initial memory region for the object. +* @obj: The gem object. +* @size: Object size in bytes. +* @flags: gem object flags. +* +* Return: 0 on success, negative error code on failure. +*/ +int __i915_gem_ttm_object_init (struct intel_memory_region *mem, +struct drm_i915_gem_object *obj, +resource_size_t size, +unsigned int flags) +{ +static struct lock_class_key lock_class; +struct drm_i915_private *i915 = mem->i915; +size_t alignment =0 ; +int ret; + +/* Adjust alignment to GPU- and CPU huge page sizes. */ + +if (mem->is_range_manager) { +if (size >=SZ_1G ) + alignment =SZ_1G >>PAGE_SHIFT ; +else if (size >=SZ_2M ) + alignment =SZ_2M >>PAGE_SHIFT ; +else if (size >=SZ_64K ) + alignment =SZ_64K >>PAGE_SHIFT ; + } + +drm_gem_private_object_init (&i915->drm, &obj->base, size);
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +7
-0+i915_gem_object_init (obj, &i915_gem_ttm_obj_ops, &lock_class, flags); +i915_gem_object_init_memory_region (obj, mem); +i915_gem_object_make_unshrinkable (obj); + + ret =ttm_bo_init (&i915->bdev,i915_gem_to_ttm (obj), size, + ttm_bo_type_kernel, &i915_sys_placement, alignment, + true,NULL ,NULL , i915_ttm_bo_destroy);Handle the error?
Ugh. Will fix
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +7
-0+ + obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; + +i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); + +return 0 ; +}
Thanks!
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
In reply to Christian KönigQuoted 96 lines · Christian König
Am 12.05.21 um 09:05 schrieb Thomas Hellström:
Quoted 73 lines · Christian König
Quoted 64 lines
Am 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 63 lines · Christian König
Quoted 62 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 48 lines · Christian König
Quoted 47 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 46 lines
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 and LRU list manipulation.Initially we support only LMEM and SYSTEM memory, but SYSTEM
(which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem
system
region
over to the TTM system memory type in upcoming patches.We set up GPU bindings directly both from LMEM and from the
system
region,
as there is no need to use the legacyTTM_TTmemory type.
We reserve
that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system
memory
buffer
objects and to refuse swapping of some objects:
Unfortunately i915
gem
still relies heavily on short-term object pinning, and we've
chosen to
keep short-term-pinned buffer objects on the TTM 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.Quoted 8 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar
for system swapping. Do I understand you correctly that you want me
to add a call toeviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both
cases.Quoted 8 lines
Quoted 4 lines
Hmm. I can only see it called from
ttm_mem_evict_first()which is
not
in the swapping path? Or do I miss something?Mhm, looks like my recollection was wrong. We should probably move
the
call into thettm_bo_evict_swapout_allowable()function.Quoted 6 lines
Yes, I think we also need a convention whether it's called
dma_resvlocked or not, since the helper accessesbo->mem, which should really
only be done under reservation. At the same point, there is value in
calling this function while holding the LRU lock.You actually need to call it while holding the lock because eviction otherwise ends up in an endless loop.
Trying to fix that for years, but so far no luck with that.
Quoted 9 lines
Also, I wonder whether implementations of this callback might encounter
unexpected data when called from the swapout path, because at least the
helper assumes it not in system memory, since it is accessing bo-Quoted 1 line
mem.start.
So unless we use a separate callback for swapout, there's some auditing
to be done.
Quoted 5 lines
Please audit the existing callbacks and move the callback into the function after doing that.
Thanks,
Christian.
Would it be OK if I also move the kref_get_unless_zero() to before ttm_bo_evict_swapout_allowable() to make the code less sensitive to surprises?
/Thomas
Quoted 18 lines
Quoted 17 lines
Pls let me know what you think.
Thanks,
ThomasQuoted 8 lines
Christian.
Quoted 6 lines
Thanks,
Thomas
Re: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Am 12.05.21 um 15:02 schrieb Thomas Hellström:
Quoted 94 lines · Christian König
Quoted 93 lines
Am 12.05.21 um 09:05 schrieb Thomas Hellström:
Quoted 72 lines · Christian König
Quoted 63 lines
Am 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 62 lines · Christian König
Quoted 61 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 48 lines · Christian König
Quoted 47 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 46 lines
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 and LRU list manipulation.Initially we support only LMEM and SYSTEM memory, but SYSTEM
(which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem
system
region
over to the TTM system memory type in upcoming patches.We set up GPU bindings directly both from LMEM and from the
system
region,
as there is no need to use the legacyTTM_TTmemory type.
We reserve
that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system
memory
buffer
objects and to refuse swapping of some objects:
Unfortunately i915
gem
still relies heavily on short-term object pinning, and we've
chosen to
keep short-term-pinned buffer objects on the TTM 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.Quoted 8 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar
for system swapping. Do I understand you correctly that you want me
to add a call toeviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both
cases.Quoted 8 lines
Quoted 4 lines
Hmm. I can only see it called from
ttm_mem_evict_first()which is
not
in the swapping path? Or do I miss something?Mhm, looks like my recollection was wrong. We should probably move
the
call into thettm_bo_evict_swapout_allowable()function.Quoted 6 lines
Yes, I think we also need a convention whether it's called
dma_resvlocked or not, since the helper accessesbo->mem, which should really
only be done under reservation. At the same point, there is value in
calling this function while holding the LRU lock.You actually need to call it while holding the lock because eviction otherwise ends up in an endless loop.
Trying to fix that for years, but so far no luck with that.
Quoted 9 lines
Also, I wonder whether implementations of this callback might encounter
unexpected data when called from the swapout path, because at least the
helper assumes it not in system memory, since it is accessing bo-Quoted 1 line
mem.start.
So unless we use a separate callback for swapout, there's some auditing
to be done.
Quoted 8 lines
Quoted 5 lines
Please audit the existing callbacks and move the callback into the function after doing that.
Thanks,
Christian.Would it be OK if I also move the
kref_get_unless_zero()to beforettm_bo_evict_swapout_allowable()to make the code less sensitive to surprises?
No, because then you need a kref_put while holding the spinlock which is not allowed.
Christian.
Quoted 19 lines
/Thomas
Quoted 14 lines
Quoted 14 lines
Pls let me know what you think.
Thanks,
ThomasQuoted 8 lines
Christian.
Quoted 6 lines
Thanks,
Thomas
Thomas Hellström
reviewerRe: [PATCH 6/7] drm/i915/ttm, drm/ttm: Introduce a TTM i915 gem object backend
Quoted 100 lines · Christian König
Am 12.05.21 um 15:02 schrieb Thomas Hellström:
Quoted 99 lines · Christian König
Quoted 98 lines
Am 12.05.21 um 09:05 schrieb Thomas Hellström:
Quoted 72 lines · Christian König
Quoted 63 lines
Am 11.05.21 um 16:28 schrieb Thomas Hellström:
Quoted 62 lines · Christian König
Quoted 61 lines
Am 11.05.21 um 16:06 schrieb Thomas Hellström (Intel):
Quoted 48 lines · Christian König
Quoted 47 lines
Am 11.05.21 um 15:25 schrieb Thomas Hellström:
Quoted 46 lines
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 and LRU list manipulation.Initially we support only LMEM and SYSTEM memory, but SYSTEM
(which in this case means evicted LMEM objects) is not visible to i915 GEM yet. The plan is to move the i915 gem
system
region
over to the TTM system memory type in upcoming patches.We set up GPU bindings directly both from LMEM and from the
system
region,
as there is no need to use the legacyTTM_TTmemory type.
We reserve
that for future porting of GGTT bindings to TTM.There are some changes to TTM to allow for purging system
memory
buffer
objects and to refuse swapping of some objects:
Unfortunately i915
gem
still relies heavily on short-term object pinning, and we've
chosen to
keep short-term-pinned buffer objects on the TTM 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.Quoted 8 lines
Quoted 1 line
Well just use the
eviction_valuableinterface for this.Yes, we do that for vram/lmem eviction, but we have nothing similar
for system swapping. Do I understand you correctly that you want me
to add a call toeviction_valuable()also for that instead ofswap_possible()?You should already have that.
eviction_valuableis called in both
cases.Quoted 8 lines
Quoted 4 lines
Hmm. I can only see it called from
ttm_mem_evict_first()which is
not
in the swapping path? Or do I miss something?Mhm, looks like my recollection was wrong. We should probably move
the
call into thettm_bo_evict_swapout_allowable()function.Quoted 6 lines
Yes, I think we also need a convention whether it's called
dma_resvlocked or not, since the helper accessesbo->mem, which should really
only be done under reservation. At the same point, there is value in
calling this function while holding the LRU lock.You actually need to call it while holding the lock because eviction otherwise ends up in an endless loop.
Trying to fix that for years, but so far no luck with that.
Quoted 9 lines
Also, I wonder whether implementations of this callback might encounter
unexpected data when called from the swapout path, because at least the
helper assumes it not in system memory, since it is accessing bo-Quoted 1 line
mem.start.
So unless we use a separate callback for swapout, there's some auditing
to be done.Please audit the existing callbacks and move the callback into the function after doing that.
Thanks,
Christian.
Quoted 7 lines
Quoted 3 lines
Would it be OK if I also move the
kref_get_unless_zero()to beforettm_bo_evict_swapout_allowable()to make the code less sensitive to surprises?No, because then you need a
kref_putwhile holding the spinlock which is not allowed.Christian.
Ugh. yes, you're right.
/Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.
In reply to Matthew AuldQuoted 194 lines · Matthew Auld
Quoted 128 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
In order to support some of the mock region-related selftests, we need to
be able to initialize the TTM range-manager standalone without a structttm_device. Add two functions to allow that to the TTM api.Finally modify the mock region selftests somewhat to account for a fragmenting manager.
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>---
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 58 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 6 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 120 --- drivers/gpu/drm/i915/gem/i915_gem_region.h | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 9 +- drivers/gpu/drm/i915/gt/intel_gt.c | 2 - drivers/gpu/drm/i915/gt/intel_region_lmem.c | 27 +- drivers/gpu/drm/i915/i915_buddy.c | 435 ---------- drivers/gpu/drm/i915/i915_buddy.h | 131 ---drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/i915_gem.c | 1 +drivers/gpu/drm/i915/i915_globals.c | 1 - drivers/gpu/drm/i915/i915_globals.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.c | 70 ++ drivers/gpu/drm/i915/i915_scatterlist.h | 35 + drivers/gpu/drm/i915/intel_memory_region.c | 180 ++-- drivers/gpu/drm/i915/intel_memory_region.h | 44 +- drivers/gpu/drm/i915/intel_region_ttm.c | 246 ++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 29 + drivers/gpu/drm/i915/selftests/i915_buddy.c | 789 --------------
----.../drm/i915/selftests/i915_mock_selftests.h | 1 - .../drm/i915/selftests/intel_memory_region.c | 133 +-- drivers/gpu/drm/i915/selftests/mock_region.c | 51 +- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- include/drm/ttm/ttm_bo_driver.h | 23 + 31 files changed, 715 insertions(+), 1771 deletions(-)delete mode 100644
drivers/gpu/drm/i915/i915_buddy.cdelete mode 100644drivers/gpu/drm/i915/i915_buddy.hcreate mode 100644drivers/gpu/drm/i915/intel_region_ttm.ccreate mode 100644drivers/gpu/drm/i915/intel_region_ttm.hdelete mode 100644drivers/gpu/drm/i915/selftests/i915_buddy.cdrivers/gpu/drm/i915/Kconfig +0
-0@@ -26,6 +26,7 @@ config DRM_I915select
SND_HDA_I915ifSND_HDA_CORE
selectCEC_COREifCEC_NOTIFIER
selectVMAP_PFN
+ selectDRM_TTM
help
Choose this option if you have a system that has "Intel Graphics
Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/Makefile +1
-1@@ -50,6 +50,7 @@ i915-y += i915_drv.o \ intel_memory_region.o \ intel_pch.o \ intel_pm.o \ + intel_region_ttm.o \ intel_runtime_pm.o \ intel_sideband.o \ intel_step.o \@@ -160,7 +161,6 @@ gem-y += \ i915-y += \ $(gem-y) \ i915_active.o \ - i915_buddy.o \ i915_cmd_parser.o \ i915_gem_evict.o \ i915_gem_gtt.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +22
-0@@ -4,16 +4,70 @@*/ #include "intel_memory_region.h" +#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" +static void lmem_put_pages (struct drm_i915_gem_object *obj, + struct sg_table *pages) +{ + intel_region_ttm_node_free(obj->mm.region, obj- >mm.st_mm_node); + obj->mm.dirty = false; + sg_free_table(pages); + kfree(pages); +} + +static int lmem_get_pages (struct drm_i915_gem_object *obj) +{ + unsigned int flags; + struct sg_table *pages; + + flags = I915_ALLOC_MIN_PAGE_SIZE; + if (obj->flags & I915_BO_ALLOC_CONTIGUOUS) + flags |= I915_ALLOC_CONTIGUOUS; + + obj->mm.st_mm_node = intel_region_ttm_node_alloc(obj- >mm.region, + obj- >base.size, + flags);drivers/gpu/drm/i915/gem/i915_gem_lmem.c line 45
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +9
-0+ if (IS_ERR(obj->mm.st_mm_node)) + return PTR_ERR(obj->mm.st_mm_node); + + /* Range manager is always contigous */ + if (obj->mm.region->is_range_manager) + obj->flags |= I915_BO_ALLOC_CONTIGUOUS; + pages = intel_region_ttm_node_to_st(obj->mm.region, obj- >mm.st_mm_node); + if (IS_ERR(pages)) + return PTR_ERR(pages);error unwind?
Quoted 24 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +22
-0+ + __i915_gem_object_set_pages(obj, pages, + i915_sg_dma_page_sizes(pages- >sgl)); + + if (obj->flags & I915_BO_ALLOC_CPU_CLEAR) { + void __iomem *vaddr = + i915_gem_object_lmem_io_map(obj, 0, obj- >base.size); + + if (!vaddr) { + struct sg_table *pages = + __i915_gem_object_unset_pages(obj); + + if (!IS_ERR_OR_NULL(pages)) + lmem_put_pages(obj, pages); + } + + memset_io(vaddr, 0, obj->base.size); + io_mapping_unmap(vaddr); + } + + return 0; +}<snip>
Quoted 24 lines
+/**
+ *i915_sg_dma_page_sizes- Calculate page sizes from a scatterlist
+ * @sg: The scatterlist from which to calculate page sizes
+ *
+ * Return: a value with bits sets for relevant page sizes.
+ */
+static inline unsigned inti915_sg_dma_page_sizes(struct scatterlist *sg)drivers/gpu/drm/i915/gem/i915_gem_lmem.c +13
-0+{ + unsigned int page_sizes; + + page_sizes = 0; + while (sg) { + GEM_BUG_ON(sg->offset); + GEM_BUG_ON(!IS_ALIGNED(sg->dma_length, PAGE_SIZE)); + page_sizes |= sg->dma_length; + sg = __sg_next(sg); + } + + /* +* Is this necessary to support building large GPU pages from
+ * even larger segments?
Quoted 8 lines
Quoted 1 line
+ */
We just need to know the above sg
page_sizes, which is the mask ofsg->dma_lengthfor each sg. Later in__i915_gem_object_set_pages()we use this to determine the potential GPU page sizes for the object, depending on what the device supports. So the below stuff shouldn't be
needed. Also we can just usei915_sg_page_sizes()here.
I noticed that i915_sg_page_sizes() uses sg->length() instead of sg-
Quoted 1 line
dma_length(). That doesn't look like what we're after here. Do you
know if there is a reason for that?
Thanks,
Thomas
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH 3/7] drm/i915/ttm, drm/ttm: Initialize the ttm device and memory managers.
Quoted 211 lines · Thomas Hellström
Quoted 202 lines · Matthew Auld
Quoted 132 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
In order to support some of the mock region-related selftests, we need to
be able to initialize the TTM range-manager standalone without a structttm_device. Add two functions to allow that to the TTM api.Finally modify the mock region selftests somewhat to account for a
fragmenting manager.Cc: Christian König <[email protected]>
Signed-off-by: Thomas Hellström <[email protected]>
---
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 58 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 6 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_region.c | 120 --- drivers/gpu/drm/i915/gem/i915_gem_region.h | 4 - drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 +- drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 9 +- drivers/gpu/drm/i915/gt/intel_gt.c | 2 - drivers/gpu/drm/i915/gt/intel_region_lmem.c | 27 +- drivers/gpu/drm/i915/i915_buddy.c | 435 ---------- drivers/gpu/drm/i915/i915_buddy.h | 131 ---drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/i915_drv.h | 7 +- drivers/gpu/drm/i915/i915_gem.c | 1 +drivers/gpu/drm/i915/i915_globals.c | 1 - drivers/gpu/drm/i915/i915_globals.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.c | 70 ++ drivers/gpu/drm/i915/i915_scatterlist.h | 35 + drivers/gpu/drm/i915/intel_memory_region.c | 180 ++-- drivers/gpu/drm/i915/intel_memory_region.h | 44 +- drivers/gpu/drm/i915/intel_region_ttm.c | 246 ++++++ drivers/gpu/drm/i915/intel_region_ttm.h | 29 + drivers/gpu/drm/i915/selftests/i915_buddy.c | 789 ------------ --
----.../drm/i915/selftests/i915_mock_selftests.h | 1 - .../drm/i915/selftests/intel_memory_region.c | 133 +-- drivers/gpu/drm/i915/selftests/mock_region.c | 51 +- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- include/drm/ttm/ttm_bo_driver.h | 23 + 31 files changed, 715 insertions(+), 1771 deletions(-)delete mode 100644
drivers/gpu/drm/i915/i915_buddy.cdelete mode 100644drivers/gpu/drm/i915/i915_buddy.hcreate mode 100644drivers/gpu/drm/i915/intel_region_ttm.ccreate mode 100644drivers/gpu/drm/i915/intel_region_ttm.hdelete mode 100644drivers/gpu/drm/i915/selftests/i915_buddy.cdrivers/gpu/drm/i915/Kconfig +0
-0@@ -26,6 +26,7 @@ config DRM_I915select
SND_HDA_I915ifSND_HDA_CORE
selectCEC_COREifCEC_NOTIFIER
selectVMAP_PFN
+ selectDRM_TTM
help
Choose this option if you have a system that has "Intel Graphics
Media Accelerator" or "HD Graphics" integrated graphics,drivers/gpu/drm/i915/Makefile +1
-1@@ -50,6 +50,7 @@ i915-y += i915_drv.o \ intel_memory_region.o \ intel_pch.o \ intel_pm.o \ + intel_region_ttm.o \ intel_runtime_pm.o \ intel_sideband.o \ intel_step.o \@@ -160,7 +161,6 @@ gem-y += \ i915-y += \ $(gem-y) \ i915_active.o \ - i915_buddy.o \ i915_cmd_parser.o \ i915_gem_evict.o \ i915_gem_gtt.o \drivers/gpu/drm/i915/gem/i915_gem_lmem.c +22
-0@@ -4,16 +4,70 @@*/ #include "intel_memory_region.h" +#include "intel_region_ttm.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_lmem.h" #include "i915_drv.h" +static void lmem_put_pages (struct drm_i915_gem_object *obj, + struct sg_table *pages) +{ + intel_region_ttm_node_free(obj->mm.region, obj- > mm.st_mm_node); + obj->mm.dirty = false; + sg_free_table(pages); + kfree(pages); +} + +static int lmem_get_pages (struct drm_i915_gem_object *obj) +{ + unsigned int flags; + struct sg_table *pages; + + flags = I915_ALLOC_MIN_PAGE_SIZE; + if (obj->flags & I915_BO_ALLOC_CONTIGUOUS) + flags |= I915_ALLOC_CONTIGUOUS; + + obj->mm.st_mm_node = intel_region_ttm_node_alloc(obj- > mm.region, + obj- > base.size, + flags);drivers/gpu/drm/i915/gem/i915_gem_lmem.c line 45
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +9
-0+ if (IS_ERR(obj->mm.st_mm_node)) + return PTR_ERR(obj->mm.st_mm_node); + + /* Range manager is always contigous */ + if (obj->mm.region->is_range_manager) + obj->flags |= I915_BO_ALLOC_CONTIGUOUS; + pages = intel_region_ttm_node_to_st(obj->mm.region, obj- > mm.st_mm_node); + if (IS_ERR(pages)) + return PTR_ERR(pages);error unwind?
Quoted 25 lines
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +22
-0+ + __i915_gem_object_set_pages(obj, pages, + i915_sg_dma_page_sizes(pages- > sgl)); + + if (obj->flags & I915_BO_ALLOC_CPU_CLEAR) { + void __iomem *vaddr = + i915_gem_object_lmem_io_map(obj, 0, obj- > base.size); + + if (!vaddr) { + struct sg_table *pages = +__i915_gem_object_unset_pages (obj); + + if (!IS_ERR_OR_NULL(pages)) + lmem_put_pages(obj, pages); + } + + memset_io(vaddr, 0, obj->base.size); + io_mapping_unmap(vaddr); + } + + return 0; +}<snip>
Quoted 18 lines
+/**
+ *i915_sg_dma_page_sizes- Calculate page sizes from a scatterlist
+ * @sg: The scatterlist from which to calculate page sizes
+ *
+ * Return: a value with bits sets for relevant page sizes.
+ */
+static inline unsigned inti915_sg_dma_page_sizes(struct scatterlist *sg)drivers/gpu/drm/i915/gem/i915_gem_lmem.c +7
-0+{ + unsigned int page_sizes; + + page_sizes = 0; + while (sg) { + GEM_BUG_ON(sg->offset); + GEM_BUG_ON(!IS_ALIGNED(sg->dma_length,
PAGE_SIZE));
+page_sizes|=sg->dma_length;Quoted 8 lines
+ sg =
__sg_next(sg);
+ }
+
+ /*
+ * Is this necessary to support building large GPU pages from
+ * even larger segments?
+ */Quoted 7 lines
We just need to know the above sg
page_sizes, which is the mask ofsg->dma_lengthfor each sg. Later in__i915_gem_object_set_pages()we
use this to determine the potential GPU page sizes for the object, depending on what the device supports. So the below stuff shouldn't be
needed. Also we can just usei915_sg_page_sizes()here.
Quoted 3 lines
I noticed that
i915_sg_page_sizes()usessg->length()instead of sg-Quoted 1 line
dma_length(). That doesn't look like what we're after here. Do youknow if there is a reason for that?
Actually, looking at the users, that seems like a bug. I'll make a separate patch out of it.
/Thomas
Quoted 4 lines
Thanks,
Thomas
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 5/7] drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem
In reply to Thomas HellströmQuoted 332 lines · Thomas Hellström
The internal
ttm_bo_utilmemcpy uses vmap functionality, and while it probably might be possible to use it for copying in- and out of sglist represented io memory, usingio_mem_reserve()/io_mem_free()callbacks, that would cause problems withfault().
Instead, implement a method mapping page-by-page usingkmap_local()semantics. As an additional benefit we then avoid the occasional global TLB flushes ofvmap()and consuming vmap space, elimination of a critical point of failure and with a slight change of semantics we could also push the memcpy out async for testing and async driver develpment purposes. Pushing out async can be done since there is no memory allocation going on that could violate thedma_fencelockdep rules.Note that drivers that don't want to use struct
io_mappingbut relies 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 <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 155 ++++++++++++++++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 141 ++++++++++++++++ drivers/gpu/drm/ttm/ttm_bo.c | 1 + 4 files changed, 298 insertions(+) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \ gem/i915_gemfs.odrivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c new file +155
-0@@ -0,0 +1,155 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2021 Intel Corporation +*/ + +/** +* DOC: Usage and intentions. +* +* This file contains functionality that we might want to move into +* ttm_bo_util.c if there is a common interest. +* Currently a kmap_local only memcpy with support for page-based iomem regions, +* and fast memcpy from write-combined memory. +*/ + +#include <linux/dma-buf-map.h> +#include <linux/highmem.h> +#include <linux/io-mapping.h> +#include <linux/scatterlist.h> + +#include "i915_memcpy.h" + +#include "gem/i915_gem_ttm_bo_util.h" + +static void i915_ttm_kmap_iter_tt_kmap_local (struct i915_ttm_kmap_iter *iter, +struct dma_buf_map *dmap, +pgoff_t i) +{ +struct i915_ttm_kmap_iter_tt *iter_tt = +container_of (iter,typeof (*iter_tt), base); + +dma_buf_map_set_vaddr (dmap,kmap_local_page (iter_tt->tt->pages[i])); +} + +static void i915_ttm_kmap_iter_iomap_kmap_local (struct i915_ttm_kmap_iter *iter, +struct dma_buf_map *dmap, +pgoff_t i) +{ +struct i915_ttm_kmap_iter_iomap *iter_io = +container_of (iter,typeof (*iter_io), base); +void __iomem *addr; + +retry: +while (i >= iter_io->cache.end) { + iter_io->cache.sg = iter_io->cache.sg ? +sg_next (iter_io->cache.sg) : iter_io->st->sgl; + iter_io->cache.i = iter_io->cache.end; + iter_io->cache.end +=sg_dma_len (iter_io->cache.sg) >> +PAGE_SHIFT ; + iter_io->cache.offs =sg_dma_address (iter_io->cache.sg) - + iter_io->start; + } + +if (i < iter_io->cache.i) { + iter_io->cache.end =0 ; + iter_io->cache.sg =NULL ; + goto retry; + } + + addr =io_mapping_map_local_wc (iter_io->iomap, iter_io->cache.offs + + (((resource_size_t )i - iter_io->cache.i) + <<PAGE_SHIFT )); +dma_buf_map_set_vaddr_iomem (dmap, addr); +} + +struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_tt_ops = { + .kmap_local = i915_ttm_kmap_iter_tt_kmap_local +}; + +struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_io_ops = { + .kmap_local = i915_ttm_kmap_iter_iomap_kmap_local +}; + +static void kunmap_local_dma_buf_map (struct dma_buf_map *map) +{ +if (map->is_iomem) +io_mapping_unmap_local (map->vaddr_iomem); +else +kunmap_local (map->vaddr); +} + +/** +* i915_ttm_move_memcpy - Helper to perform a memcpy ttm move operation. +* @bo: The struct ttm_buffer_object. +* @new_mem: The struct ttm_resource we're moving to (copy destination). +* @new_kmap: A struct i915_ttm_kmap_iter representing the destination resource. +* @old_kmap: A struct i915_ttm_kmap_iter representing the source resource. +*/ +void i915_ttm_move_memcpy (struct ttm_buffer_object *bo, +struct ttm_resource *new_mem, +struct i915_ttm_kmap_iter *new_kmap, +struct i915_ttm_kmap_iter *old_kmap) +{ +struct ttm_device *bdev = bo->bdev; +struct ttm_resource_manager *man =ttm_manager_type (bdev, new_mem->mem_type); +struct ttm_tt *ttm = bo->ttm; +struct ttm_resource *old_mem = &bo->mem; +struct ttm_resource old_copy = *old_mem; +struct ttm_resource_manager *old_man =ttm_manager_type (bdev, old_mem->mem_type); +struct dma_buf_map old_map, new_map; +pgoff_t i; + +/* For the page-based allocator we need sgtable iterators as well.*/ + +/* Single TTM move. NOP */ +if (old_man->use_tt && man->use_tt) + goto done; + +/* Don't move nonexistent data. Clear destination instead. */ +if (old_man->use_tt && !man->use_tt && + (ttm ==NULL || !ttm_tt_is_populated (ttm))) { +if (ttm && !(ttm->page_flags &TTM_PAGE_FLAG_ZERO_ALLOC )) + goto done; + +for (i =0 ; i < new_mem->num_pages; ++i) { + new_kmap->ops->kmap_local (new_kmap, &new_map, i); +memset_io (new_map.vaddr_iomem,0 ,PAGE_SIZE ); +kunmap_local_dma_buf_map (&new_map); + } + goto done; + } + +for (i =0 ; i < new_mem->num_pages; ++i) { + new_kmap->ops->kmap_local (new_kmap, &new_map, i); + old_kmap->ops->kmap_local (old_kmap, &old_map, i); +if (!old_map.is_iomem || + !i915_memcpy_from_wc (new_map.vaddr, old_map.vaddr,PAGE_SIZE )) { +if (!old_map.is_iomem) { +dma_buf_map_memcpy_to (&new_map, old_map.vaddr, +PAGE_SIZE ); + }else if (!new_map.is_iomem) { +memcpy_fromio (new_map.vaddr, old_map.vaddr_iomem, +PAGE_SIZE ); + }else { +pgoff_t j; +u32 __iomem *src = old_map.vaddr_iomem; +u32 __iomem *dst = new_map.vaddr_iomem; + +for (j =0 ; j < (PAGE_SIZE >>2 ); ++j) +iowrite32 (ioread32 (src++), dst++); + } + } +kunmap_local_dma_buf_map (&old_map); +kunmap_local_dma_buf_map (&new_map); + } + +done: + old_copy = *old_mem; + +ttm_bo_assign_mem (bo, new_mem); + +if (!man->use_tt) +ttm_bo_tt_destroy (bo); + +ttm_resource_free (bo, &old_copy); +}drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +125
-0@@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ + +/* +* This files contains functionality that we might want to move into +* ttm_bo_util.c if there is a common interest. +*/ +#ifndef _I915_GEM_TTM_BO_UTIL_H_ +#define _I915_GEM_TTM_BO_UTIL_H_ + +#include <drm/ttm/ttm_bo_driver.h> +struct dma_buf_map ; +struct io_mapping ; +struct sg_table ; +struct scatterlist ; + +struct ttm_tt ; +struct i915_ttm_kmap_iter ; + +/** +* struct i915_ttm_kmap_iter_ops - Ops structure for a struct +* i915_ttm_kmap_iter. +*/ +struct i915_ttm_kmap_iter_ops { +/** +* kmap_local - Map a PAGE_SIZE part of the resource using +* kmap_local semantics. +* @res_kmap: Pointer to the struct i915_ttm_kmap_iter representing +* the resource. +* @dmap: The struct dma_buf_map holding the virtual address after +* the operation. +* @i: The location within the resource to map. PAGE_SIZE granularity. +*/ +void (*kmap_local)(struct i915_ttm_kmap_iter *res_kmap, +struct dma_buf_map *dmap,pgoff_t i); +}; + +/** +* struct i915_ttm_kmap_iter - Iterator for kmap_local type operations on a +* resource. +* @ops: Pointer to the operations struct. +* +* This struct is intended to be embedded in a resource-specific specialization +* implementing operations for the resource. +* +* Nothing stops us from extending the operations to vmap, vmap_pfn etc, +* replacing some or parts of the ttm_bo_util. cpu-map functionality. +*/ +struct i915_ttm_kmap_iter { +const struct i915_ttm_kmap_iter_ops *ops; +}; + +/** +* struct i915_ttm_kmap_iter_tt - Specialization for a tt (page) backed struct +* ttm_resource. +* @base: Embedded struct i915_ttm_kmap_iter providing the usage interface +* @tt: Cached struct ttm_tt. +*/ +struct i915_ttm_kmap_iter_tt { +struct i915_ttm_kmap_iter base; +struct ttm_tt *tt; +}; + +/** +* struct i915_ttm_kmap_iter_iomap - Specialization for a struct io_mapping + +* struct sg_table backed struct ttm_resource. +* @base: Embedded struct i915_ttm_kmap_iter providing the usage interface. +* @iomap: struct io_mapping representing the underlying linear io_memory. +* @st: sg_table into @iomap, representing the memory of the struct ttm_resource. +* @start: Offset that needs to be subtracted from @st to make +* sg_dma_address(st->sgl) - @start == 0 for @iomap start. +* @cache: Scatterlist traversal cache for fast lookups. +* @cache.sg: Pointer to the currently cached scatterlist segment. +* @cache.i: First index of @sg. PAGE_SIZE granularity. +* @cache.end: Last index + 1 of @sg. PAGE_SIZE granularity. +* @cache.offs: First offset into @iomap of @sg. PAGE_SIZE granularity. +*/ +struct i915_ttm_kmap_iter_iomap { +struct i915_ttm_kmap_iter base; +struct io_mapping *iomap; +struct sg_table *st; +resource_size_t start; +struct { +struct scatterlist *sg; +pgoff_t i; +pgoff_t end; +pgoff_t offs; + } cache; +}; + +extern struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_tt_ops; +extern struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_io_ops; + +/** +* i915_ttm_kmap_iter_iomap_init - Initialize a struct i915_ttm_kmap_iter_iomap +* @iter_io: The struct i915_ttm_kmap_iter_iomap to initialize. +* @iomap: The struct io_mapping representing the underlying linear io_memory. +* @st: sg_table into @iomap, representing the memory of the struct +* ttm_resource. +* @start: Offset that needs to be subtracted from @st to make +* sg_dma_address(st->sgl) - @start == 0 for @iomap start. +* +* Return: Pointer to the embedded struct i915_ttm_kmap_iter. +*/ +static inline struct i915_ttm_kmap_iter * +i915_ttm_kmap_iter_iomap_init (struct i915_ttm_kmap_iter_iomap *iter_io, +struct io_mapping *iomap, +struct sg_table *st, +resource_size_t start) +{ + iter_io->base.ops = &i915_ttm_kmap_iter_io_ops; + iter_io->iomap = iomap; + iter_io->st = st; + iter_io->start = start; +memset (&iter_io->cache,0 ,sizeof (iter_io->cache)); +return &iter_io->base; +} + +/** +* ttm_kmap_iter_tt_init - Initialize a struct i915_ttm_kmap_iter_tt +* @iter_tt: The struct i915_ttm_kmap_iter_tt to initialize. +* @tt: Struct ttm_tt holding page pointers of the struct ttm_resource. +*
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h line 135
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +10
-0+* Return: Pointer to the embedded struct i915_ttm_kmap_iter. +*/ +static inline struct i915_ttm_kmap_iter * +i915_ttm_kmap_iter_tt_init (struct i915_ttm_kmap_iter_tt *iter_tt, +struct ttm_tt *tt) +{ + iter_tt->base.ops = &i915_ttm_kmap_iter_tt_ops; + iter_tt->tt = tt; +return &iter_tt->base; +}
Do there functions have a valid *performance* reason to be inline? I think that's pretty much the only valid reason.
Having these inline forces i915_ttm_kmap_iter_*_ops extern, and they should really be static. Inline functions complicate header dependencies and leak the abstractions.
BR,
Jani.
Quoted 15 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +6
-0+ +void i915_ttm_move_memcpy (struct ttm_buffer_object *bo, +struct ttm_resource *new_mem, +struct i915_ttm_kmap_iter *new_iter, +struct i915_ttm_kmap_iter *old_iter); +#endif drivers/gpu/drm/ttm/ttm_bo.c +1
-0@@ -1221,3 +1221,4 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)ttm_tt_destroy (bo->bdev, bo->ttm); bo->ttm =NULL ; } +EXPORT_SYMBOL (ttm_bo_tt_destroy);
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH 5/7] drm/i915/ttm, drm/ttm: Add a generic TTM memcpy move for page-based iomem
Quoted 346 lines · Jani Nikula
Quoted 332 lines · Thomas Hellström
The internal
ttm_bo_utilmemcpy uses vmap functionality, and while it probably might be possible to use it for copying in- and out of sglist represented io memory, usingio_mem_reserve()/io_mem_free()callbacks, that would cause problems withfault().
Instead, implement a method mapping page-by-page usingkmap_local()semantics. As an additional benefit we then avoid the occasional global TLB flushes ofvmap()and consuming vmap space, elimination of a critical point of failure and with a slight change of semantics we could also push the memcpy out async for testing and async driver develpment purposes. Pushing out async can be done since there is no memory allocation going on that could violate thedma_fencelockdep rules.Note that drivers that don't want to use struct
io_mappingbut relies 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 <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 155 ++++++++++++++++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 141 ++++++++++++++++ drivers/gpu/drm/ttm/ttm_bo.c | 1 + 4 files changed, 298 insertions(+)create mode 100644
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.ccreate mode 100644drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -155,6 +155,7 @@ gem-y += \ gem/i915_gem_stolen.o \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ + gem/i915_gem_ttm_bo_util.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \ gem/i915_gemfs.odrivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.c new file +155
-0@@ -0,0 +1,155 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2021 Intel Corporation +*/ + +/** +* DOC: Usage and intentions. +* +* This file contains functionality that we might want to move into +* ttm_bo_util.c if there is a common interest. +* Currently a kmap_local only memcpy with support for page-based iomem regions, +* and fast memcpy from write-combined memory. +*/ + +#include <linux/dma-buf-map.h> +#include <linux/highmem.h> +#include <linux/io-mapping.h> +#include <linux/scatterlist.h> + +#include "i915_memcpy.h" + +#include "gem/i915_gem_ttm_bo_util.h" + +static void i915_ttm_kmap_iter_tt_kmap_local (struct i915_ttm_kmap_iter *iter, +struct dma_buf_map *dmap, +pgoff_t i) +{ +struct i915_ttm_kmap_iter_tt *iter_tt = +container_of (iter,typeof (*iter_tt), base); + +dma_buf_map_set_vaddr (dmap,kmap_local_page (iter_tt->tt->pages[i])); +} + +static void i915_ttm_kmap_iter_iomap_kmap_local (struct i915_ttm_kmap_iter *iter, +struct dma_buf_map *dmap, +pgoff_t i) +{ +struct i915_ttm_kmap_iter_iomap *iter_io = +container_of (iter,typeof (*iter_io), base); +void __iomem *addr; + +retry: +while (i >= iter_io->cache.end) { + iter_io->cache.sg = iter_io->cache.sg ? +sg_next (iter_io->cache.sg) : iter_io->st->sgl; + iter_io->cache.i = iter_io->cache.end; + iter_io->cache.end +=sg_dma_len (iter_io->cache.sg) >> +PAGE_SHIFT ; + iter_io->cache.offs =sg_dma_address (iter_io->cache.sg) - + iter_io->start; + } + +if (i < iter_io->cache.i) { + iter_io->cache.end =0 ; + iter_io->cache.sg =NULL ; + goto retry; + } + + addr =io_mapping_map_local_wc (iter_io->iomap, iter_io->cache.offs + + (((resource_size_t )i - iter_io->cache.i) + <<PAGE_SHIFT )); +dma_buf_map_set_vaddr_iomem (dmap, addr); +} + +struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_tt_ops = { + .kmap_local = i915_ttm_kmap_iter_tt_kmap_local +}; + +struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_io_ops = { + .kmap_local = i915_ttm_kmap_iter_iomap_kmap_local +}; + +static void kunmap_local_dma_buf_map (struct dma_buf_map *map) +{ +if (map->is_iomem) +io_mapping_unmap_local (map->vaddr_iomem); +else +kunmap_local (map->vaddr); +} + +/** +* i915_ttm_move_memcpy - Helper to perform a memcpy ttm move operation. +* @bo: The struct ttm_buffer_object. +* @new_mem: The struct ttm_resource we're moving to (copy destination). +* @new_kmap: A struct i915_ttm_kmap_iter representing the destination resource. +* @old_kmap: A struct i915_ttm_kmap_iter representing the source resource. +*/ +void i915_ttm_move_memcpy (struct ttm_buffer_object *bo, +struct ttm_resource *new_mem, +struct i915_ttm_kmap_iter *new_kmap, +struct i915_ttm_kmap_iter *old_kmap) +{ +struct ttm_device *bdev = bo->bdev; +struct ttm_resource_manager *man =ttm_manager_type (bdev, new_mem->mem_type); +struct ttm_tt *ttm = bo->ttm; +struct ttm_resource *old_mem = &bo->mem; +struct ttm_resource old_copy = *old_mem; +struct ttm_resource_manager *old_man =ttm_manager_type (bdev, old_mem->mem_type); +struct dma_buf_map old_map, new_map; +pgoff_t i; + +/* For the page-based allocator we need sgtable iterators as well.*/ + +/* Single TTM move. NOP */ +if (old_man->use_tt && man->use_tt) + goto done; + +/* Don't move nonexistent data. Clear destination instead. */ +if (old_man->use_tt && !man->use_tt && + (ttm ==NULL || !ttm_tt_is_populated (ttm))) { +if (ttm && !(ttm->page_flags &TTM_PAGE_FLAG_ZERO_ALLOC )) + goto done; + +for (i =0 ; i < new_mem->num_pages; ++i) { + new_kmap->ops->kmap_local (new_kmap, &new_map, i); +memset_io (new_map.vaddr_iomem,0 ,PAGE_SIZE ); +kunmap_local_dma_buf_map (&new_map); + } + goto done; + } + +for (i =0 ; i < new_mem->num_pages; ++i) { + new_kmap->ops->kmap_local (new_kmap, &new_map, i); + old_kmap->ops->kmap_local (old_kmap, &old_map, i); +if (!old_map.is_iomem || + !i915_memcpy_from_wc (new_map.vaddr, old_map.vaddr,PAGE_SIZE )) { +if (!old_map.is_iomem) { +dma_buf_map_memcpy_to (&new_map, old_map.vaddr, +PAGE_SIZE ); + }else if (!new_map.is_iomem) { +memcpy_fromio (new_map.vaddr, old_map.vaddr_iomem, +PAGE_SIZE ); + }else { +pgoff_t j; +u32 __iomem *src = old_map.vaddr_iomem; +u32 __iomem *dst = new_map.vaddr_iomem; + +for (j =0 ; j < (PAGE_SIZE >>2 ); ++j) +iowrite32 (ioread32 (src++), dst++); + } + } +kunmap_local_dma_buf_map (&old_map); +kunmap_local_dma_buf_map (&new_map); + } + +done: + old_copy = *old_mem; + +ttm_bo_assign_mem (bo, new_mem); + +if (!man->use_tt) +ttm_bo_tt_destroy (bo); + +ttm_resource_free (bo, &old_copy); +}drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +125
-0@@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021 Intel Corporation +*/ + +/* +* This files contains functionality that we might want to move into +* ttm_bo_util.c if there is a common interest. +*/ +#ifndef _I915_GEM_TTM_BO_UTIL_H_ +#define _I915_GEM_TTM_BO_UTIL_H_ + +#include <drm/ttm/ttm_bo_driver.h> +struct dma_buf_map ; +struct io_mapping ; +struct sg_table ; +struct scatterlist ; + +struct ttm_tt ; +struct i915_ttm_kmap_iter ; + +/** +* struct i915_ttm_kmap_iter_ops - Ops structure for a struct +* i915_ttm_kmap_iter. +*/ +struct i915_ttm_kmap_iter_ops { +/** +* kmap_local - Map a PAGE_SIZE part of the resource using +* kmap_local semantics. +* @res_kmap: Pointer to the struct i915_ttm_kmap_iter representing +* the resource. +* @dmap: The struct dma_buf_map holding the virtual address after +* the operation. +* @i: The location within the resource to map. PAGE_SIZE granularity. +*/ +void (*kmap_local)(struct i915_ttm_kmap_iter *res_kmap, +struct dma_buf_map *dmap,pgoff_t i); +}; + +/** +* struct i915_ttm_kmap_iter - Iterator for kmap_local type operations on a +* resource. +* @ops: Pointer to the operations struct. +* +* This struct is intended to be embedded in a resource-specific specialization +* implementing operations for the resource. +* +* Nothing stops us from extending the operations to vmap, vmap_pfn etc, +* replacing some or parts of the ttm_bo_util. cpu-map functionality. +*/ +struct i915_ttm_kmap_iter { +const struct i915_ttm_kmap_iter_ops *ops; +}; + +/** +* struct i915_ttm_kmap_iter_tt - Specialization for a tt (page) backed struct +* ttm_resource. +* @base: Embedded struct i915_ttm_kmap_iter providing the usage interface +* @tt: Cached struct ttm_tt. +*/ +struct i915_ttm_kmap_iter_tt { +struct i915_ttm_kmap_iter base; +struct ttm_tt *tt; +}; + +/** +* struct i915_ttm_kmap_iter_iomap - Specialization for a struct io_mapping + +* struct sg_table backed struct ttm_resource. +* @base: Embedded struct i915_ttm_kmap_iter providing the usage interface. +* @iomap: struct io_mapping representing the underlying linear io_memory. +* @st: sg_table into @iomap, representing the memory of the struct ttm_resource. +* @start: Offset that needs to be subtracted from @st to make +* sg_dma_address(st->sgl) - @start == 0 for @iomap start. +* @cache: Scatterlist traversal cache for fast lookups. +* @cache.sg: Pointer to the currently cached scatterlist segment. +* @cache.i: First index of @sg. PAGE_SIZE granularity. +* @cache.end: Last index + 1 of @sg. PAGE_SIZE granularity. +* @cache.offs: First offset into @iomap of @sg. PAGE_SIZE granularity. +*/ +struct i915_ttm_kmap_iter_iomap { +struct i915_ttm_kmap_iter base; +struct io_mapping *iomap; +struct sg_table *st; +resource_size_t start; +struct { +struct scatterlist *sg; +pgoff_t i; +pgoff_t end; +pgoff_t offs; + } cache; +}; + +extern struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_tt_ops; +extern struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_io_ops; + +/** +* i915_ttm_kmap_iter_iomap_init - Initialize a struct i915_ttm_kmap_iter_iomap +* @iter_io: The struct i915_ttm_kmap_iter_iomap to initialize. +* @iomap: The struct io_mapping representing the underlying linear io_memory. +* @st: sg_table into @iomap, representing the memory of the struct +* ttm_resource. +* @start: Offset that needs to be subtracted from @st to make +* sg_dma_address(st->sgl) - @start == 0 for @iomap start. +* +* Return: Pointer to the embedded struct i915_ttm_kmap_iter. +*/ +static inline struct i915_ttm_kmap_iter * +i915_ttm_kmap_iter_iomap_init (struct i915_ttm_kmap_iter_iomap *iter_io, +struct io_mapping *iomap, +struct sg_table *st, +resource_size_t start) +{ + iter_io->base.ops = &i915_ttm_kmap_iter_io_ops; + iter_io->iomap = iomap; + iter_io->st = st; + iter_io->start = start; +memset (&iter_io->cache,0 ,sizeof (iter_io->cache)); +return &iter_io->base; +} + +/** +* ttm_kmap_iter_tt_init - Initialize a struct i915_ttm_kmap_iter_tt +* @iter_tt: The struct i915_ttm_kmap_iter_tt to initialize. +* @tt: Struct ttm_tt holding page pointers of the struct ttm_resource. +* drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h line 135
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +10
-0+* Return: Pointer to the embedded struct i915_ttm_kmap_iter. +*/ +static inline struct i915_ttm_kmap_iter * +i915_ttm_kmap_iter_tt_init (struct i915_ttm_kmap_iter_tt *iter_tt, +struct ttm_tt *tt) +{ + iter_tt->base.ops = &i915_ttm_kmap_iter_tt_ops; + iter_tt->tt = tt; +return &iter_tt->base; +}Do there functions have a valid *performance* reason to be inline? I think that's pretty much the only valid reason.
Quoted 6 lines
Having these inline forces i915_ttm_kmap_iter_*_ops extern, and they should really be static. Inline functions complicate header dependencies and leak the abstractions.
BR,
Jani.
Hi,
Thanks for reviewing. I don't think there really is a performance reason for keeping these functions inline. While in this case there is not really much change either in leaking abstractions nor in header dependencies I agree keeping those ops static is probably a better choice. I'll respin.
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx