drm/i915: Move LMEM (VRAM) management over to TTM
Subsystems (8)
Thomas Hellström
reviewerv2 cover 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
- Pipelined accelerated moves / migration
- Re-added buddy allocator in the TTM framework
v2:
- Add patches to move pagefaulting over to TTM
- Break out TTM changes to separate patches
- Address various review comments as detailed in the affected patches
Maarten Lankhorst (4):
drm/i915: Disable mmap ioctl for gen12+
drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm
handlers.
drm/i915: Use ttm mmap handling for ttm bo's. drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn
Thomas Hellström (11):
drm/i915: Untangle the vma pages_mutex
drm/i915: Don't free shared locks while shared
drm/i915: Fix i915_sg_page_sizes to record dma segments rather than
physical pages
drm/ttm: Export functions to initialize and finalize the ttm range
manager standalone
drm/i915/ttm Initialize the ttm device and memory managers drm/i915/ttm: Embed a ttm buffer object in the i915 gem object drm/ttm: Export ttm_bo_tt_destroy()
drm/i915/ttm Add a generic TTM memcpy move for page-based iomem drm/ttm, drm/amdgpu: Allow the driver some control over swapping drm/i915/ttm: Introduce a TTM i915 gem object backend drm/i915/lmem: Verify checks for lmem residency
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +- 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_dmabuf.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_mman.c | 24 +- drivers/gpu/drm/i915/gem/i915_gem_mman.h | 2 + drivers/gpu/drm/i915/gem/i915_gem_object.c | 149 +++- drivers/gpu/drm/i915/gem/i915_gem_object.h | 19 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 39 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 2 +- 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 | 626 ++++++++++++++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 48 ++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 194 +++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 107 +++ drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 2 +- drivers/gpu/drm/i915/gt/intel_ggtt.c | 19 +- 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 | 30 +- 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 | 13 + 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 | 20 +- 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 | 246 ++++++ 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 | 50 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo.c | 42 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 84 +- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +- drivers/gpu/drm/ttm/ttm_tt.c | 4 + drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c | 8 +- include/drm/ttm/ttm_bo_api.h | 9 +- include/drm/ttm/ttm_bo_driver.h | 23 + 57 files changed, 2068 insertions(+), 1951 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.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 1/15 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 · 1 line
2.31.1
Thomas Hellström
reviewerPATCH v2 2/15 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 take additional measures to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown
---
v2: Try harder to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown.
--- 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 | 19 ++++++-- drivers/gpu/drm/i915/gt/intel_gtt.c | 45 +++++++++++++++---- drivers/gpu/drm/i915/gt/intel_gtt.h | 30 ++++++++++++- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 5 +++ 7 files changed, 92 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 +16 -3
@@ -746,7 +746,6 @@ 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);arch_phys_wc_del (ggtt->mtrr);
@@ -768,6 +767,19 @@ void i915_ggtt_driver_release(struct drm_i915_private *i915)ggtt_cleanup_hw (ggtt); } +/** +* i915_ggtt_driver_late_release - Cleanup of GGTT that needs to be done after +* all free objects have been drained. +* @i915: i915 device +*/ +void i915_ggtt_driver_late_release (struct drm_i915_private *i915) +{ +struct i915_ggtt *ggtt = &i915->ggtt; + +GEM_WARN_ON (kref_read (&ggtt->vm.resv_ref) !=1 ); +dma_resv_fini (&ggtt->vm._resv); +} +static unsigned int gen6_get_total_gtt_size (u16 snb_gmch_ctl) { snb_gmch_ctl >>=SNB_GMCH_GGMS_SHIFT ;
@@ -829,6 +841,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 +1148,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 +1157,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 +29 -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) {
@@ -506,6 +533,7 @@ void i915_ggtt_enable_guc(struct i915_ggtt *ggtt);void i915_ggtt_disable_guc (struct i915_ggtt *ggtt);int i915_init_ggtt (struct drm_i915_private *i915);void i915_ggtt_driver_release (struct drm_i915_private *i915); +void i915_ggtt_driver_late_release (struct drm_i915_private *i915);static inline bool i915_ggtt_has_aperture (const struct i915_ggtt *ggtt) {
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;
drivers/gpu/drm/i915/i915_drv.c +5 -0
@@ -631,6 +631,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)intel_memory_regions_driver_release (dev_priv); err_ggtt:i915_ggtt_driver_release (dev_priv); +i915_gem_drain_freed_objects (dev_priv); +i915_ggtt_driver_late_release (dev_priv); err_perf:i915_perf_fini (dev_priv);return ret;
@@ -880,6 +882,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)i915_driver_hw_remove (i915);intel_memory_regions_driver_release (i915);i915_ggtt_driver_release (i915); +i915_gem_drain_freed_objects (i915); +i915_ggtt_driver_late_release (i915); out_cleanup_mmio:i915_driver_mmio_release (i915); out_runtime_pm_put:
@@ -936,6 +940,7 @@ static void i915_driver_release(struct drm_device *dev)intel_memory_regions_driver_release (dev_priv);i915_ggtt_driver_release (dev_priv);i915_gem_drain_freed_objects (dev_priv); +i915_ggtt_driver_late_release (dev_priv);i915_driver_mmio_release (dev_priv);
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 3/15 drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages
In reply to Thomas HellströmAll users of this function actually want the dma segment sizes, but that's not what's calculated. Fix that and rename the function to i915_sg_dma_sizes to reflect what's calculated.
--- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 2 +- drivers/gpu/drm/i915/i915_scatterlist.h | 16 ++++++++++++---- 4 files changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
@@ -209,7 +209,7 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)if (IS_ERR (pages))return PTR_ERR (pages); - sg_page_sizes =i915_sg_page_sizes (pages->sgl); + sg_page_sizes =i915_sg_dma_sizes (pages->sgl);__i915_gem_object_set_pages (obj, pages, sg_page_sizes);
drivers/gpu/drm/i915/gem/i915_gem_phys.c +1 -1
@@ -208,7 +208,7 @@ static int i915_gem_object_shmem_to_phys(struct drm_i915_gem_object *obj) err_xfer:if (!IS_ERR_OR_NULL (pages)) { -unsigned int sg_page_sizes =i915_sg_page_sizes (pages->sgl); +unsigned int sg_page_sizes =i915_sg_dma_sizes (pages->sgl);__i915_gem_object_set_pages (obj, pages, sg_page_sizes); }
drivers/gpu/drm/i915/gem/i915_gem_userptr.c +1 -1
@@ -173,7 +173,7 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) goto err; } - sg_page_sizes =i915_sg_page_sizes (st->sgl); + sg_page_sizes =i915_sg_dma_sizes (st->sgl);__i915_gem_object_set_pages (obj, st, sg_page_sizes);
drivers/gpu/drm/i915/i915_scatterlist.h +12 -4
@@ -101,15 +101,23 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg) (((__iter).curr += PAGE_SIZE) >= (__iter).max) ? \ (__iter) = __sgt_iter(__sg_next((__iter).sgp), false), 0 : 0) -static inline unsigned int i915_sg_page_sizes (struct scatterlist *sg) +/** +* i915_sg_dma_sizes - Record the dma segment sizes of a scatterlist +* @sg: The scatterlist +* +* Return: An unsigned int with segment sizes logically or'ed together. +* A caller can use this information to determine what hardware page table +* entry sizes can be used to map the memory represented by the scatterlist. +*/ +static inline unsigned int i915_sg_dma_sizes (struct scatterlist *sg) {unsigned int page_sizes; page_sizes =0 ; -while (sg) { +while (sg &&sg_dma_len (sg)) {GEM_BUG_ON (sg->offset); -GEM_BUG_ON (!IS_ALIGNED (sg->length,PAGE_SIZE )); - page_sizes |= sg->length; +GEM_BUG_ON (!IS_ALIGNED (sg_dma_len (sg),PAGE_SIZE )); + page_sizes |=sg_dma_len (sg); sg =__sg_next (sg); }
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 4/15 drm/ttm: Export functions to initialize and finalize the ttm range manager standalone
In reply to Thomas Hellströmi915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to.
--- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +++++++++++++++++-------- include/drm/ttm/ttm_bo_driver.h | 23 +++++++++++ 2 files changed, 61 insertions(+), 17 deletions(-)
drivers/gpu/drm/ttm/ttm_range_manager.c +38 -17
@@ -125,55 +125,76 @@ static const struct ttm_resource_manager_func ttm_range_manager_func = { .debug = ttm_range_man_debug }; -int ttm_range_man_init (struct ttm_device *bdev, -unsigned type,bool use_tt, -unsigned long p_size) +struct ttm_resource_manager * +ttm_range_man_init_standalone (unsigned long size,bool use_tt) {struct ttm_resource_manager *man;struct ttm_range_manager *rman; rman =kzalloc (sizeof (*rman),GFP_KERNEL );if (!rman) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); man = &rman->manager; man->use_tt = use_tt; man->func = &ttm_range_manager_func; -ttm_resource_manager_init (man, p_size); +ttm_resource_manager_init (man, size); -drm_mm_init (&rman->mm,0 , p_size); +drm_mm_init (&rman->mm,0 , size);spin_lock_init (&rman->lock); -ttm_set_driver_manager (bdev, type, &rman->manager); +return man; +} +EXPORT_SYMBOL (ttm_range_man_init_standalone); + +int ttm_range_man_init (struct ttm_device *bdev, +unsigned int type,bool use_tt, +unsigned long p_size) +{ +struct ttm_resource_manager *man; + + man =ttm_range_man_init_standalone (p_size, use_tt); +if (IS_ERR (man)) +return PTR_ERR (man); +ttm_resource_manager_set_used (man, true); +ttm_set_driver_manager (bdev, type, man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_init); +void ttm_range_man_fini_standalone (struct ttm_resource_manager *man) +{ +struct ttm_range_manager *rman =to_range_manager (man); +struct drm_mm *mm = &rman->mm; + +spin_lock (&rman->lock); +drm_mm_clean (mm); +drm_mm_takedown (mm); +spin_unlock (&rman->lock); + +ttm_resource_manager_cleanup (man); +kfree (rman); +} +EXPORT_SYMBOL (ttm_range_man_fini_standalone); +int ttm_range_man_fini (struct ttm_device *bdev,unsigned type) {struct ttm_resource_manager *man =ttm_manager_type (bdev, type); -struct ttm_range_manager *rman =to_range_manager (man); -struct drm_mm *mm = &rman->mm;int ret;ttm_resource_manager_set_used (man, false); - ret =ttm_resource_manager_evict_all (bdev, man);if (ret)return ret; -spin_lock (&rman->lock); -drm_mm_clean (mm); -drm_mm_takedown (mm); -spin_unlock (&rman->lock); - -ttm_resource_manager_cleanup (man);ttm_set_driver_manager (bdev, type,NULL ); -kfree (rman); +ttm_range_man_fini_standalone (man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_fini);
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.31.1
Thomas Hellström
reviewerPATCH v2 6/15 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 · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 5/15 drm/i915/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.
Also modify the mock region selftests somewhat to account for a fragmenting manager.
---
v2:
- Fix an error unwind in lmem_get_pages() (Reported by Matthew Auld)
- Break out and modify usage of i915_sg_dma_sizes() (Reported by Mattew Auld)
- Break out TTM changes to a separate patch (Reported by Christian König)
--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 2 +- drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 59 +- .../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 | 4 + 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 | 245 ++++++ 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 | 50 +- 29 files changed, 622 insertions(+), 1754 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 +57 -2
73 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 +4 -0
@@ -13,6 +13,8 @@#include "i915_gem.h" +struct drm_mm_node ; +/* * Optimised SGL iterator for GEM objects */
@@ -141,4 +143,6 @@ static inline unsigned int i915_sg_segment_size(void)bool i915_sg_trim (struct sg_table *orig_st); +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 +245 -0
245 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 +43 -7
80 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 7/15 drm/ttm: Export ttm_bo_tt_destroy()
In reply to Thomas HellströmFor the upcoming kmapping i915 memcpy_move, export ttm_bo_tt_destroy(). A future change might be to move the new memcpy_move into ttm, replacing the old ioremapping one.
--- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+)
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.31.1
Thomas Hellström
reviewerPATCH v2 8/15 drm/i915/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.
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.
---
v2:
- Move new TTM exports to a separate commit. (Reported by Christian König)
- Avoid having the iterator init functions inline. (Reported by Jani Nikula)
- Remove a stray comment.
--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 194 ++++++++++++++++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 107 ++++++++++ 3 files changed, 302 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 +194 -0
194 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +107 -0
107 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 9/15 drm/ttm, drm/amdgpu: Allow the driver some control over swapping
In reply to Thomas HellströmWe are calling the eviction_valuable driver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.
Add an eviction_valuable call also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in the TTM_PL_SYSTEM placement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normal eviction_valuable path is run.
Finally export ttm_tt_unpopulate() and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++ drivers/gpu/drm/ttm/ttm_bo.c | 41 +++++++++++++++---------- drivers/gpu/drm/ttm/ttm_tt.c | 4 +++ 3 files changed, 33 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -0
@@ -1399,6 +1399,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,struct dma_fence *f;int i; +/* Swapout? */ +if (bo->mem.mem_type ==TTM_PL_SYSTEM ) +return true; +if (bo->type == ttm_bo_type_kernel && !amdgpu_vm_evictable (ttm_to_amdgpu_bo (bo)))return false;
drivers/gpu/drm/ttm/ttm_bo.c +25 -16
86 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_tt.c +4 -0
@@ -258,6 +258,9 @@ int ttm_tt_swapout(struct ttm_device *bdev, struct ttm_tt *ttm,struct page *to_page;int i, ret; +if (!ttm_tt_is_populated (ttm)) +return 0 ; + swap_storage =shmem_file_setup ("ttm swap" , size,0 );if (IS_ERR (swap_storage)) {pr_err ("Failed allocating swap storage\n" );
@@ -399,6 +402,7 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm) ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED ; } +EXPORT_SYMBOL (ttm_tt_unpopulate);#ifdef CONFIG_DEBUG_FS
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 10/15 drm/i915/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.
Remove the old lmem backend.
---
v2:
- Break out needed TTM functionality to a separate patch (Reported by Christian König).
- Fix an unhandled error (Reported by Matthew Auld and Maarten Lankhorst)
- Remove a stray leftover sg_table allocation (Reported by Matthew Auld)
- Use ttm_tt_unpopulate() rather than ttm_tt_destroy() in the purge path as some TTM functionality relies on having a ttm_tt present for !is_iomem.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 84 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 125 +++-- 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 | 519 ++++++++++++++++++ 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 +- 15 files changed, 696 insertions(+), 141 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 -84
97 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 +86 -39
164 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 +519 -0
519 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
@@ -197,6 +196,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,
@@ -243,3 +243,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_ */
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 12/15 drm/i915: Disable mmap ioctl for gen12+
In reply to Thomas HellströmFrom: Maarten Lankhorst <[email protected]>
The paltform should exclusively use mmap_offset, one less path to worry about for discrete.
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +7 -0
@@ -56,10 +56,17 @@ int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { + struct drm_i915_private *i915 = to_i915(dev);struct drm_i915_gem_mmap *args = data;struct drm_i915_gem_object *obj;unsigned long addr; +/* mmap ioctl is disallowed for all platforms after TGL-LP. This also +* covers all platforms with local memory. +*/ +if (INTEL_GEN (i915) >=12 && !IS_TIGERLAKE (i915)) +return -EOPNOTSUPP ; +if (args->flags & ~(I915_MMAP_WC ))return -EINVAL ;
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 11/15 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.
---
v2: Simplify i915_gem_object_migratable() (Reported by Mattew Auld)
--- 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 | 18 +++++++++ drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 ++ 4 files changed, 64 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 +18 -0
@@ -457,6 +457,24 @@ 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); + +if (!mr) +return false; + +return obj->mm.n_placements >1 ; +} +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 · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 14/15 drm/i915: Use ttm mmap handling for ttm bo's.
In reply to Thomas HellströmFrom: Maarten Lankhorst <[email protected]>
Use the ttm handlers for servicing page faults, and vm_access.
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 17 ++- drivers/gpu/drm/i915/gem/i915_gem_mman.h | 2 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 105 +++++++++++++++++- 4 files changed, 118 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +11 -6
@@ -19,6 +19,7 @@#include "i915_gem_mman.h" #include "i915_trace.h" #include "i915_user_extensions.h" +#include "i915_gem_ttm.h" #include "i915_vma.h" static inline bool
@@ -789,7 +790,7 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,return __assign_mmap_offset (file, args->handle, type, &args->offset); } -static void vm_open (struct vm_area_struct *vma) +void i915_gem_mmap_vm_open (struct vm_area_struct *vma) {struct i915_mmap_offset *mmo = vma->vm_private_data;struct drm_i915_gem_object *obj = mmo->obj;
@@ -798,7 +799,7 @@ static void vm_open(struct vm_area_struct *vma)i915_gem_object_get (obj); } -static void vm_close (struct vm_area_struct *vma) +void i915_gem_mmap_vm_close (struct vm_area_struct *vma) {struct i915_mmap_offset *mmo = vma->vm_private_data;struct drm_i915_gem_object *obj = mmo->obj;
@@ -810,15 +811,15 @@ static void vm_close(struct vm_area_struct *vma)static const struct vm_operations_struct vm_ops_gtt = { .fault = vm_fault_gtt, .access = vm_access, - .open = vm_open, - .close = vm_close, + .open = i915_gem_mmap_vm_open, + .close = i915_gem_mmap_vm_close, };static const struct vm_operations_struct vm_ops_cpu = { .fault = vm_fault_cpu, .access = vm_access, - .open = vm_open, - .close = vm_close, + .open = i915_gem_mmap_vm_open, + .close = i915_gem_mmap_vm_close, };static int singleton_release (struct inode *inode,struct file *file)
@@ -953,6 +954,10 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma) } vma->vm_page_prot =pgprot_decrypted (vma->vm_page_prot); +/* override ops per-object if desired */ +if (obj->ops->mmap_ops) + vma->vm_ops = obj->ops->mmap_ops; +return 0 ; }
drivers/gpu/drm/i915/gem/i915_gem_mman.h +2 -0
@@ -28,5 +28,7 @@ void __i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj);void i915_gem_object_release_mmap_gtt (struct drm_i915_gem_object *obj);void i915_gem_object_release_mmap_offset (struct drm_i915_gem_object *obj); +void i915_gem_mmap_vm_open (struct vm_area_struct *vma); +void i915_gem_mmap_vm_close (struct vm_area_struct *vma);#endif
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
@@ -79,6 +79,7 @@ struct drm_i915_gem_object_ops {void (*delayed_free)(struct drm_i915_gem_object *obj);void (*release)(struct drm_i915_gem_object *obj); +const struct vm_operations_struct *mmap_ops;const char *name;/* friendly name for debug, e.g. lockdep classes */ };
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +104 -1
135 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerPATCH v2 13/15 drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.
In reply to Thomas HellströmFrom: Maarten Lankhorst <[email protected]>
This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers.
Also clarify the documentation a bit, especially related to VM_FAULT_RETRY.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 84 +++++++++++++--------- drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c | 8 ++- include/drm/ttm/ttm_bo_api.h | 9 ++- 6 files changed, 75 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -1919,7 +1919,9 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf)if (ret) goto unlock; - ret =ttm_bo_vm_fault_reserved (vmf, vmf->vma->vm_page_prot, + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot,TTM_BO_VM_NUM_PREFAULT ,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;
drivers/gpu/drm/nouveau/nouveau_ttm.c +3 -1
@@ -144,7 +144,9 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf)nouveau_bo_del_io_reserve_lru (bo); prot =vm_get_page_prot (vma->vm_flags); - ret =ttm_bo_vm_fault_reserved (vmf, prot,TTM_BO_VM_NUM_PREFAULT ,1 ); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot,TTM_BO_VM_NUM_PREFAULT ,1 );nouveau_bo_add_io_reserve_lru (bo);if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;
drivers/gpu/drm/radeon/radeon_ttm.c +3 -1
@@ -816,7 +816,9 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf)if (ret) goto unlock_resv; - ret =ttm_bo_vm_fault_reserved (vmf, vmf->vma->vm_page_prot, + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot,TTM_BO_VM_NUM_PREFAULT ,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) goto unlock_mclk;
drivers/gpu/drm/ttm/ttm_bo_vm.c +52 -32
169 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +6 -2
@@ -477,7 +477,9 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)else prot =vm_get_page_prot (vma->vm_flags); - ret =ttm_bo_vm_fault_reserved (vmf, prot, num_prefault,1 ); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot, num_prefault,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;
@@ -546,7 +548,9 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, prot =vm_get_page_prot (vma->vm_flags); } - ret =ttm_bo_vm_fault_reserved (vmf, prot,1 , fault_page_size); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot,1 , fault_page_size);if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;
include/drm/ttm/ttm_bo_api.h +8 -1
@@ -605,7 +605,9 @@ int ttm_mem_evict_first(struct ttm_device *bdev,vm_fault_t ttm_bo_vm_reserve (struct ttm_buffer_object *bo,struct vm_fault *vmf); -vm_fault_t ttm_bo_vm_fault_reserved (struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved (struct ttm_buffer_object *bo, +struct vm_fault *vmf, +unsigned long mmap_base,pgprot_t prot,pgoff_t num_prefault,pgoff_t fault_page_size);
@@ -616,6 +618,11 @@ void ttm_bo_vm_open(struct vm_area_struct *vma);void ttm_bo_vm_close (struct vm_area_struct *vma); +int ttm_bo_vm_access_reserved (struct ttm_buffer_object *bo, +struct vm_area_struct *vma, +unsigned long offset, +void *buf,int len,int write); +int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr,void *buf,int len,int write);bool ttm_bo_delayed_delete (struct ttm_device *bdev,bool remove_all);
Signature · 1 line
2.31.1
Thomas Hellström
reviewerPATCH v2 15/15 drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn
In reply to Thomas HellströmFrom: Maarten Lankhorst <[email protected]>
Instead of walking the sg table manually, use our caching helpers to do the sgt caching. To prevent lifetime issues of ttm_bo vs i915_gem_object, we will use a separate member, instead of re-using the dma page member.
--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 6 +-- .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 46 ++++++++++--------- 4 files changed, 30 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +3 -3
@@ -342,14 +342,14 @@ struct scatterlist * __i915_gem_object_get_sg(struct drm_i915_gem_object *obj, struct i915_gem_object_page_iter *iter, unsigned int n, - unsigned int *offset, bool allow_alloc); + unsigned int *offset, bool allow_alloc, bool dma);static inline struct scatterlist *i915_gem_object_get_sg (struct drm_i915_gem_object *obj,unsigned int n,unsigned int *offset,bool allow_alloc) { -return __i915_gem_object_get_sg (obj, &obj->mm.get_page, n, offset, allow_alloc); +return __i915_gem_object_get_sg (obj, &obj->mm.get_page, n, offset, allow_alloc, false); } static inline struct scatterlist *
@@ -357,7 +357,7 @@ i915_gem_object_get_sg_dma(struct drm_i915_gem_object *obj,unsigned int n, unsigned int *offset, bool allow_alloc) { - return __i915_gem_object_get_sg(obj, &obj->mm.get_dma_page, n, offset, allow_alloc); + return __i915_gem_object_get_sg(obj, &obj->mm.get_dma_page, n, offset, allow_alloc, true); } struct page *
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1 -0
@@ -324,6 +324,7 @@ struct drm_i915_gem_object {struct {struct sg_table *cached_io_st; +struct i915_gem_object_page_iter get_io_page; } ttm;/** Record of address bit 17 of each page at last unbind. */
drivers/gpu/drm/i915/gem/i915_gem_pages.c +1 -2
@@ -465,9 +465,8 @@ __i915_gem_object_get_sg(struct drm_i915_gem_object *obj,struct i915_gem_object_page_iter *iter, unsigned int n, unsigned int *offset, - bool allow_alloc) + bool allow_alloc, bool dma) { - const bool dma = iter == &obj->mm.get_dma_page; struct scatterlist *sg;unsigned int idx, count;
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +25 -21
76 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [Intel-gfx] [PATCH v2 12/15] drm/i915: Disable mmap ioctl for gen12+
In reply to Thomas HellströmQuoted 4 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
The paltform should exclusively use
mmap_offset, one less path to worry about for discrete.
s/paltform/platform/
Quoted 2 lines
Signed-off-by Maarten Lankhorst <[email protected]>
Otherwise,
Quoted 16 lines
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/i915/gem/i915_gem_mman.c +1
-0@@ -56,10 +56,17 @@ int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { + struct drm_i915_private *i915 = to_i915(dev);struct drm_i915_gem_mmap *args = data;struct drm_i915_gem_object *obj;unsigned long addr;
drivers/gpu/drm/i915/gem/i915_gem_mman.c int · line 72
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_mman.c +6
-0+/* mmap ioctl is disallowed for all platforms after TGL-LP. This also +* covers all platforms with local memory. +*/ +if (INTEL_GEN (i915) >=12 && !IS_TIGERLAKE (i915)) +return -EOPNOTSUPP ; +if (args->flags & ~(I915_MMAP_WC ))return -EINVAL ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
URL : https://patchwork.freedesktop.org/series/90022/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip f95eea0001a4 drm/i915: Untangle the vma pages_mutex 425af44621a2 drm/i915: Don't free shared locks while shared a1fb9cdc093f drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages 1b455d3307a9 drm/ttm: Export functions to initialize and finalize the ttm range manager standalone 01c0540773c7 drm/i915/ttm Initialize the ttm device and memory managers -:479: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #479: deleted file mode 100644
total: 0 errors, 1 warnings, 0 checks, 1478 lines checkeda3796d8feda9 drm/i915/ttm: Embed a ttm buffer object in the i915 gem object 32e0235ecbbf drm/ttm: Export ttm_bo_tt_destroy()3ed6aaedd277 drm/i915/ttm Add a generic TTM memcpy move for page-based iomem -:46: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #46:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 308 lines checked75550f88727b drm/ttm, drm/amdgpu: Allow the driver some control over swapping 36729bdb371d drm/i915/ttm: Introduce a TTM i915 gem object backend
-:408: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #408:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 962 lines checkedf897aee184bd drm/i915/lmem: Verify checks for lmem residencyd85d5bfe5022 drm/i915: Disable mmap ioctl for gen12+7199fd0658f1 drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers. -:214: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#214: FILE: drivers/gpu/drm/ttm/ttm_bo_vm.c:494:
+ return bo->bdev->funcs->access_memory(
total: 0 errors, 0 warnings, 1 checks, 240 lines checked bea92372457b drm/i915: Use ttm mmap handling for ttm bo's. -:196: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #196: FILE: drivers/gpu/drm/i915/gem/i915_gem_ttm.c:528:
+vm_access_ttm(struct vm_area_struct *area, unsigned long addr,
+ void *buf, int len, int write)
total: 0 errors, 0 warnings, 1 checks, 201 lines checked 17af87b6b030 drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2 03/15] drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages
In reply to Thomas HellströmQuoted 6 lines · Thomas Hellström
All users of this function actually want the dma segment sizes, but that's not what's calculated. Fix that and rename the function to
i915_sg_dma_sizesto reflect what's calculated.Signed-off-by Thomas Hellström <[email protected]>
_______________________________________________
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 (rev2)
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
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
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.
In reply to Thomas Hellström+ Christian König
Quoted 8 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers.
Also clarify the documentation a bit, especially related to
VM_FAULT_RETRY.Signed-off-by Maarten Lankhorst <[email protected]>
Lgtm. Reviewed-by: Thomas Hellström <[email protected]>
Quoted 290 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 84 +++++++++++++--------- drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c | 8 ++- include/drm/ttm/ttm_bo_api.h | 9 ++- 6 files changed, 75 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-1@@ -1919,7 +1919,9 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf)if (ret) goto unlock; - ret =ttm_bo_vm_fault_reserved (vmf, vmf->vma->vm_page_prot, + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot,TTM_BO_VM_NUM_PREFAULT ,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;drivers/gpu/drm/nouveau/nouveau_ttm.c +3
-1@@ -144,7 +144,9 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf)nouveau_bo_del_io_reserve_lru (bo); prot =vm_get_page_prot (vma->vm_flags); - ret =ttm_bo_vm_fault_reserved (vmf, prot,TTM_BO_VM_NUM_PREFAULT ,1 ); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot,TTM_BO_VM_NUM_PREFAULT ,1 );nouveau_bo_add_io_reserve_lru (bo);if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;drivers/gpu/drm/radeon/radeon_ttm.c +3
-1@@ -816,7 +816,9 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf)if (ret) goto unlock_resv; - ret =ttm_bo_vm_fault_reserved (vmf, vmf->vma->vm_page_prot, + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot,TTM_BO_VM_NUM_PREFAULT ,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) goto unlock_mclk;drivers/gpu/drm/ttm/ttm_bo_vm.c +52
-32@@ -42,7 +42,7 @@#include <linux/mem_encrypt.h> static vm_fault_t ttm_bo_vm_fault_idle (struct ttm_buffer_object *bo, -struct vm_fault *vmf) +struct vm_fault *vmf) {vm_fault_t ret =0 ;int err =0 ;@@ -122,7 +122,8 @@ static unsigned long ttm_bo_io_mem_pfn(struct ttm_buffer_object *bo,* Return: * 0 on success and the bo was reserved. * VM_FAULT_RETRY if blocking wait. -* VM_FAULT_NOPAGE if blocking wait and retrying was not allowed. +* VM_FAULT_NOPAGE if blocking wait and retrying was not allowed, or wait interrupted. +* VM_FAULT_SIGBUS if wait on bo->moving failed for reason other than a signal. */ vm_fault_t ttm_bo_vm_reserve (struct ttm_buffer_object *bo,struct vm_fault *vmf)@@ -254,7 +255,9 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf,/** * ttm_bo_vm_fault_reserved - TTM fault helper +* @bo: The buffer object * @vmf: The struct vm_fault given as argument to the fault callback +* @mmap_base: The base of the mmap, to which the @vmf fault is relative to. * @prot: The page protection to be used for this memory area. * @num_prefault: Maximum number of prefault pages. The caller may want to * specify this based on madvice settings and the size of the GPU object @@ -265,19 +268,28 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf,* memory backing the buffer object, and then returns a return code * instructing the caller to retry the page access. * +* This function ensures any pipelined wait is finished. +* +* WARNING: +* On VM_FAULT_RETRY, the bo will be unlocked by this function when +* #FAULT_FLAG_RETRY_NOWAIT is not set inside @vmf->flags. In this +* case, the caller should not unlock the @bo. +* * Return: -* VM_FAULT_NOPAGE on success or pending signal +* 0 on success. +* VM_FAULT_NOPAGE on pending signal * VM_FAULT_SIGBUS on unspecified error * VM_FAULT_OOM on out-of-memory -* VM_FAULT_RETRY if retryable wait +* VM_FAULT_RETRY if retryable wait, see WARNING above. */ -vm_fault_t ttm_bo_vm_fault_reserved (struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved (struct ttm_buffer_object *bo, +struct vm_fault *vmf, +unsigned long mmap_base,pgprot_t prot,pgoff_t num_prefault,pgoff_t fault_page_size) {struct vm_area_struct *vma = vmf->vma; -struct ttm_buffer_object *bo = vma->vm_private_data;struct ttm_device *bdev = bo->bdev;unsigned long page_offset;unsigned long page_last;@@ -286,15 +298,11 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,struct page *page;int err;pgoff_t i; -vm_fault_t ret =VM_FAULT_NOPAGE ; +vm_fault_t ret;unsigned long address = vmf->address; -/* -* Wait for buffer data in transit, due to a pipelined -* move. -*/ ret =ttm_bo_vm_fault_idle (bo, vmf); -if (unlikely (ret !=0 )) +if (ret)return ret; err =ttm_mem_io_reserve (bdev, &bo->mem);@@ -302,9 +310,8 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,return VM_FAULT_SIGBUS ; page_offset = ((address - vma->vm_start) >>PAGE_SHIFT ) + - vma->vm_pgoff -drm_vma_node_start (&bo->base.vma_node); - page_last =vma_pages (vma) + vma->vm_pgoff - -drm_vma_node_start (&bo->base.vma_node); + vma->vm_pgoff - mmap_base; + page_last =vma_pages (vma) + vma->vm_pgoff - mmap_base;if (unlikely (page_offset >= bo->mem.num_pages))return VM_FAULT_SIGBUS ;@@ -344,8 +351,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, }else if (unlikely (!page)) {break ; } - page->index =drm_vma_node_start (&bo->base.vma_node) + - page_offset; + page->index = mmap_base + page_offset; pfn =page_to_pfn (page); }@@ -392,7 +398,10 @@ vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf)return ret; prot = vma->vm_page_prot; - ret =ttm_bo_vm_fault_reserved (vmf, prot,TTM_BO_VM_NUM_PREFAULT ,1 ); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot,TTM_BO_VM_NUM_PREFAULT ,1 ); +if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;@@ -460,22 +469,16 @@ static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,return len; } -int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr, -void *buf,int len,int write) +int ttm_bo_vm_access_reserved (struct ttm_buffer_object *bo, +struct vm_area_struct *vma, +unsigned long offset, +void *buf,int len,int write) { -struct ttm_buffer_object *bo = vma->vm_private_data; -unsigned long offset = (addr) - vma->vm_start + - ((vma->vm_pgoff -drm_vma_node_start (&bo->base.vma_node)) - <<PAGE_SHIFT );int ret;if (len <1 || (offset + len) >>PAGE_SHIFT > bo->mem.num_pages)return -EIO ; - ret =ttm_bo_reserve (bo, true, false,NULL ); -if (ret) -return ret; -switch (bo->mem.mem_type) {case TTM_PL_SYSTEM :if (unlikely (bo->ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )) {@@ -485,16 +488,33 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, } fallthrough;case TTM_PL_TT : - ret =ttm_bo_vm_access_kmap (bo, offset, buf, len, write); -break ; +return ttm_bo_vm_access_kmap (bo, offset, buf, len, write);default :if (bo->bdev->funcs->access_memory) - ret = bo->bdev->funcs->access_memory ( +return bo->bdev->funcs->access_memory ( bo, offset, buf, len, write);else - ret = -EIO ; +return -EIO ; } +return ret; +} +EXPORT_SYMBOL (ttm_bo_vm_access_reserved); + +int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr, +void *buf,int len,int write) +{ +struct ttm_buffer_object *bo = vma->vm_private_data; +unsigned long offset = (addr) - vma->vm_start + + ((vma->vm_pgoff -drm_vma_node_start (&bo->base.vma_node)) + <<PAGE_SHIFT ); +int ret; + + ret =ttm_bo_reserve (bo, true, false,NULL ); +if (ret) +return ret; + + ret =ttm_bo_vm_access_reserved (bo, vma, offset, buf, len, write);ttm_bo_unreserve (bo);return ret;drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +6
-2@@ -477,7 +477,9 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)else prot =vm_get_page_prot (vma->vm_flags); - ret =ttm_bo_vm_fault_reserved (vmf, prot, num_prefault,1 ); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot, num_prefault,1 );if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;@@ -546,7 +548,9 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, prot =vm_get_page_prot (vma->vm_flags); } - ret =ttm_bo_vm_fault_reserved (vmf, prot,1 , fault_page_size); + ret =ttm_bo_vm_fault_reserved (bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot,1 , fault_page_size);if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT ))return ret;include/drm/ttm/ttm_bo_api.h +8
-1@@ -605,7 +605,9 @@ int ttm_mem_evict_first(struct ttm_device *bdev,vm_fault_t ttm_bo_vm_reserve (struct ttm_buffer_object *bo,struct vm_fault *vmf); -vm_fault_t ttm_bo_vm_fault_reserved (struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved (struct ttm_buffer_object *bo, +struct vm_fault *vmf, +unsigned long mmap_base,pgprot_t prot,pgoff_t num_prefault,pgoff_t fault_page_size);@@ -616,6 +618,11 @@ void ttm_bo_vm_open(struct vm_area_struct *vma);void ttm_bo_vm_close (struct vm_area_struct *vma); +int ttm_bo_vm_access_reserved (struct ttm_buffer_object *bo, +struct vm_area_struct *vma, +unsigned long offset, +void *buf,int len,int write); +int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr,void *buf,int len,int write);bool ttm_bo_delayed_delete (struct ttm_device *bdev,bool remove_all);
Re: [PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone
In reply to Thomas HellströmQuoted 118 lines · Thomas Hellström
i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to.
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +++++++++++++++++-------- include/drm/ttm/ttm_bo_driver.h | 23 +++++++++++ 2 files changed, 61 insertions(+), 17 deletions(-)drivers/gpu/drm/ttm/ttm_range_manager.c +38
-17@@ -125,55 +125,76 @@ static const struct ttm_resource_manager_func ttm_range_manager_func = { .debug = ttm_range_man_debug }; -int ttm_range_man_init (struct ttm_device *bdev, -unsigned type,bool use_tt, -unsigned long p_size) +struct ttm_resource_manager * +ttm_range_man_init_standalone (unsigned long size,bool use_tt) {struct ttm_resource_manager *man;struct ttm_range_manager *rman; rman =kzalloc (sizeof (*rman),GFP_KERNEL );if (!rman) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); man = &rman->manager; man->use_tt = use_tt; man->func = &ttm_range_manager_func; -ttm_resource_manager_init (man, p_size); +ttm_resource_manager_init (man, size); -drm_mm_init (&rman->mm,0 , p_size); +drm_mm_init (&rman->mm,0 , size);spin_lock_init (&rman->lock); -ttm_set_driver_manager (bdev, type, &rman->manager); +return man; +} +EXPORT_SYMBOL (ttm_range_man_init_standalone); + +int ttm_range_man_init (struct ttm_device *bdev, +unsigned int type,bool use_tt, +unsigned long p_size) +{ +struct ttm_resource_manager *man; + + man =ttm_range_man_init_standalone (p_size, use_tt); +if (IS_ERR (man)) +return PTR_ERR (man); +ttm_resource_manager_set_used (man, true); +ttm_set_driver_manager (bdev, type, man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_init); +void ttm_range_man_fini_standalone (struct ttm_resource_manager *man) +{ +struct ttm_range_manager *rman =to_range_manager (man); +struct drm_mm *mm = &rman->mm; + +spin_lock (&rman->lock); +drm_mm_clean (mm); +drm_mm_takedown (mm); +spin_unlock (&rman->lock); + +ttm_resource_manager_cleanup (man); +kfree (rman); +} +EXPORT_SYMBOL (ttm_range_man_fini_standalone); +int ttm_range_man_fini (struct ttm_device *bdev,unsigned type) {struct ttm_resource_manager *man =ttm_manager_type (bdev, type); -struct ttm_range_manager *rman =to_range_manager (man); -struct drm_mm *mm = &rman->mm;int ret;ttm_resource_manager_set_used (man, false); - ret =ttm_resource_manager_evict_all (bdev, man);if (ret)return ret; -spin_lock (&rman->lock); -drm_mm_clean (mm); -drm_mm_takedown (mm); -spin_unlock (&rman->lock); - -ttm_resource_manager_cleanup (man);ttm_set_driver_manager (bdev, type,NULL ); -kfree (rman); +ttm_range_man_fini_standalone (man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_fini);include/drm/ttm/ttm_bo_driver.h +1
-0@@ -321,6 +321,20 @@ int ttm_range_man_init(struct ttm_device *bdev, unsigned type, bool use_tt, unsigned long p_size); +/**
include/drm/ttm/ttm_bo_driver.h int ttm_range_man_init(struct ttm_device *bdev, · line 334
Quoted 10 lines
include/drm/ttm/ttm_bo_driver.h +10
-0+* 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. +*/
Kerneldoc is great and I'm happy you're updating them (Christian's not so much good for this), but I think would be good to go one step further with a prep patch:
- Make sure ttm_bo_driver.h is appropriately included in Documentation/gpu/drm-mm.rst.
- Fix up any kerneldoc fallout. Specifically I think common usage at least is that for non-inline functions, the kerneldoc is in the .c file, not in the headers.
But also this might be way too much work since ttm hasn't been properly kerneldoc-ified, so maybe later.
-Daniel
Quoted 23 lines
include/drm/ttm/ttm_bo_driver.h +12
-0+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.31.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [Intel-gfx] [PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers
In reply to Thomas HellströmQuoted 14 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
Also modify the mock region selftests somewhat to account for a fragmenting manager.
Signed-off-by Thomas Hellström <[email protected]>---
v2:
- Fix an error unwind inlmem_get_pages()(Reported by Matthew Auld)
- Break out and modify usage ofi915_sg_dma_sizes()(Reported by Mattew Auld)
- Break out TTM changes to a separate patch (Reported by Christian König)
---
<snip>
Quoted 7 lines
drivers/gpu/drm/i915/i915_scatterlist.c +6
-0+/** +* i915_sg_from_mm_node - Create an sg_table from a struct drm_mm_node +* @node: The drm_mm_node. +* @region_start: An offset to add to the dma addresses of the sg list. +* +* Create a struct sg_table, initializing it from a struct drm_mm_node,
drivers/gpu/drm/i915/i915_scatterlist.c bool i915_sg_trim(struct sg_table *orig_st) · line 56
Quoted 10 lines
drivers/gpu/drm/i915/i915_scatterlist.c +10
-0+* taking a maximum segment length into account, splitting into segments +* if necessary. +* +* Return: A pointer to a kmalloced struct sg_table on success, negative +* error code cast to an error pointer on failure. +*/ +struct sg_table *i915_sg_from_mm_node (const struct drm_mm_node *node, +u64 region_start) +{ +const u64 max_segment =SZ_1G ;/* Do we have a limit on this? */
For lmem just INT_MAX I think, which is the limit of the sg, but really doesn't matter for now, this should be totally fine for now.
Assuming CI is happy,
Also we could maybe fling this series with the HAX autoprobing patch for DG1 at trybot, just to see where we are?
Re: [Intel-gfx] [PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers
In reply to Thomas HellströmQuoted 14 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
Also modify the mock region selftests somewhat to account for a fragmenting manager.
Signed-off-by Thomas Hellström <[email protected]>---
v2:
- Fix an error unwind inlmem_get_pages()(Reported by Matthew Auld)
- Break out and modify usage ofi915_sg_dma_sizes()(Reported by Mattew Auld)
- Break out TTM changes to a separate patch (Reported by Christian König)
---
<snip>
Quoted 9 lines
drivers/gpu/drm/i915/selftests/mock_region.c +9
-0+ +static int mock_region_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 ;
drivers/gpu/drm/i915/selftests/mock_region.c line 39
Quoted 10 lines
drivers/gpu/drm/i915/selftests/mock_region.c +10
-0+ + 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); + + pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); +if (IS_ERR (pages)) +return PTR_ERR (pages);
Needs some onion?
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH v2 05/15] drm/i915/ttm Initialize the ttm device and memory managers
Quoted 29 lines · Matthew Auld
Quoted 13 lines · Thomas Hellström
Temporarily remove the buddy allocator and related selftests and hook up the TTM range manager for i915 regions.
Also modify the mock region selftests somewhat to account for a fragmenting manager.
Signed-off-by Thomas Hellström <[email protected]>---
v2:
- Fix an error unwind inlmem_get_pages()(Reported by Matthew Auld)
- Break out and modify usage ofi915_sg_dma_sizes()(Reported by Mattew Auld)
- Break out TTM changes to a separate patch (Reported by Christian König)
---<snip>
Quoted 12 lines
drivers/gpu/drm/i915/selftests/mock_region.c +12
-0+ +static int mock_region_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,
Quoted 8 lines
drivers/gpu/drm/i915/selftests/mock_region.c line 39
Quoted 7 lines
drivers/gpu/drm/i915/selftests/mock_region.c +7
-0+ flags); +if (IS_ERR (obj->mm.st_mm_node)) +return PTR_ERR (obj->mm.st_mm_node); + + pages =intel_region_ttm_node_to_st (obj->mm.region, obj->mm.st_mm_node); +if (IS_ERR (pages)) +return PTR_ERR (pages);Needs some onion?
Ah, yes.
/Thomas
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
URL : https://patchwork.freedesktop.org/series/90022/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10094 -> Patchwork_20142
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_20142 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_20142, 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_20142/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_20142:
### IGT changes ###
#### Possible regressions ####
* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@[email protected]
#### Warnings ####
* igt@i915_selftest@live@execlists:
- fi-bsw-kefka: [INCOMPLETE][2] ([i915#2782] / [i915#2940]) -> [DMESG-FAIL][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-kefka/igt@i915_selftest@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-kefka/igt@i915_selftest@[email protected]
Known issues
------------
Here are the changes found in Patchwork_20142 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-gfx:
- fi-hsw-4770: NOTRUN -> [SKIP][4] ([fdo#109271] / [fdo#109315]) +17 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@amdgpu/[email protected]
* igt@amdgpu/amd_cs_nop@nop-compute0:
- fi-ilk-650: NOTRUN -> [SKIP][5] ([fdo#109271]) +30 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@amdgpu/[email protected]
* igt@core_hotunplug@unbind-rebind:
- fi-hsw-4770: NOTRUN -> [WARN][6] ([i915#2283])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
- fi-bdw-5557u: NOTRUN -> [WARN][7] ([i915#2283])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@[email protected]
* igt@gem_busy@busy@all:
- fi-elk-e7500: [PASS][8] -> [FAIL][9] ([i915#3457])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-elk-e7500/igt@gem_busy@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-elk-e7500/igt@gem_busy@[email protected]
* igt@gem_exec_fence@basic-await@vecs0:
- fi-bsw-kefka: [PASS][10] -> [FAIL][11] ([i915#3457]) +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@basic-busy@bcs0:
- fi-cml-u2: NOTRUN -> [SKIP][12] ([i915#1208]) +1 similar issue
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@nb-await@vcs0:
- fi-glk-dsi: NOTRUN -> [FAIL][13] ([i915#3457]) +6 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@gem_exec_fence@[email protected]
* igt@gem_exec_fence@nb-await@vecs0:
- fi-bsw-n3050: [PASS][14] -> [FAIL][15] ([i915#3457])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
* igt@gem_huc_copy@huc-copy:
- fi-cml-u2: NOTRUN -> [SKIP][16] ([i915#2190])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
- fi-hsw-4770: NOTRUN -> [SKIP][17] ([fdo#109271]) +4 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#2190])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@[email protected]
- fi-glk-dsi: NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#2190])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@[email protected]
- fi-kbl-7500u: NOTRUN -> [SKIP][20] ([fdo#109271] / [i915#2190])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@[email protected]
- fi-kbl-7567u: NOTRUN -> [SKIP][21] ([fdo#109271] / [i915#2190])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [SKIP][22] ([fdo#109271] / [i915#2190])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@[email protected]
- fi-cfl-8700k: NOTRUN -> [SKIP][23] ([fdo#109271] / [i915#2190])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][24] ([i915#2190])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
* igt@gem_wait@busy@all:
- fi-bwr-2160: [PASS][25] -> [FAIL][26] ([i915#3457])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bwr-2160/igt@gem_wait@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bwr-2160/igt@gem_wait@[email protected]
* igt@i915_module_load@reload:
- fi-icl-u2: NOTRUN -> [DMESG-WARN][27] ([i915#3457]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
- fi-cml-u2: NOTRUN -> [DMESG-WARN][28] ([i915#3457]) +1 similar issue
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
- fi-cfl-8700k: NOTRUN -> [DMESG-WARN][29] ([i915#3457]) +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-hsw-4770: NOTRUN -> [DMESG-WARN][30] ([i915#3457]) +1 similar issue
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
- fi-ilk-650: NOTRUN -> [DMESG-FAIL][31] ([i915#3457]) +1 similar issue
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [DMESG-WARN][32] ([i915#3457]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@[email protected]
- fi-glk-dsi: NOTRUN -> [DMESG-FAIL][33] ([i915#3457])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@[email protected]
* igt@i915_pm_backlight@basic-brightness:
- fi-hsw-4770: NOTRUN -> [SKIP][34] ([fdo#109271] / [i915#3012])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
* igt@i915_selftest@live@execlists:
- fi-cfl-8109u: NOTRUN -> [DMESG-FAIL][35] ([i915#3462])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@i915_selftest@[email protected]
- fi-glk-dsi: NOTRUN -> [DMESG-FAIL][36] ([i915#3462])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@i915_selftest@[email protected]
- fi-icl-u2: NOTRUN -> [DMESG-FAIL][37] ([i915#3462])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@i915_selftest@[email protected]
- fi-cfl-8700k: NOTRUN -> [DMESG-FAIL][38] ([i915#3462])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@i915_selftest@[email protected]
- fi-kbl-7567u: NOTRUN -> [INCOMPLETE][39] ([i915#2782] / [i915#3462] / [i915#794])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@i915_selftest@[email protected]
- fi-skl-6700k2: NOTRUN -> [DMESG-FAIL][40] ([i915#3462])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@i915_selftest@[email protected]
- fi-cml-u2: NOTRUN -> [DMESG-FAIL][41] ([i915#3462])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@i915_selftest@[email protected]
- fi-bdw-5557u: NOTRUN -> [DMESG-FAIL][42] ([i915#3462])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@i915_selftest@[email protected]
- fi-kbl-7500u: NOTRUN -> [DMESG-FAIL][43] ([i915#3462])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@mman:
- fi-bdw-5557u: NOTRUN -> [DMESG-WARN][44] ([i915#3457]) +1 similar issue
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@i915_selftest@[email protected]
- fi-cfl-8109u: NOTRUN -> [DMESG-WARN][45] ([i915#3457]) +1 similar issue
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@i915_selftest@[email protected]
- fi-snb-2600: NOTRUN -> [DMESG-WARN][46] ([i915#3457]) +1 similar issue
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-snb-2600/igt@i915_selftest@[email protected]
- fi-kbl-7567u: NOTRUN -> [DMESG-WARN][47] ([i915#3457]) +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@i915_selftest@[email protected]
- fi-glk-dsi: NOTRUN -> [DMESG-WARN][48] ([i915#3457])
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@i915_selftest@[email protected]
- fi-kbl-7500u: NOTRUN -> [DMESG-WARN][49] ([i915#3457]) +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@i915_selftest@[email protected]
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-snb-2600: NOTRUN -> [SKIP][50] ([fdo#109271]) +37 similar issues
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-snb-2600/igt@[email protected]
* igt@kms_busy@basic@modeset:
- fi-ilk-650: NOTRUN -> [INCOMPLETE][51] ([i915#3457])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@kms_busy@[email protected]
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-hsw-4770: NOTRUN -> [SKIP][52] ([fdo#109271] / [fdo#111827]) +8 similar issues
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7567u: NOTRUN -> [SKIP][53] ([fdo#109271] / [fdo#111827]) +8 similar issues
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@[email protected]
- fi-bdw-5557u: NOTRUN -> [SKIP][54] ([fdo#109271] / [fdo#111827]) +8 similar issues
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@[email protected]
* igt@kms_chamelium@dp-hpd-fast:
- fi-ilk-650: NOTRUN -> [SKIP][55] ([fdo#109271] / [fdo#111827]) +8 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [SKIP][56] ([fdo#109271]) +13 similar issues
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@[email protected]
- fi-cml-u2: NOTRUN -> [SKIP][57] ([fdo#109284] / [fdo#111827]) +8 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
* igt@kms_chamelium@hdmi-crc-fast:
- fi-snb-2600: NOTRUN -> [SKIP][58] ([fdo#109271] / [fdo#111827]) +8 similar issues
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-snb-2600/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-glk-dsi: NOTRUN -> [SKIP][59] ([fdo#109271] / [fdo#111827]) +8 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [SKIP][60] ([fdo#109271] / [fdo#111827]) +8 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@[email protected]
* igt@kms_chamelium@vga-edid-read:
- fi-cfl-8700k: NOTRUN -> [SKIP][61] ([fdo#109271] / [fdo#111827]) +8 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][62] ([fdo#109309]) +1 similar issue
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-ilk-650: NOTRUN -> [FAIL][63] ([i915#3457]) +1 similar issue
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@[email protected]
- fi-kbl-soraka: [PASS][64] -> [DMESG-WARN][65] ([i915#1982] / [i915#3457])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-kbl-soraka/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-soraka/igt@[email protected]
* igt@kms_force_connector_basic@force-load-detect:
- fi-cml-u2: NOTRUN -> [SKIP][66] ([fdo#109285])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][67] ([fdo#109285])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-hsw-4770: NOTRUN -> [SKIP][68] ([fdo#109271] / [i915#533])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@[email protected]
- fi-kbl-7500u: NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#533])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@[email protected]
- fi-cml-u2: NOTRUN -> [SKIP][70] ([fdo#109278] / [i915#533])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
- fi-cfl-8700k: NOTRUN -> [SKIP][71] ([fdo#109271] / [i915#533])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][72] ([fdo#109278])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [SKIP][73] ([fdo#109271] / [i915#533])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [SKIP][74] ([fdo#109271] / [i915#533])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@[email protected]
- fi-glk-dsi: NOTRUN -> [SKIP][75] ([fdo#109271] / [i915#533])
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@[email protected]
- fi-kbl-7567u: NOTRUN -> [SKIP][76] ([fdo#109271] / [i915#533])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@[email protected]
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-bwr-2160: [PASS][77] -> [FAIL][78] ([i915#53])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bwr-2160/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bwr-2160/igt@[email protected]
* igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-elk-e7500: [PASS][79] -> [FAIL][80] ([i915#53]) +1 similar issue
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-elk-e7500/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-elk-e7500/igt@[email protected]
* igt@kms_pipe_crc_basic@read-crc-pipe-c:
- fi-kbl-7567u: NOTRUN -> [SKIP][81] ([fdo#109271]) +41 similar issues
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@[email protected]
* igt@kms_psr@cursor_plane_move:
- fi-bdw-5557u: NOTRUN -> [SKIP][82] ([fdo#109271]) +9 similar issues
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bdw-5557u/igt@kms_psr@cursor_plane_move.html
* igt@kms_psr@primary_mmap_gtt:
- fi-cfl-8109u: NOTRUN -> [SKIP][83] ([fdo#109271]) +8 similar issues
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@kms_psr@primary_mmap_gtt.html
- fi-kbl-7500u: NOTRUN -> [SKIP][84] ([fdo#109271]) +10 similar issues
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@kms_psr@primary_mmap_gtt.html
- fi-hsw-4770: NOTRUN -> [SKIP][85] ([fdo#109271] / [i915#1072]) +3 similar issues
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-hsw-4770/igt@kms_psr@primary_mmap_gtt.html
* igt@kms_psr@primary_page_flip:
- fi-glk-dsi: NOTRUN -> [SKIP][86] ([fdo#109271]) +10 similar issues
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@kms_psr@primary_page_flip.html
* igt@prime_vgem@basic-userptr:
- fi-cfl-8700k: NOTRUN -> [SKIP][87] ([fdo#109271]) +8 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][88] ([i915#3301])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
- fi-cml-u2: NOTRUN -> [SKIP][89] ([i915#3301])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
* igt@runner@aborted:
- fi-cfl-8700k: NOTRUN -> [FAIL][90] ([i915#3363])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8700k/igt@[email protected]
- fi-cfl-8109u: NOTRUN -> [FAIL][91] ([i915#2426] / [i915#3363])
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cfl-8109u/igt@[email protected]
- fi-icl-u2: NOTRUN -> [FAIL][92] ([i915#2426] / [i915#2782] / [i915#3363])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-icl-u2/igt@[email protected]
- fi-glk-dsi: NOTRUN -> [FAIL][93] ([i915#3363] / [k.org#202321])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-glk-dsi/igt@[email protected]
- fi-kbl-7500u: NOTRUN -> [FAIL][94] ([i915#1436] / [i915#3363])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7500u/igt@[email protected]
- fi-cml-u2: NOTRUN -> [FAIL][95] ([i915#2082] / [i915#2426] / [i915#3363])
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-cml-u2/igt@[email protected]
- fi-kbl-7567u: NOTRUN -> [FAIL][96] ([i915#1436] / [i915#2426] / [i915#3363])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-kbl-7567u/igt@[email protected]
- fi-skl-6700k2: NOTRUN -> [FAIL][97] ([i915#1436] / [i915#3363])
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-skl-6700k2/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_fence@nb-await@bcs0:
- fi-bsw-kefka: [FAIL][98] ([i915#3457]) -> [PASS][99]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-kefka/igt@gem_exec_fence@[email protected]
- fi-bsw-n3050: [FAIL][100] ([i915#3457]) -> [PASS][101] +1 similar issue
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-n3050/igt@gem_exec_fence@[email protected]
* igt@kms_busy@basic@flip:
- fi-ilk-650: [INCOMPLETE][102] ([i915#3457]) -> [PASS][103]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-ilk-650/igt@kms_busy@[email protected]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-ilk-650/igt@kms_busy@[email protected]
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-elk-e7500: [FAIL][104] ([i915#53]) -> [PASS][105] +1 similar issue
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-elk-e7500/igt@[email protected]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-elk-e7500/igt@[email protected]
* igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
- fi-bsw-kefka: [FAIL][106] ([i915#53]) -> [PASS][107]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bsw-kefka/igt@[email protected]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bsw-kefka/igt@[email protected]
#### Warnings ####
* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [FAIL][108] ([i915#3472]) -> [FAIL][109] ([i915#3457] / [i915#3472])
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-pnv-d510/igt@[email protected]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-pnv-d510/igt@[email protected]
* igt@i915_module_load@reload:
- fi-elk-e7500: [DMESG-FAIL][110] ([i915#3457]) -> [DMESG-WARN][111] ([i915#3457])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-elk-e7500/igt@[email protected]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-elk-e7500/igt@[email protected]
* igt@i915_selftest@live@mman:
- fi-bwr-2160: [DMESG-WARN][112] ([i915#3457]) -> [DMESG-FAIL][113] ([i915#3457])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/fi-bwr-2160/igt@i915_selftest@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/fi-bwr-2160/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1021]: https://gitlab.freedesktop.org/drm/intel/issues/1021
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1208]: https://gitlab.freedesktop.org/drm/intel/issues/1208
[i915#1222]: https://gitlab.freedesktop.org/drm/intel/issues/1222
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2082]: https://gitlab.freedesktop.org/drm/intel/issues/2082
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2283]: https://gitlab.freedesktop.org/drm/intel/issues/2283
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2505]: https://gitlab.freedesktop.org/drm/intel/issues/2505
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#2932]: https://gitlab.freedesktop.org/drm/intel/issues/2932
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#2966]: https://gitlab.freedesktop.org/drm/intel/issues/2966
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#3457]: https://gitlab.freedesktop.org/drm/intel/issues/3457
[i915#3462]: https://gitlab.freedesktop.org/drm/intel/issues/3462
[i915#3472]: https://gitlab.freedesktop.org/drm/intel/issues/3472
[i915#53]: https://gitlab.freedesktop.org/drm/intel/issues/53
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#794]: https://gitlab.freedesktop.org/drm/intel/issues/794
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
Participating hosts (24 -> 35)
------------------------------
Additional (13): fi-kbl-7567u fi-cml-u2 fi-jsl-1 fi-ehl-1 fi-bdw-5557u fi-glk-dsi fi-icl-u2 fi-cfl-8700k fi-kbl-7500u fi-hsw-4770 fi-cfl-8109u fi-skl-6700k2 fi-snb-2600
Missing (2): fi-bsw-cyan fi-bsw-nick
Build changes
-------------
* Linux: CI_DRM_10094 -> Patchwork_20142
CI-20190529: 20190529
CI_DRM_10094: 8c6b35ef6a4accca881b1142b3a73ba3725797c7 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6085: aacb1384378131b87121219a6a7ccd8b8f1e5d8d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_20142: 17af87b6b030fd638c3912e4b284577c4871111d @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
17af87b6b030 drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfnbea92372457b drm/i915: Use ttm mmap handling for ttm bo's.7199fd0658f1 drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers. d85d5bfe5022 drm/i915: Disable mmap ioctl for gen12+f897aee184bd drm/i915/lmem: Verify checks for lmem residency36729bdb371d drm/i915/ttm: Introduce a TTM i915 gem object backend75550f88727b drm/ttm, drm/amdgpu: Allow the driver some control over swapping 3ed6aaedd277 drm/i915/ttm Add a generic TTM memcpy move for page-based iomem 32e0235ecbbf drm/ttm: Export ttm_bo_tt_destroy()a3796d8feda9 drm/i915/ttm: Embed a ttm buffer object in the i915 gem object 01c0540773c7 drm/i915/ttm Initialize the ttm device and memory managers 1b455d3307a9 drm/ttm: Export functions to initialize and finalize the ttm range manager standalone a1fb9cdc093f drm/i915: Fix i915_sg_page_sizes to record dma segments rather than physical pages 425af44621a2 drm/i915: Don't free shared locks while sharedf95eea0001a4 drm/i915: Untangle the vma pages_mutex
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2 14/15] drm/i915: Use ttm mmap handling for ttm bo's.
In reply to Thomas HellströmQuoted 5 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
Use the ttm handlers for servicing page faults, and
vm_access.Signed-off-by Maarten Lankhorst <[email protected]>
LGTM. Just need to make sure we don't forget about the caching.
Quoted 229 lines
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 17 ++- drivers/gpu/drm/i915/gem/i915_gem_mman.h | 2 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 105 +++++++++++++++++- 4 files changed, 118 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_mman.c +11
-6@@ -19,6 +19,7 @@#include "i915_gem_mman.h" #include "i915_trace.h" #include "i915_user_extensions.h" +#include "i915_gem_ttm.h" #include "i915_vma.h" static inline bool@@ -789,7 +790,7 @@ i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data,return __assign_mmap_offset (file, args->handle, type, &args->offset); } -static void vm_open (struct vm_area_struct *vma) +void i915_gem_mmap_vm_open (struct vm_area_struct *vma) {struct i915_mmap_offset *mmo = vma->vm_private_data;struct drm_i915_gem_object *obj = mmo->obj;@@ -798,7 +799,7 @@ static void vm_open(struct vm_area_struct *vma)i915_gem_object_get (obj); } -static void vm_close (struct vm_area_struct *vma) +void i915_gem_mmap_vm_close (struct vm_area_struct *vma) {struct i915_mmap_offset *mmo = vma->vm_private_data;struct drm_i915_gem_object *obj = mmo->obj;@@ -810,15 +811,15 @@ static void vm_close(struct vm_area_struct *vma)static const struct vm_operations_struct vm_ops_gtt = { .fault = vm_fault_gtt, .access = vm_access, - .open = vm_open, - .close = vm_close, + .open = i915_gem_mmap_vm_open, + .close = i915_gem_mmap_vm_close, };static const struct vm_operations_struct vm_ops_cpu = { .fault = vm_fault_cpu, .access = vm_access, - .open = vm_open, - .close = vm_close, + .open = i915_gem_mmap_vm_open, + .close = i915_gem_mmap_vm_close, };static int singleton_release (struct inode *inode,struct file *file)@@ -953,6 +954,10 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma) } vma->vm_page_prot =pgprot_decrypted (vma->vm_page_prot); +/* override ops per-object if desired */ +if (obj->ops->mmap_ops) + vma->vm_ops = obj->ops->mmap_ops; +return 0 ; }drivers/gpu/drm/i915/gem/i915_gem_mman.h +2
-0@@ -28,5 +28,7 @@ void __i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj);void i915_gem_object_release_mmap_gtt (struct drm_i915_gem_object *obj);void i915_gem_object_release_mmap_offset (struct drm_i915_gem_object *obj); +void i915_gem_mmap_vm_open (struct vm_area_struct *vma); +void i915_gem_mmap_vm_close (struct vm_area_struct *vma);#endif drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1
-0@@ -79,6 +79,7 @@ struct drm_i915_gem_object_ops {void (*delayed_free)(struct drm_i915_gem_object *obj);void (*release)(struct drm_i915_gem_object *obj); +const struct vm_operations_struct *mmap_ops;const char *name;/* friendly name for debug, e.g. lockdep classes */ };drivers/gpu/drm/i915/gem/i915_gem_ttm.c +103
-1@@ -14,6 +14,7 @@#include "gem/i915_gem_region.h" #include "gem/i915_gem_ttm.h" #include "gem/i915_gem_ttm_bo_util.h" +#include "gem/i915_gem_mman.h" #define I915_PL_LMEM0 TTM_PL_PRIV#define I915_PL_SYSTEM TTM_PL_SYSTEM@@ -345,6 +346,44 @@ static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,return 0 ; } +static int i915_ttm_io_mem_reserve (struct ttm_device *bdev,struct ttm_resource *mem) +{ +if (mem->mem_type <I915_PL_LMEM0 ) +return 0 ; + +/* We may need to revisit this later, but this allows all caching to be used in mmap */ + mem->bus.caching = ttm_cached; + mem->bus.is_iomem = true; + +return 0 ; +} + +static unsigned long i915_ttm_io_mem_pfn (struct ttm_buffer_object *bo, +unsigned long page_offset) +{ +struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); +struct sg_table *sgt = obj->ttm.cached_io_st; +struct scatterlist *sg; +unsigned int i; + +GEM_WARN_ON (bo->ttm); + +for_each_sgtable_dma_sg (sgt, sg, i) { +unsigned long sg_max = sg->length >>PAGE_SHIFT ; + +if (page_offset < sg_max) { +unsigned long base = + obj->mm.region->iomap.base - obj->mm.region->region.start; + +return ((base +sg_dma_address (sg)) >>PAGE_SHIFT ) + page_offset; + } + + page_offset -= sg_max; + } +GEM_BUG_ON (1 ); +return 0 ; +} +struct ttm_device_funcs i915_ttm_bo_driver = { .ttm_tt_create = i915_ttm_tt_create, .ttm_tt_unpopulate = i915_ttm_tt_unpopulate,@@ -355,6 +394,8 @@ struct ttm_device_funcs i915_ttm_bo_driver = { .verify_access = NULL, .swap_notify = i915_ttm_swap_notify, .delete_mem_notify = i915_ttm_delete_mem_notify, + .io_mem_reserve = i915_ttm_io_mem_reserve, + .io_mem_pfn = i915_ttm_io_mem_pfn, };static int i915_ttm_get_pages (struct drm_i915_gem_object *obj)@@ -454,7 +495,68 @@ 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 = { +static vm_fault_t vm_fault_ttm (struct vm_fault *vmf) +{ +struct vm_area_struct *area = vmf->vma; +struct i915_mmap_offset *mmo = area->vm_private_data; +struct drm_i915_gem_object *obj = mmo->obj; +vm_fault_t ret; + +/* Sanity check that we allow writing into this object */ +if (unlikely (i915_gem_object_is_readonly (obj) && + area->vm_flags &VM_WRITE )) +return VM_FAULT_SIGBUS ; + + ret =ttm_bo_vm_reserve (i915_gem_to_ttm (obj), vmf); +if (ret) +return ret; + + ret =ttm_bo_vm_fault_reserved (i915_gem_to_ttm (obj), vmf, +drm_vma_node_start (&mmo->vma_node), + vmf->vma->vm_page_prot, +TTM_BO_VM_NUM_PREFAULT ,1 ); +if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) +return ret; + +dma_resv_unlock (obj->base.resv); + +return ret; +} + +static int +vm_access_ttm (struct vm_area_struct *area,unsigned long addr, +void *buf,int len,int write) +{ +struct i915_mmap_offset *mmo = area->vm_private_data; +struct drm_i915_gem_object *obj = mmo->obj; +int err =0 ; + +if (i915_gem_object_is_readonly (obj) && write) +return -EACCES ; + + addr -= area->vm_start; +if (addr >= obj->base.size) +return -EINVAL ; + + err =i915_gem_object_lock_interruptible (obj,NULL ); +if (err) +return err; + + len =ttm_bo_vm_access_reserved (i915_gem_to_ttm (obj), area, + addr, buf, len, write); +i915_gem_object_unlock (obj); + +return len; +} + +static const struct vm_operations_struct vm_ops_ttm = { + .fault = vm_fault_ttm, + .access = vm_access_ttm, + .open = i915_gem_mmap_vm_open, + .close = i915_gem_mmap_vm_close, +}; + +const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = { .name ="i915_gem_object_ttm" , .flags =I915_GEM_OBJECT_HAS_IOMEM ,
drivers/gpu/drm/i915/gem/i915_gem_ttm.c static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = { · line 571
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +1
-0@@ -463,6 +565,7 @@ static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = { .truncate = i915_ttm_purge, .adjust_lru = i915_ttm_adjust_lru, .delayed_free = i915_ttm_delayed_free, + .mmap_ops = &vm_ops_ttm, };void i915_ttm_bo_destroy (struct ttm_buffer_object *bo)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2 15/15] drm/i915/ttm: Add io sgt caching to i915_ttm_io_mem_pfn
In reply to Thomas HellströmQuoted 147 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
Instead of walking the sg table manually, use our caching helpers to do the sgt caching. To prevent lifetime issues of
ttm_bovsi915_gem_object, we will use a separate member, instead of re-using the dma page member.Signed-off-by Maarten Lankhorst <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 6 +-- .../gpu/drm/i915/gem/i915_gem_object_types.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_pages.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 46 ++++++++++--------- 4 files changed, 30 insertions(+), 26 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_object.h +3
-3@@ -342,14 +342,14 @@ struct scatterlist * __i915_gem_object_get_sg(struct drm_i915_gem_object *obj, struct i915_gem_object_page_iter *iter, unsigned int n, - unsigned int *offset, bool allow_alloc); + unsigned int *offset, bool allow_alloc, bool dma);static inline struct scatterlist *i915_gem_object_get_sg (struct drm_i915_gem_object *obj,unsigned int n,unsigned int *offset,bool allow_alloc) { -return __i915_gem_object_get_sg (obj, &obj->mm.get_page, n, offset, allow_alloc); +return __i915_gem_object_get_sg (obj, &obj->mm.get_page, n, offset, allow_alloc, false); } static inline struct scatterlist *@@ -357,7 +357,7 @@ i915_gem_object_get_sg_dma(struct drm_i915_gem_object *obj,unsigned int n, unsigned int *offset, bool allow_alloc) { - return __i915_gem_object_get_sg(obj, &obj->mm.get_dma_page, n, offset, allow_alloc); + return __i915_gem_object_get_sg(obj, &obj->mm.get_dma_page, n, offset, allow_alloc, true); } struct page *drivers/gpu/drm/i915/gem/i915_gem_object_types.h +1
-0@@ -324,6 +324,7 @@ struct drm_i915_gem_object {struct {struct sg_table *cached_io_st; +struct i915_gem_object_page_iter get_io_page; } ttm;/** Record of address bit 17 of each page at last unbind. */ drivers/gpu/drm/i915/gem/i915_gem_pages.c +1
-2@@ -465,9 +465,8 @@ __i915_gem_object_get_sg(struct drm_i915_gem_object *obj,struct i915_gem_object_page_iter *iter, unsigned int n, unsigned int *offset, - bool allow_alloc) + bool allow_alloc, bool dma) { - const bool dma = iter == &obj->mm.get_dma_page; struct scatterlist *sg;unsigned int idx, count;drivers/gpu/drm/i915/gem/i915_gem_ttm.c +22
-21@@ -167,11 +167,20 @@ static int i915_ttm_move_notify(struct ttm_buffer_object *bo)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 ; - } +struct radix_tree_iter iter; +void __rcu **slot; + +if (!obj->ttm.cached_io_st) +return ; + +rcu_read_lock (); +radix_tree_for_each_slot (slot, &obj->ttm.get_io_page.radix, &iter,0 ) +radix_tree_delete (&obj->ttm.get_io_page.radix, iter.index); +rcu_read_unlock (); + +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)@@ -340,8 +349,11 @@ static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,i915_ttm_move_memcpy (bo, new_mem, new_iter, old_iter);i915_ttm_free_cached_io_st (obj); -if (!new_man->use_tt) +if (!new_man->use_tt) { obj->ttm.cached_io_st = new_st; + obj->ttm.get_io_page.sg_pos = new_st->sgl; + obj->ttm.get_io_page.sg_idx =0 ; + }return 0 ; }@@ -362,26 +374,15 @@ static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo, unsigned long page_offset) {struct drm_i915_gem_object *obj =i915_ttm_to_gem (bo); -struct sg_table *sgt = obj->ttm.cached_io_st; +unsigned long base = obj->mm.region->iomap.base - obj->mm.region->region.start;struct scatterlist *sg; -unsigned int i; +unsigned int ofs;GEM_WARN_ON (bo->ttm); -for_each_sgtable_dma_sg (sgt, sg, i) { -unsigned long sg_max = sg->length >>PAGE_SHIFT ; + sg =__i915_gem_object_get_sg (obj, &obj->ttm.get_io_page, page_offset, &ofs, true, true); -if (page_offset < sg_max) { -unsigned long base = - obj->mm.region->iomap.base - obj->mm.region->region.start; - -return ((base +sg_dma_address (sg)) >>PAGE_SHIFT ) + page_offset; - } - - page_offset -= sg_max; - } -GEM_BUG_ON (1 ); -return 0 ; +return ((base +sg_dma_address (sg)) >>PAGE_SHIFT ) + ofs; }struct ttm_device_funcs i915_ttm_bo_driver = {
drivers/gpu/drm/i915/gem/i915_gem_ttm.c int __i915_gem_ttm_object_init(struct intel_memory_region *mem, · line 619
Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +3
-0@@ -613,6 +614,9 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem, obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ;i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); +INIT_RADIX_TREE (&obj->ttm.get_io_page.radix,GFP_KERNEL | __GFP_NOWARN); +mutex_init (&obj->ttm.get_io_page.lock); +
Perhaps a mutex_destroy() in error path and destructor for full debugging purposes?
Otherwise LGTM,
Quoted 3 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +0
-0ret =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);
Re: [PATCH v2 01/15] drm/i915: Untangle the vma pages_mutex
In reply to Thomas HellströmHey,
This needs a small fix, otherwise looks good.
Op 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 67 lines
From: Thomas Hellström <[email protected]>
Any sleeping
dma_resvlock taken while the vmapages_mutexis held will cause a lockdep splat.
Move thei915_gem_object_pin_pages()call out of thepages_mutexcritical section.Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/i915_vma.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/i915_vma.c +17
-12@@ -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; }
drivers/gpu/drm/i915/i915_vma.c static void __vma_put_pages(struct i915_vma *vma, unsigned int count) · line 849
Quoted 9 lines
drivers/gpu/drm/i915/i915_vma.c +2
-2@@ -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);
You're unconditionally unpinning pages here, if pages_count wasn't dropped to 0, we will go negative.
With that fixed:
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 02/15] drm/i915: Don't free shared locks while shared
In reply to Thomas HellströmOp 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 41 lines
We 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 take additional measures to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown
Signed-off-by Thomas Hellström <[email protected]>---
v2: Try harder to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown.--- 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 | 19 ++++++-- drivers/gpu/drm/i915/gt/intel_gtt.c | 45 +++++++++++++++---- drivers/gpu/drm/i915/gt/intel_gtt.h | 30 ++++++++++++- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 5 +++ 7 files changed, 92 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 +0
-0
drivers/gpu/drm/i915/gem/i915_gem_object_types.h struct drm_i915_gem_object { · line 152
Quoted 4 lines
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;
Since this can only be a vm object, would it make sense to make this a pointer to the vm address space, so we can call vm_resv_put on it directly?
The current pointer type and name makes it look generic, but if you try to use it with anything but an address space, it will blow up.
Otherwise looks good. I guess we cannot force all bo's to be deleted before the vm is freed. :-)
So with that fixed
~Maarten
Quoted 264 lines
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +0
-0union {struct rcu_head rcu;drivers/gpu/drm/i915/gt/intel_ggtt.c +16
-3@@ -746,7 +746,6 @@ 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);arch_phys_wc_del (ggtt->mtrr);@@ -768,6 +767,19 @@ void i915_ggtt_driver_release(struct drm_i915_private *i915)ggtt_cleanup_hw (ggtt); } +/** +* i915_ggtt_driver_late_release - Cleanup of GGTT that needs to be done after +* all free objects have been drained. +* @i915: i915 device +*/ +void i915_ggtt_driver_late_release (struct drm_i915_private *i915) +{ +struct i915_ggtt *ggtt = &i915->ggtt; + +GEM_WARN_ON (kref_read (&ggtt->vm.resv_ref) !=1 ); +dma_resv_fini (&ggtt->vm._resv); +} +static unsigned int gen6_get_total_gtt_size (u16 snb_gmch_ctl) { snb_gmch_ctl >>=SNB_GMCH_GGMS_SHIFT ;@@ -829,6 +841,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 +1148,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 +1157,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@@ -22,8 +22,11 @@ struct drm_i915_gem_object *alloc_pt_lmem(struct i915_address_space *vm, int sz)* object underneath, with the idea that one object_lock() will lock * them all at once. */ -if (!IS_ERR (obj)) - obj->base.resv = &vm->resv; +if (!IS_ERR (obj)) { + obj->base.resv =i915_vm_resv_get (vm); + obj->resv_shared_from = obj->base.resv; + } +return obj; }@@ -40,8 +43,11 @@ struct drm_i915_gem_object *alloc_pt_dma(struct i915_address_space *vm, int sz)* object underneath, with the idea that one object_lock() will lock * them all at once. */ -if (!IS_ERR (obj)) - obj->base.resv = &vm->resv; +if (!IS_ERR (obj)) { + obj->base.resv =i915_vm_resv_get (vm); + obj->resv_shared_from = obj->base.resv; + } +return obj; }@@ -102,7 +108,7 @@ void __i915_vm_close(struct i915_address_space *vm)int i915_vm_lock_objects (struct i915_address_space *vm,struct i915_gem_ww_ctx *ww) { -if (vm->scratch[0 ]->base.resv == &vm->resv) { +if (vm->scratch[0 ]->base.resv == &vm->_resv) {return i915_gem_object_lock (vm->scratch[0 ], ww); }else {struct i915_ppgtt *ppgtt =i915_vm_to_ppgtt (vm);@@ -118,6 +124,22 @@ void i915_address_space_fini(struct i915_address_space *vm)mutex_destroy (&vm->mutex); } +/** +* i915_vm_resv_release - Final struct i915_address_space destructor +* @kref: Pointer to the &i915_address_space.resv_ref member. +* +* This function is called when the last lock sharer no longer shares the +* &i915_address_space._resv lock. +*/ +void i915_vm_resv_release (struct kref *kref) +{ +struct i915_address_space *vm = +container_of (kref,typeof (*vm), resv_ref); + +dma_resv_fini (&vm->_resv); +kfree (vm); +} +static void __i915_vm_release (struct work_struct *work) { struct i915_address_space *vm =@@ -125,9 +147,8 @@ static void __i915_vm_release(struct work_struct *work) vm->cleanup (vm);i915_address_space_fini (vm); -dma_resv_fini (&vm->resv); -kfree (vm); +i915_vm_resv_put (&vm->_resv); }void i915_vm_release (struct kref *kref)@@ -144,6 +165,14 @@ void i915_vm_release(struct kref *kref)void i915_address_space_init (struct i915_address_space *vm,int subclass) {kref_init (&vm->ref); + +/* +* Special case for GGTT that has already done an early +* kref_init here. +*/ +if (!kref_read (&vm->resv_ref)) +kref_init (&vm->resv_ref); +INIT_RCU_WORK (&vm->rcu, __i915_vm_release);atomic_set (&vm->open,1 );@@ -170,7 +199,7 @@ void i915_address_space_init(struct i915_address_space *vm, int subclass)might_alloc (GFP_KERNEL );mutex_release (&vm->mutex.dep_map, _THIS_IP_); } -dma_resv_init (&vm->resv); +dma_resv_init (&vm->_resv);GEM_BUG_ON (!vm->total);drm_mm_init (&vm->mm,0 , vm->total);drivers/gpu/drm/i915/gt/intel_gtt.h +29
-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) {@@ -506,6 +533,7 @@ void i915_ggtt_enable_guc(struct i915_ggtt *ggtt);void i915_ggtt_disable_guc (struct i915_ggtt *ggtt);int i915_init_ggtt (struct drm_i915_private *i915);void i915_ggtt_driver_release (struct drm_i915_private *i915); +void i915_ggtt_driver_late_release (struct drm_i915_private *i915);static inline bool i915_ggtt_has_aperture (const struct i915_ggtt *ggtt) {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;drivers/gpu/drm/i915/i915_drv.c +5
-0@@ -631,6 +631,8 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)intel_memory_regions_driver_release (dev_priv); err_ggtt:i915_ggtt_driver_release (dev_priv); +i915_gem_drain_freed_objects (dev_priv); +i915_ggtt_driver_late_release (dev_priv); err_perf:i915_perf_fini (dev_priv);return ret;@@ -880,6 +882,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)i915_driver_hw_remove (i915);intel_memory_regions_driver_release (i915);i915_ggtt_driver_release (i915); +i915_gem_drain_freed_objects (i915); +i915_ggtt_driver_late_release (i915); out_cleanup_mmio:i915_driver_mmio_release (i915); out_runtime_pm_put:@@ -936,6 +940,7 @@ static void i915_driver_release(struct drm_device *dev)intel_memory_regions_driver_release (dev_priv);i915_ggtt_driver_release (dev_priv);i915_gem_drain_freed_objects (dev_priv); +i915_ggtt_driver_late_release (dev_priv);i915_driver_mmio_release (dev_priv);
Thomas Hellström
reviewerRe: [PATCH v2 01/15] drm/i915: Untangle the vma pages_mutex
In reply to Maarten LankhorstQuoted 83 lines · Maarten Lankhorst
Hey,
This needs a small fix, otherwise looks good.
Op 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 67 lines
From: Thomas Hellström <[email protected]>
Any sleeping
dma_resvlock taken while the vmapages_mutexis held will cause a lockdep splat.
Move thei915_gem_object_pin_pages()call out of thepages_mutexcritical section.Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/i915/i915_vma.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/i915_vma.c +17
-12@@ -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; }drivers/gpu/drm/i915/i915_vma.c static void __vma_put_pages(struct i915_vma *vma, unsigned int count) · line 849
Quoted 9 lines
drivers/gpu/drm/i915/i915_vma.c +2
-2@@ -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);You're unconditionally unpinning pages here, if
pages_countwasn't dropped to 0, we will go negative.
Quoted 3 lines
With that fixed:
Reviewed-by Maarten Lankhorst <[email protected]>
Ah yes, thanks. That was a leftover from an earlier version...
/Thomas
Re: [Intel-gfx] [PATCH v2 02/15] drm/i915: Don't free shared locks while shared
In reply to Maarten LankhorstQuoted 48 lines · Maarten Lankhorst
Op 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 41 lines
We 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 take additional measures to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown
Signed-off-by Thomas Hellström <[email protected]>---
v2: Try harder to make sure objects sharing the GGTT reservation lock are freed at GGTT takedown.--- 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 | 19 ++++++-- drivers/gpu/drm/i915/gt/intel_gtt.c | 45 +++++++++++++++---- drivers/gpu/drm/i915/gt/intel_gtt.h | 30 ++++++++++++- drivers/gpu/drm/i915/gt/intel_ppgtt.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 5 +++ 7 files changed, 92 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 +0
-0drivers/gpu/drm/i915/gem/i915_gem_object_types.h struct drm_i915_gem_object { · line 152
Quoted 4 lines
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;Since this can only be a vm object, would it make sense to make this a pointer to the vm address space, so we can call
vm_resv_puton it directly?
Quoted 7 lines
The current pointer type and name makes it look generic, but if you try to use it with anything but an address space, it will blow up.
Otherwise looks good. I guess we cannot force all bo's to be deleted before the vm is freed. :-)
So with that fixed
Reviewed-by Maarten Lankhorst <[email protected]>
Thanks, I'll take a look at that.
Thomas
Re: [PATCH v2 06/15] drm/i915/ttm: Embed a ttm buffer object in the i915 gem object
In reply to Thomas HellströmOp 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 53 lines
Embed a struct
ttm_buffer_objectinto the i915 gem object, making sure we alias the gem object part. It's a bit unfortunate that the structttm_buffer_ojbectembeds 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.Signed-off-by Thomas Hellström <[email protected]>--- 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 +4
-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.
drivers/gpu/drm/i915/gem/i915_gem_object_types.h struct i915_gem_object_page_iter { · line 115
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +7
-0+* 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;
Considering Dave did roughly the same in his patches, I don't think there's a better way to do this.
Although he just wrapped base.base using sizes. This works too. It probably needs someone else's r-b too, to ensure this is allowed.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 07/15] drm/ttm: Export ttm_bo_tt_destroy()
In reply to Thomas HellströmOp 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 15 lines
For the upcoming kmapping i915
memcpy_move, exportttm_bo_tt_destroy(). A future change might be to move the newmemcpy_moveinto ttm, replacing the old ioremapping one.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/ttm/ttm_bo.c +0
-0
drivers/gpu/drm/ttm/ttm_bo.c void ttm_bo_tt_destroy(struct ttm_buffer_object *bo) · line 1224
Quoted 4 lines
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);
Looks sane, could we reorder the patches to put all ttm changes first?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Christian König
maintainerRe: [PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone
In reply to Thomas HellströmAm 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 3 lines
i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to.
From the code it looks good, but to be honest I don't think that this makes much sense from the organizational point of view.
If a self test exercises internals of TTM it should be moved into TTM as well.
Christian.
Quoted 145 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/ttm/ttm_range_manager.c | 55 +++++++++++++++++-------- include/drm/ttm/ttm_bo_driver.h | 23 +++++++++++ 2 files changed, 61 insertions(+), 17 deletions(-)drivers/gpu/drm/ttm/ttm_range_manager.c +38
-17@@ -125,55 +125,76 @@ static const struct ttm_resource_manager_func ttm_range_manager_func = { .debug = ttm_range_man_debug }; -int ttm_range_man_init (struct ttm_device *bdev, -unsigned type,bool use_tt, -unsigned long p_size) +struct ttm_resource_manager * +ttm_range_man_init_standalone (unsigned long size,bool use_tt) {struct ttm_resource_manager *man;struct ttm_range_manager *rman; rman =kzalloc (sizeof (*rman),GFP_KERNEL );if (!rman) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); man = &rman->manager; man->use_tt = use_tt; man->func = &ttm_range_manager_func; -ttm_resource_manager_init (man, p_size); +ttm_resource_manager_init (man, size); -drm_mm_init (&rman->mm,0 , p_size); +drm_mm_init (&rman->mm,0 , size);spin_lock_init (&rman->lock); -ttm_set_driver_manager (bdev, type, &rman->manager); +return man; +} +EXPORT_SYMBOL (ttm_range_man_init_standalone); + +int ttm_range_man_init (struct ttm_device *bdev, +unsigned int type,bool use_tt, +unsigned long p_size) +{ +struct ttm_resource_manager *man; + + man =ttm_range_man_init_standalone (p_size, use_tt); +if (IS_ERR (man)) +return PTR_ERR (man); +ttm_resource_manager_set_used (man, true); +ttm_set_driver_manager (bdev, type, man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_init); +void ttm_range_man_fini_standalone (struct ttm_resource_manager *man) +{ +struct ttm_range_manager *rman =to_range_manager (man); +struct drm_mm *mm = &rman->mm; + +spin_lock (&rman->lock); +drm_mm_clean (mm); +drm_mm_takedown (mm); +spin_unlock (&rman->lock); + +ttm_resource_manager_cleanup (man); +kfree (rman); +} +EXPORT_SYMBOL (ttm_range_man_fini_standalone); +int ttm_range_man_fini (struct ttm_device *bdev,unsigned type) {struct ttm_resource_manager *man =ttm_manager_type (bdev, type); -struct ttm_range_manager *rman =to_range_manager (man); -struct drm_mm *mm = &rman->mm;int ret;ttm_resource_manager_set_used (man, false); - ret =ttm_resource_manager_evict_all (bdev, man);if (ret)return ret; -spin_lock (&rman->lock); -drm_mm_clean (mm); -drm_mm_takedown (mm); -spin_unlock (&rman->lock); - -ttm_resource_manager_cleanup (man);ttm_set_driver_manager (bdev, type,NULL ); -kfree (rman); +ttm_range_man_fini_standalone (man); +return 0 ; }EXPORT_SYMBOL (ttm_range_man_fini);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
Christian König
maintainerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
In reply to Thomas HellströmAm 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.
Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.
In general yes please since I have that as TODO for TTM for a very long time.
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Regards,
Christian.
Quoted 341 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>---
v2:
- Move new TTM exports to a separate commit. (Reported by Christian König)
- Avoid having the iterator init functions inline. (Reported by Jani Nikula)
- Remove a stray comment.--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.c | 194 ++++++++++++++++++ .../gpu/drm/i915/gem/i915_gem_ttm_bo_util.h | 107 ++++++++++ 3 files changed, 302 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 +194
-0@@ -0,0 +1,194 @@ +// 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); +} + +static const struct i915_ttm_kmap_iter_ops i915_ttm_kmap_iter_tt_ops = { + .kmap_local = i915_ttm_kmap_iter_tt_kmap_local +}; + +static const 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; + +/* 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 || !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); +} + +/** +* 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. +*/ +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. +* +* Return: Pointer to the embedded struct i915_ttm_kmap_iter. +*/ +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; +}drivers/gpu/drm/i915/gem/i915_gem_ttm_bo_util.h new file +107
-0@@ -0,0 +1,107 @@ +/* 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; +}; + +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); + +struct i915_ttm_kmap_iter * +i915_ttm_kmap_iter_tt_init (struct i915_ttm_kmap_iter_tt *iter_tt, +struct ttm_tt *tt); + +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); +#endif
Christian König
maintainerRe: [Intel-gfx] [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.
In reply to Thomas HellströmCan you send me the patch directly and not just on CC?
Thanks,
Christian.
Am 18.05.21 um 10:59 schrieb Thomas Hellström:
Quoted 295 lines
+ Christian König
Quoted 8 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers.
Also clarify the documentation a bit, especially related to
VM_FAULT_RETRY.Signed-off-by Maarten Lankhorst <[email protected]>Lgtm. Reviewed-by: Thomas Hellström <[email protected]>
Quoted 281 lines
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 84 +++++++++++++---------drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c| 8 ++- include/drm/ttm/ttm_bo_api.h | 9 ++-6 files changed, 75 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0@@ -1919,7 +1919,9 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf) if (ret) goto unlock; - ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot, TTM_BO_VM_NUM_PREFAULT, 1); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))return ret;
drivers/gpu/drm/nouveau/nouveau_ttm.c +3
-1@@ -144,7 +144,9 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf) nouveau_bo_del_io_reserve_lru(bo); prot = vm_get_page_prot(vma->vm_flags); - ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT, 1); + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot, TTM_BO_VM_NUM_PREFAULT, 1); nouveau_bo_add_io_reserve_lru(bo); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))return ret;
drivers/gpu/drm/radeon/radeon_ttm.c +3
-0@@ -816,7 +816,9 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf) if (ret) goto unlock_resv; - ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot, TTM_BO_VM_NUM_PREFAULT, 1); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))goto
unlock_mclk;drivers/gpu/drm/ttm/ttm_bo_vm.c +2
-2@@ -42,7 +42,7 @@ #include <linux/mem_encrypt.h> static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo, - struct vm_fault *vmf) + struct vm_fault *vmf) { vm_fault_t ret = 0; int err = 0;@@ -122,7 +122,8 @@ static unsigned long ttm_bo_io_mem_pfn(structttm_buffer_object *bo, * Return: * 0 on success and the bo was reserved. * VM_FAULT_RETRY if blocking wait. - * VM_FAULT_NOPAGE if blocking wait and retrying was not allowed. + * VM_FAULT_NOPAGE if blocking wait and retrying was not allowed,or wait interrupted.
+ *VM_FAULT_SIGBUSif wait onbo->movingfailed for reason other than a signal.
*/
vm_fault_tttm_bo_vm_reserve(struct ttm_buffer_object *bo, struct vm_fault *vmf)drivers/gpu/drm/ttm/ttm_bo_vm.c +2
-0@@ -254,7 +255,9 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf, /*** ttm_bo_vm_fault_reserved - TTM fault helper +* @bo: The buffer object * @vmf: The struct vm_fault given as argument to the fault callback +* @mmap_base: The base of the mmap, to which the @vmf fault is relative to.
* @prot: The page protection to be used for this memory area.
* @num_prefault: Maximum number of prefault pages. The caller may want to
* specify this based on madvice settings and the size of the GPU objectdrivers/gpu/drm/ttm/ttm_bo_vm.c +13
-4@@ -265,19 +268,28 @@ static vm_fault_t ttm_bo_vm_insert_huge(structvm_fault *vmf, * memory backing the buffer object, and then returns a return code * instructing the caller to retry the page access. * +* This function ensures any pipelined wait is finished. +* +* WARNING: +* On VM_FAULT_RETRY, the bo will be unlocked by this function when +* #FAULT_FLAG_RETRY_NOWAIT is not set inside @vmf->flags. In this +* case, the caller should not unlock the @bo. +* * Return: -* VM_FAULT_NOPAGE on success or pending signal +* 0 on success. +* VM_FAULT_NOPAGE on pending signal * VM_FAULT_SIGBUS on unspecified error * VM_FAULT_OOM on out-of-memory -* VM_FAULT_RETRY if retryable wait +* VM_FAULT_RETRY if retryable wait, see WARNING above. */ -vm_fault_t ttm_bo_vm_fault_reserved (struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved (struct ttm_buffer_object *bo, + struct vm_fault *vmf, + unsigned long mmap_base, pgprot_t prot, pgoff_t num_prefault, pgoff_t fault_page_size) { struct vm_area_struct *vma = vmf->vma; - struct ttm_buffer_object *bo = vma->vm_private_data; struct ttm_device *bdev = bo->bdev; unsigned long page_offset;unsigned long
page_last;drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -286,15 +298,11 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, struct page *page; int err; pgoff_t i; - vm_fault_t ret = VM_FAULT_NOPAGE; + vm_fault_t ret; unsigned long address = vmf->address;- /*
- * Wait for buffer data in transit, due to a pipelined - * move.
- */
ret =ttm_bo_vm_fault_idle(bo, vmf);
- if (unlikely(ret != 0))
+ if (ret)
return ret;
err =ttm_mem_io_reserve(bdev, &bo->mem);drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -302,9 +310,8 @@ vm_fault_t ttm_bo_vm_fault_reserved(structvm_fault *vmf, return VM_FAULT_SIGBUS;
page_offset= ((address -vma->vm_start) >>PAGE_SHIFT) + -vma->vm_pgoff-drm_vma_node_start(&bo->base.vma_node); -page_last=vma_pages(vma)+vma->vm_pgoff-
-drm_vma_node_start(&bo->base.vma_node);
+vma->vm_pgoff-mmap_base;
+page_last=vma_pages(vma)+vma->vm_pgoff-mmap_base; if (unlikely(page_offset >= bo->mem.num_pages)) returnVM_FAULT_SIGBUS;drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-2@@ -344,8 +351,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(structvm_fault *vmf, } else if (unlikely(!page)) { break; } - page->index = drm_vma_node_start(&bo->base.vma_node) + - page_offset; + page->index = mmap_base + page_offset; pfn = page_to_pfn(page); }@@ -392,7 +398,10 @@
vm_fault_tttm_bo_vm_fault(struct vm_fault *vmf)return ret;
prot =vma->vm_page_prot;
- ret = ttm_bo_vm_fault_reserved(vmf, prot,TTM_BO_VM_NUM_PREFAULT, 1);
+ ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot,TTM_BO_VM_NUM_PREFAULT, 1);
+
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
@@ -460,22 +469,16 @@ static int ttm_bo_vm_access_kmap(structttm_buffer_object*bo, return len;
}
-int ttm_bo_vm_access(structvm_area_struct*vma, unsigned long addr, - void *buf, int len, int write)
+int ttm_bo_vm_access_reserved(structttm_buffer_object*bo,
+ structvm_area_struct*vma,
+ unsigned long offset,
+ void *buf, int len, int write)
{
- structttm_buffer_object*bo =vma->vm_private_data;
- unsigned long offset = (addr) -vma->vm_start+
- ((vma->vm_pgoff-drm_vma_node_start(&bo->base.vma_node))
- <<PAGE_SHIFT);
int ret;
if (len < 1 || (offset + len) >>PAGE_SHIFT>bo->mem.num_pages) return-EIO;
- ret =ttm_bo_reserve(bo, true, false, NULL);
- if (ret)
- return ret;
-
switch (bo->mem.mem_type) {
caseTTM_PL_SYSTEM:
if (unlikely(bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -485,16 +488,33 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, } fallthrough;case
TTM_PL_TT:
- ret =ttm_bo_vm_access_kmap(bo, offset, buf, len, write); - break;
+ returnttm_bo_vm_access_kmap(bo, offset, buf, len, write); default:
if (bo->bdev->funcs->access_memory)
- ret = bo->bdev->funcs->access_memory(
+ return bo->bdev->funcs->access_memory(
bo, offset, buf, len, write);
else
- ret =-EIO;
+ return-EIO;
}
+ return ret;drivers/gpu/drm/ttm/ttm_bo_vm.c +17
-0+} +EXPORT_SYMBOL (ttm_bo_vm_access_reserved); + +int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr, + void *buf, int len, int write) +{ + struct ttm_buffer_object *bo = vma->vm_private_data; + unsigned long offset = (addr) - vma->vm_start + + ((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node)) + << PAGE_SHIFT); + int ret; + + ret = ttm_bo_reserve(bo, true, false, NULL); + if (ret) + return ret; + + ret = ttm_bo_vm_access_reserved(bo, vma, offset, buf, len, write);
ttm_bo_unreserve(bo);
return ret;drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +0
-0@@ -477,7 +477,9 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)else
prot =vm_get_page_prot(vma->vm_flags);
- ret =ttm_bo_vm_fault_reserved(vmf, prot, num_prefault, 1); + ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot,num_prefault, 1);
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
@@ -546,7 +548,9 @@vm_fault_tvmw_bo_vm_huge_fault(structvm_fault*vmf, prot =vm_get_page_prot(vma->vm_flags);
}
- ret =ttm_bo_vm_fault_reserved(vmf, prot, 1, fault_page_size); + ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot, 1,fault_page_size);
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
diff --gita/include/drm/ttm/ttm_bo_api.hb/include/drm/ttm/ttm_bo_api.hindex639521880c29..434f91f1fdbf100644include/drm/ttm/ttm_bo_api.h +7
-0@@ -605,7 +605,9 @@ int ttm_mem_evict_first(struct ttm_device *bdev, vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo, struct vm_fault *vmf); -vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved(struct ttm_buffer_object *bo, + struct vm_fault *vmf, + unsigned long mmap_base, pgprot_t prot, pgoff_t num_prefault, pgoff_t fault_page_size);@@ -616,6 +618,11 @@ void ttm_bo_vm_open(struct vm_area_struct *vma); void ttm_bo_vm_close(struct vm_area_struct *vma); +int ttm_bo_vm_access_reserved(struct ttm_buffer_object *bo, + struct vm_area_struct *vma, + unsigned long offset, + void *buf, int len, int write); + int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, void *buf, int len, int write); bool ttm_bo_delayed_delete(struct ttm_device *bdev, bool remove_all);
Christian König
maintainerRe: [PATCH v2 07/15] drm/ttm: Export ttm_bo_tt_destroy()
In reply to Thomas HellströmAm 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 3 lines
For the upcoming kmapping i915
memcpy_move, exportttm_bo_tt_destroy(). A future change might be to move the newmemcpy_moveinto ttm, replacing the old ioremapping one.
Well this is an upfront NAK for that approach.
I've worked quite hard to not export those functions any more since this is not something drivers should be allowed to mess with.
If you need this we should probably move the functionality into TTM instead.
Regards,
Christian.
Quoted 12 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/ttm/ttm_bo.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/ttm/ttm_bo.c +0
-0
drivers/gpu/drm/ttm/ttm_bo.c void ttm_bo_tt_destroy(struct ttm_buffer_object *bo) · line 1224
Quoted 4 lines
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);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
In reply to Christian KönigQuoted 25 lines · Christian König
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
Quoted 8 lines
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Regards,
Christian.
Christian,
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the bo->mem,
we could perhaps embed a struct ttm_kmap_iter and use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the struct ttm_resource, struct ttm_buffer_object separation has landed?
/Thomas
Christian König
maintainerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
Am 18.05.21 um 14:04 schrieb Thomas Hellström:
Quoted 33 lines · Christian König
Quoted 31 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Quoted 7 lines
Quoted 2 lines
Regards,
Christian.Christian,
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the
bo->mem,
we could perhaps embed a structttm_kmap_iterand use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the structttm_resource, structttm_buffer_objectseparation has landed?
That stuff is ready, reviewed and I'm just waiting for some amdgpu changes to land in drm-misc-next to push it.
But yes in general an iterator for the resource object sounds like the right plan to me as well.
Christian.
Quoted 4 lines
/Thomas
Re: [Intel-gfx] [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
In reply to Thomas HellströmOp 18-05-2021 om 10:26 schreef Thomas Hellström:
Quoted 66 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++ drivers/gpu/drm/ttm/ttm_bo.c | 41 +++++++++++++++---------- drivers/gpu/drm/ttm/ttm_tt.c | 4 +++ 3 files changed, 33 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4
-0@@ -1399,6 +1399,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,struct dma_fence *f;int i; +/* Swapout? */ +if (bo->mem.mem_type ==TTM_PL_SYSTEM ) +return true; +if (bo->type == ttm_bo_type_kernel && !amdgpu_vm_evictable (ttm_to_amdgpu_bo (bo)))return false;drivers/gpu/drm/ttm/ttm_bo.c +7
-1@@ -531,6 +531,10 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo,bool ttm_bo_eviction_valuable (struct ttm_buffer_object *bo,const struct ttm_place *place) { +dma_resv_assert_held (bo->base.resv); +if (bo->mem.mem_type ==TTM_PL_SYSTEM ) +return true; +/* Don't evict this BO if it's outside of the * requested placement range */ @@ -553,7 +557,9 @@ EXPORT_SYMBOL(ttm_bo_eviction_valuable);* b. Otherwise, trylock it. */ static bool ttm_bo_evict_swapout_allowable (struct ttm_buffer_object *bo, -struct ttm_operation_ctx *ctx,bool *locked,bool *busy) +struct ttm_operation_ctx *ctx, +const struct ttm_place *place, +bool *locked,bool *busy) {bool ret = false;
drivers/gpu/drm/ttm/ttm_bo.c static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo, · line 584
Quoted 8 lines
drivers/gpu/drm/ttm/ttm_bo.c +5
-0@@ -571,6 +577,12 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo, *busy = !ret; } +if (ret && place && !bo->bdev->funcs->eviction_valuable (bo, place)) { + ret = false; +if (locked) +dma_resv_unlock (bo->base.resv); + }
Probably meant to check and clear *locked here?
With that fixed:
Quoted 83 lines
drivers/gpu/drm/ttm/ttm_bo.c +13
-15+return ret; }@@ -625,20 +637,14 @@ int ttm_mem_evict_first(struct ttm_device *bdev,list_for_each_entry (bo, &man->lru[i], lru) {bool busy; -if (!ttm_bo_evict_swapout_allowable (bo, ctx, &locked, - &busy)) { +if (!ttm_bo_evict_swapout_allowable (bo, ctx, place, + &locked, &busy)) {if (busy && !busy_bo && ticket !=dma_resv_locking_ctx (bo->base.resv)) busy_bo = bo;continue ; } -if (place && !bdev->funcs->eviction_valuable (bo, - place)) { -if (locked) -dma_resv_unlock (bo->base.resv); -continue ; - }if (!ttm_bo_get_unless_zero (bo)) {if (locked)dma_resv_unlock (bo->base.resv);@@ -1138,10 +1144,18 @@ EXPORT_SYMBOL(ttm_bo_wait);int ttm_bo_swapout (struct ttm_buffer_object *bo,struct ttm_operation_ctx *ctx,gfp_t gfp_flags) { +struct ttm_place place = {};bool locked;int ret; -if (!ttm_bo_evict_swapout_allowable (bo, ctx, &locked,NULL )) +/* +* While the bo may already reside in SYSTEM placement, set +* SYSTEM as new placement to cover also the move further below. +* The driver may use the fact that we're moving from SYSTEM +* as an indication that we're about to swap out. +*/ + place.mem_type =TTM_PL_SYSTEM ; +if (!ttm_bo_evict_swapout_allowable (bo, ctx, &place, &locked,NULL ))return -EBUSY ;if (!ttm_bo_get_unless_zero (bo)) {@@ -1166,12 +1180,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,if (bo->mem.mem_type !=TTM_PL_SYSTEM ) {struct ttm_operation_ctx ctx = { false, false };struct ttm_resource evict_mem; -struct ttm_place place, hop; - -memset (&place,0 ,sizeof (place)); -memset (&hop,0 ,sizeof (hop)); - - place.mem_type =TTM_PL_SYSTEM ; +struct ttm_place hop = {}; ret =ttm_resource_alloc (bo, &place, &evict_mem);if (unlikely (ret))drivers/gpu/drm/ttm/ttm_tt.c +4
-0@@ -258,6 +258,9 @@ int ttm_tt_swapout(struct ttm_device *bdev, struct ttm_tt *ttm,struct page *to_page;int i, ret; +if (!ttm_tt_is_populated (ttm)) +return 0 ; + swap_storage =shmem_file_setup ("ttm swap" , size,0 );if (IS_ERR (swap_storage)) {pr_err ("Failed allocating swap storage\n" );@@ -399,6 +402,7 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm) ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED ; } +EXPORT_SYMBOL (ttm_tt_unpopulate);#ifdef CONFIG_DEBUG_FS
Thomas Hellström
reviewerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
In reply to Christian KönigQuoted 39 lines · Christian König
Am 18.05.21 um 14:04 schrieb Thomas Hellström:
Quoted 38 lines · Christian König
Quoted 25 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
Quoted 8 lines
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Regards,
Christian.Christian,
Quoted 8 lines
Quoted 2 lines
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the
bo->mem,
we could perhaps embed a structttm_kmap_iterand use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the structttm_resource, structttm_buffer_objectseparation has landed?That stuff is ready, reviewed and I'm just waiting for some amdgpu changes to land in drm-misc-next to push it.
But yes in general an iterator for the resource object sounds like the right plan to me as well.
Christian.
OK, so then are you OK with landing this in i915 for now? That would also ofc mean the export you NAK'd but strictly for this memcpy use until we merge it with TTM?
/Thomas
Quoted 6 lines
Quoted 5 lines
/Thomas
Thomas Hellström
reviewerRe: [PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone
In reply to Christian KönigQuoted 8 lines · Christian König
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 3 lines
i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to.
From the code it looks good, but to be honest I don't think that this makes much sense from the organizational point of view.
If a self test exercises internals of TTM it should be moved into TTM as well.
This particular selftest actually exercises i915 memory regions which is a level above TTM, but the memory regions are backed by TTM. Since they are mock selftests they don't have a TTM device. For the buddy allocator the situation would be the same, but there we have selftests that exercise the allocator standalone, and those would probably fit best into a TTM selftest infrastructure.
Although in this particular case, we could of course add a mock TTM device and be done. Pls let me know what you think.
/Thomas
Christian König
maintainerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
In reply to Thomas HellströmAm 18.05.21 um 14:52 schrieb Thomas Hellström:
Quoted 44 lines · Christian König
Quoted 42 lines
Am 18.05.21 um 14:04 schrieb Thomas Hellström:
Quoted 40 lines · Christian König
Quoted 25 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
Quoted 8 lines
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Regards,
Christian.Christian,
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the
bo->mem,
we could perhaps embed a structttm_kmap_iterand use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the structttm_resource, structttm_buffer_objectseparation has landed?
Quoted 7 lines
Quoted 5 lines
That stuff is ready, reviewed and I'm just waiting for some amdgpu changes to land in drm-misc-next to push it.
But yes in general an iterator for the resource object sounds like the right plan to me as well.
Christian.
OK, so then are you OK with landing this in i915 for now? That would also ofc mean the export you NAK'd but strictly for this memcpy use until we merge it with TTM?
Well you can of course prototype that in i915, but I really don't want to export the TT functions upstream.
Can we cleanly move that functionality into TTM instead?
Christian.
Quoted 10 lines
/Thomas
Quoted 6 lines
Quoted 5 lines
/Thomas
Christian König
maintainerRe: [PATCH v2 04/15] drm/ttm: Export functions to initialize and finalize the ttm range manager standalone
In reply to Thomas HellströmAm 18.05.21 um 15:06 schrieb Thomas Hellström:
Quoted 7 lines · Christian König
Quoted 5 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 3 lines
i915 mock selftests are run without the device set up. In order to be able to run the region related mock selftests, export functions in order for the TTM range manager to be set up without a device to attach it to.
Quoted 7 lines
Quoted 3 lines
From the code it looks good, but to be honest I don't think that this makes much sense from the organizational point of view.
If a self test exercises internals of TTM it should be moved into TTM as well.
This particular selftest actually exercises i915 memory regions which is a level above TTM, but the memory regions are backed by TTM. Since they are mock selftests they don't have a TTM device. For the buddy allocator the situation would be the same, but there we have selftests that exercise the allocator standalone, and those would probably fit best into a TTM selftest infrastructure.
Although in this particular case, we could of course add a mock TTM device and be done. Pls let me know what you think.
Well if you can do that with a dummy device then that would certainly be the preferred option.
Christian.
Quoted 4 lines
/Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
In reply to Christian KönigQuoted 47 lines · Christian König
Am 18.05.21 um 14:52 schrieb Thomas Hellström:
Quoted 46 lines · Christian König
Quoted 44 lines
Am 18.05.21 um 14:04 schrieb Thomas Hellström:
Quoted 33 lines · Christian König
Quoted 31 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Quoted 7 lines
Quoted 2 lines
Regards,
Christian.Christian,
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the
bo->mem,
we could perhaps embed a structttm_kmap_iterand use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the structttm_resource, structttm_buffer_objectseparation has landed?That stuff is ready, reviewed and I'm just waiting for some amdgpu changes to land in drm-misc-next to push it.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
But yes in general an iterator for the resource object sounds like the right plan to me as well.
Christian.
OK, so then are you OK with landing this in i915 for now? That would also ofc mean the export you NAK'd but strictly for this memcpy use until we merge it with TTM?
Well you can of course prototype that in i915, but I really don't want to export the TT functions upstream.
I understand, I once had the same thoughts trying to avoid that as far as possible, so this function was actually then added to the ttm_bo interface, (hence the awkward naming) as a helper for drivers implementing move(), essentially a very special case of ttm_bo_move_accel_cleanup(), but anyway, see below:
Quoted 2 lines
Can we cleanly move that functionality into TTM instead?
I'll take a look at that, but I think we'd initially be having iterators mimicing the current move_memcpy() for the linear iomem !WC cases, hope that's OK.
/Thomas
Quoted 14 lines
Christian.
Quoted 10 lines
/Thomas
Quoted 6 lines
Quoted 5 lines
/Thomas
Christian König
maintainerRe: [PATCH v2 08/15] drm/i915/ttm Add a generic TTM memcpy move for page-based iomem
Am 18.05.21 um 15:24 schrieb Thomas Hellström:
Quoted 57 lines · Christian König
Quoted 47 lines
Am 18.05.21 um 14:52 schrieb Thomas Hellström:
Quoted 46 lines · Christian König
Quoted 44 lines
Am 18.05.21 um 14:04 schrieb Thomas Hellström:
Quoted 33 lines · Christian König
Quoted 31 lines
Am 18.05.21 um 10:26 schrieb Thomas Hellström:
Quoted 12 lines
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.Quoted 7 lines
For copies from iomem, use the WC prefetching memcpy variant for additional speed.
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.In general yes please since I have that as TODO for TTM for a very long time.
But I would prefer to fix the implementation in TTM instead and give it proper cursor handling.
Amdgpu is also using page based iomem and we are having similar workarounds in place there as well.
I think it makes sense to unify this inside TTM and remove the old memcpy util function when done.
Quoted 7 lines
Quoted 2 lines
Regards,
Christian.Christian,
I was thinking when we replace the bo.mem with a pointer (and perhaps have a driver callback to allocate the
bo->mem,
we could perhaps embed a structttm_kmap_iterand use it for all mapping in one way or another). That would mean perhaps land this is i915 now and sort out the unification once the structttm_resource, structttm_buffer_objectseparation has landed?That stuff is ready, reviewed and I'm just waiting for some amdgpu changes to land in drm-misc-next to push it.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
But yes in general an iterator for the resource object sounds like the right plan to me as well.
Christian.
OK, so then are you OK with landing this in i915 for now? That would also ofc mean the export you NAK'd but strictly for this memcpy use until we merge it with TTM?
Well you can of course prototype that in i915, but I really don't want to export the TT functions upstream.
Quoted 7 lines
I understand, I once had the same thoughts trying to avoid that as far as possible, so this function was actually then added to the
ttm_bointerface, (hence the awkward naming) as a helper for drivers implementingmove(), essentially a very special case ofttm_bo_move_accel_cleanup(), but anyway, see below:Quoted 2 lines
Can we cleanly move that functionality into TTM instead?
I'll take a look at that, but I think we'd initially be having iterators mimicing the current
move_memcpy()for the linear iomem !WC cases, hope that's OK.
Yeah, that's peefectly fine with me. I can tackle cleaning up all drivers and move over to the new implementation when that is fully complete.
As I said we already have the same problem in amdgpu and only solved it by avoiding memcpy all together.
Christian.
Quoted 18 lines
/Thomas
Quoted 14 lines
Christian.
Quoted 10 lines
/Thomas
Quoted 6 lines
Quoted 5 lines
/Thomas
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH v2 13/15] drm/ttm: Add BO and offset arguments for vm_access and vm_fault ttm handlers.
In reply to Christian KönigQuoted 4 lines · Christian König
Can you send me the patch directly and not just on CC?
Thanks,
Christian.
Original patch sent. Pls remember to CC lists on reply, though.
The reason we need this is because of i915's strange mmap functionality which allows a bo to be mapped at multiple offsets and the vma->private is not a bo...
Thanks,
Thomas
Quoted 290 lines
Am 18.05.21 um 10:59 schrieb Thomas Hellström:
Quoted 288 lines
+ Christian König
Quoted 8 lines · Thomas Hellström
From: Maarten Lankhorst <[email protected]>
This allows other drivers that may not setup the vma in the same way to use the ttm bo helpers.
Also clarify the documentation a bit, especially related to
VM_FAULT_RETRY.Signed-off-by Maarten Lankhorst <[email protected]>Lgtm. Reviewed-by: Thomas Hellström <[email protected]>
Quoted 274 lines
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 +- drivers/gpu/drm/radeon/radeon_ttm.c | 4 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 84
+++++++++++++---------
drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c| 8 ++- include/drm/ttm/ttm_bo_api.h | 9 ++-6 files changed, 75 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3
-0@@ -1919,7 +1919,9 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf) if (ret) goto unlock; - ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot, TTM_BO_VM_NUM_PREFAULT, 1); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))return ret;
drivers/gpu/drm/nouveau/nouveau_ttm.c +3
-1@@ -144,7 +144,9 @@ static vm_fault_t nouveau_ttm_fault(struct vm_fault *vmf) nouveau_bo_del_io_reserve_lru(bo); prot = vm_get_page_prot(vma->vm_flags); - ret = ttm_bo_vm_fault_reserved(vmf, prot, TTM_BO_VM_NUM_PREFAULT, 1); + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + prot, TTM_BO_VM_NUM_PREFAULT, 1); nouveau_bo_add_io_reserve_lru(bo); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))return ret;
drivers/gpu/drm/radeon/radeon_ttm.c +3
-0@@ -816,7 +816,9 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf) if (ret) goto unlock_resv; - ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot, + ret = ttm_bo_vm_fault_reserved(bo, vmf, +drm_vma_node_start (&bo->base.vma_node), + vmf->vma->vm_page_prot, TTM_BO_VM_NUM_PREFAULT, 1); if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))goto
unlock_mclk;drivers/gpu/drm/ttm/ttm_bo_vm.c +2
-2@@ -42,7 +42,7 @@ #include <linux/mem_encrypt.h> static vm_fault_t ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo, - struct vm_fault *vmf) + struct vm_fault *vmf) { vm_fault_t ret = 0; int err = 0;@@ -122,7 +122,8 @@ static unsigned long ttm_bo_io_mem_pfn(structttm_buffer_object *bo, * Return: * 0 on success and the bo was reserved. * VM_FAULT_RETRY if blocking wait. - * VM_FAULT_NOPAGE if blocking wait and retrying was not allowed. + * VM_FAULT_NOPAGE if blocking wait and retrying was notallowed, or wait interrupted.
+ *VM_FAULT_SIGBUSif wait onbo->movingfailed for reason other than a signal.
*/
vm_fault_tttm_bo_vm_reserve(struct ttm_buffer_object *bo, struct vm_fault *vmf)drivers/gpu/drm/ttm/ttm_bo_vm.c +2
-0@@ -254,7 +255,9 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct vm_fault *vmf, /*** ttm_bo_vm_fault_reserved - TTM fault helper +* @bo: The buffer object * @vmf: The struct vm_fault given as argument to the fault callback +* @mmap_base: The base of the mmap, to which the @vmf fault is relative to.
* @prot: The page protection to be used for this memory area.
* @num_prefault: Maximum number of prefault pages. The caller may want to
* specify this based on madvice settings and the size of the GPU objectdrivers/gpu/drm/ttm/ttm_bo_vm.c +13
-4@@ -265,19 +268,28 @@ static vm_fault_t ttm_bo_vm_insert_huge(structvm_fault *vmf, * memory backing the buffer object, and then returns a return code * instructing the caller to retry the page access. * +* This function ensures any pipelined wait is finished. +* +* WARNING: +* On VM_FAULT_RETRY, the bo will be unlocked by this function when +* #FAULT_FLAG_RETRY_NOWAIT is not set inside @vmf->flags. In this +* case, the caller should not unlock the @bo. +* * Return: -* VM_FAULT_NOPAGE on success or pending signal +* 0 on success. +* VM_FAULT_NOPAGE on pending signal * VM_FAULT_SIGBUS on unspecified error * VM_FAULT_OOM on out-of-memory -* VM_FAULT_RETRY if retryable wait +* VM_FAULT_RETRY if retryable wait, see WARNING above. */ -vm_fault_t ttm_bo_vm_fault_reserved (struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved (struct ttm_buffer_object *bo, + struct vm_fault *vmf, + unsigned long mmap_base, pgprot_t prot, pgoff_t num_prefault, pgoff_t fault_page_size) { struct vm_area_struct *vma = vmf->vma; - struct ttm_buffer_object *bo = vma->vm_private_data; struct ttm_device *bdev = bo->bdev; unsigned long page_offset;unsigned long
page_last;drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -286,15 +298,11 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, struct page *page; int err; pgoff_t i; - vm_fault_t ret = VM_FAULT_NOPAGE; + vm_fault_t ret; unsigned long address = vmf->address;- /*
- * Wait for buffer data in transit, due to a pipelined - * move.
- */
ret =ttm_bo_vm_fault_idle(bo, vmf);
- if (unlikely(ret != 0))
+ if (ret)
return ret;
err =ttm_mem_io_reserve(bdev, &bo->mem);drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -302,9 +310,8 @@ vm_fault_t ttm_bo_vm_fault_reserved(structvm_fault *vmf, return VM_FAULT_SIGBUS;
page_offset= ((address -vma->vm_start) >>PAGE_SHIFT) + -vma->vm_pgoff-drm_vma_node_start(&bo->base.vma_node); -page_last=vma_pages(vma)+vma->vm_pgoff-
-drm_vma_node_start(&bo->base.vma_node);
+vma->vm_pgoff-mmap_base;
+page_last=vma_pages(vma)+vma->vm_pgoff-mmap_base; if (unlikely(page_offset >= bo->mem.num_pages)) returnVM_FAULT_SIGBUS;drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-2@@ -344,8 +351,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(structvm_fault *vmf, } else if (unlikely(!page)) { break; } - page->index = drm_vma_node_start(&bo->base.vma_node) + - page_offset; + page->index = mmap_base + page_offset; pfn = page_to_pfn(page); }@@ -392,7 +398,10 @@
vm_fault_tttm_bo_vm_fault(struct vm_fault *vmf)return ret;
prot =vma->vm_page_prot;
- ret = ttm_bo_vm_fault_reserved(vmf, prot,TTM_BO_VM_NUM_PREFAULT, 1);
+ ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot,TTM_BO_VM_NUM_PREFAULT, 1);
+
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
@@ -460,22 +469,16 @@ static int ttm_bo_vm_access_kmap(structttm_buffer_object*bo, return len;
}
-int ttm_bo_vm_access(structvm_area_struct*vma, unsigned long addr, - void *buf, int len, int write)
+int ttm_bo_vm_access_reserved(structttm_buffer_object*bo,
+ structvm_area_struct*vma,
+ unsigned long offset,
+ void *buf, int len, int write)
{
- structttm_buffer_object*bo =vma->vm_private_data;
- unsigned long offset = (addr) -vma->vm_start+
- ((vma->vm_pgoff-drm_vma_node_start(&bo->base.vma_node))
- <<PAGE_SHIFT);
int ret;
if (len < 1 || (offset + len) >>PAGE_SHIFT>bo->mem.num_pages) return-EIO;
- ret =ttm_bo_reserve(bo, true, false, NULL);
- if (ret)
- return ret;
-
switch (bo->mem.mem_type) {
caseTTM_PL_SYSTEM:
if (unlikely(bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {drivers/gpu/drm/ttm/ttm_bo_vm.c +0
-0@@ -485,16 +488,33 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, } fallthrough;case
TTM_PL_TT:
- ret =ttm_bo_vm_access_kmap(bo, offset, buf, len, write); - break;
+ returnttm_bo_vm_access_kmap(bo, offset, buf, len, write); default:
if (bo->bdev->funcs->access_memory)
- ret = bo->bdev->funcs->access_memory(
+ return bo->bdev->funcs->access_memory(
bo, offset, buf, len, write);
else
- ret =-EIO;
+ return-EIO;
}
+ return ret;drivers/gpu/drm/ttm/ttm_bo_vm.c +17
-0+} +EXPORT_SYMBOL (ttm_bo_vm_access_reserved); + +int ttm_bo_vm_access (struct vm_area_struct *vma,unsigned long addr, + void *buf, int len, int write) +{ + struct ttm_buffer_object *bo = vma->vm_private_data; + unsigned long offset = (addr) - vma->vm_start + + ((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node)) + << PAGE_SHIFT); + int ret; + + ret = ttm_bo_reserve(bo, true, false, NULL); + if (ret) + return ret; + + ret = ttm_bo_vm_access_reserved(bo, vma, offset, buf, len, write);
ttm_bo_unreserve(bo);
return ret;drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +0
-0@@ -477,7 +477,9 @@ vm_fault_t vmw_bo_vm_fault(struct vm_fault *vmf)else
prot =vm_get_page_prot(vma->vm_flags);
- ret =ttm_bo_vm_fault_reserved(vmf, prot, num_prefault, 1); + ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot,num_prefault, 1);
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
@@ -546,7 +548,9 @@vm_fault_tvmw_bo_vm_huge_fault(structvm_fault*vmf, prot =vm_get_page_prot(vma->vm_flags);
}
- ret =ttm_bo_vm_fault_reserved(vmf, prot, 1, fault_page_size); + ret = ttm_bo_vm_fault_reserved(bo, vmf,
+drm_vma_node_start(&bo->base.vma_node),
+ prot, 1,fault_page_size);
if (ret ==VM_FAULT_RETRY&& !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT)) return ret;
diff --gita/include/drm/ttm/ttm_bo_api.hb/include/drm/ttm/ttm_bo_api.hindex639521880c29..434f91f1fdbf100644include/drm/ttm/ttm_bo_api.h +3
-0@@ -605,7 +605,9 @@ int ttm_mem_evict_first(struct ttm_device *bdev, vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo, struct vm_fault *vmf); -vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, +vm_fault_t ttm_bo_vm_fault_reserved(struct ttm_buffer_object *bo, + struct vm_fault *vmf, + unsigned long mmap_base, pgprot_t prot, pgoff_t num_prefault, pgoff_t fault_page_size);@@ -616,6 +618,11 @@ void ttm_bo_vm_open(struct vm_area_struct *vma); void ttm_bo_vm_close(struct vm_area_struct *vma);
Quoted 9 lines
Quoted 8 lines
include/drm/ttm/ttm_bo_api.h void ttm_bo_vm_open(struct vm_area_struct *vma); · line 628
Quoted 8 lines
include/drm/ttm/ttm_bo_api.h +4
-0+int ttm_bo_vm_access_reserved(struct ttm_buffer_object *bo, + struct vm_area_struct *vma, + unsigned long offset, + void *buf, int len, int write); + int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr, void *buf, int len, int write); bool ttm_bo_delayed_delete(struct ttm_device *bdev, bool remove_all);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
In reply to Thomas HellströmQuoted 11 lines · Thomas Hellström
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.
Quoted 7 lines
Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>
Christian,
Here we have a ttm_tt_unpopulate() export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? like ttm_bo_purge()?
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Christian König
maintainerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 18 lines · Thomas Hellström
Quoted 16 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.
Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?
We already have that. Just call ttm_bo_validate() without any place to put the buffer.
See how ttm_bo_pipeline_gutting() is used.
Christian.
Quoted 6 lines
Thanks,
Thomas
Thomas Hellström
reviewerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Quoted 26 lines · Christian König
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 23 lines · Thomas Hellström
Quoted 11 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Quoted 7 lines
Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Quoted 7 lines
Quoted 1 line
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
OK, so is that reentrant from the move() or swap_notify() callback.
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Christian König
maintainerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 30 lines · Christian König
Quoted 28 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 24 lines · Thomas Hellström
Quoted 11 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Quoted 7 lines
Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?
Quoted 7 lines
Quoted 5 lines
We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
OK, so is that reentrant from the
move()orswap_notify()callback.
That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the evict_flags callback.
It is TTMs job to deal with the buffer placement and drivers are no longer allowed to mess with that.
Regards,
Christian.
Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Quoted 35 lines · Christian König
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 34 lines · Christian König
Quoted 32 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 18 lines · Thomas Hellström
Quoted 16 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Christian.
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.
So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Christian König
maintainerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Am 18.05.21 um 17:38 schrieb Thomas Hellström:
Quoted 39 lines · Christian König
Quoted 37 lines
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 36 lines · Christian König
Quoted 33 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 18 lines · Thomas Hellström
Quoted 16 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?
Amdgpu has the same functionality and you don't need to handle swap at all.
Just return from the evict_flags that you want to drop the backing store as soon as the BO leaves the GTT domain.
Christian.
Quoted 21 lines
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Quoted 44 lines · Christian König
Am 18.05.21 um 17:38 schrieb Thomas Hellström:
Quoted 43 lines · Christian König
Quoted 41 lines
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 30 lines · Christian König
Quoted 28 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 24 lines · Thomas Hellström
Quoted 11 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Quoted 7 lines
Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?Quoted 7 lines
Quoted 5 lines
We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?Amdgpu has the same functionality and you don't need to handle swap at all.
Just return from the
evict_flagsthat you want to drop the backing store as soon as the BO leaves the GTT domain.
Hmm, the pipeline_gutting function seems ok, but overly complex if the bo is already idle, Am I allowed to optimize it slightly for the latter case?
/Thomas
Quoted 25 lines
Christian.
Quoted 21 lines
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
Christian König
maintainerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
Am 18.05.21 um 18:07 schrieb Thomas Hellström:
Quoted 48 lines · Christian König
Quoted 46 lines
Am 18.05.21 um 17:38 schrieb Thomas Hellström:
Quoted 45 lines · Christian König
Quoted 42 lines
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 30 lines · Christian König
Quoted 28 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 24 lines · Thomas Hellström
Quoted 11 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Quoted 7 lines
Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?Quoted 7 lines
Quoted 5 lines
We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?Amdgpu has the same functionality and you don't need to handle swap at all.
Just return from the
evict_flagsthat you want to drop the backing store as soon as the BO leaves the GTT domain.Hmm, the
pipeline_guttingfunction seems ok, but overly complex if the bo is already idle, Am I allowed to optimize it slightly for the latter case?
Yeah, sure. We just never hat that use case so far.
Christian.
Quoted 29 lines
/Thomas
Quoted 25 lines
Christian.
Quoted 21 lines
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
In reply to Thomas Hellström== Series Details ==
== Series Details ==
Series: drm/i915: Move LMEM (VRAM) management over to TTM (rev2)
URL : https://patchwork.freedesktop.org/series/90022/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_10094_full -> Patchwork_20142_full
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with Patchwork_20142_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_20142_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_20142_full:
### IGT changes ###
#### Warnings ####
* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-kbl: [DMESG-WARN][1] ([i915#180] / [i915#295]) -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-kbl7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl4/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_20142_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@api_intel_allocator@execbuf-with-allocator:
- shard-kbl: NOTRUN -> [DMESG-WARN][3] ([i915#3457])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl2/igt@[email protected]
* igt@api_intel_bb@intel-bb-blit-y:
- shard-glk: NOTRUN -> [FAIL][4] ([i915#3471])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@gem_create@create-clear:
- shard-glk: [PASS][5] -> [FAIL][6] ([i915#1888] / [i915#3160])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk1/igt@[email protected]
* igt@gem_ctx_engines@invalid-engines:
- shard-kbl: NOTRUN -> [INCOMPLETE][7] ([i915#3468])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl7/igt@[email protected]
* igt@gem_ctx_persistence@legacy-engines-cleanup:
- shard-snb: NOTRUN -> [SKIP][8] ([fdo#109271] / [i915#1099]) +1 similar issue
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb2/igt@[email protected]
* igt@gem_ctx_ringsize@active@bcs0:
- shard-skl: [PASS][9] -> [INCOMPLETE][10] ([i915#3316] / [i915#3457])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-skl3/igt@gem_ctx_ringsize@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@gem_ctx_ringsize@[email protected]
* igt@gem_exec_fair@basic-pace@bcs0:
- shard-tglb: [PASS][11] -> [FAIL][12] ([i915#2842] / [i915#3457]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-tglb5/igt@gem_exec_fair@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb8/igt@gem_exec_fair@[email protected]
* igt@gem_exec_flush@basic-batch-kernel-default-cmd:
- shard-snb: NOTRUN -> [SKIP][13] ([fdo#109271]) +185 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb5/igt@[email protected]
* igt@gem_exec_reloc@basic-wide-active@bcs0:
- shard-apl: NOTRUN -> [FAIL][14] ([i915#2389] / [i915#3457]) +3 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl6/igt@gem_exec_reloc@[email protected]
* igt@gem_exec_schedule@independent@rcs0:
- shard-glk: NOTRUN -> [FAIL][15] ([i915#3457]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@gem_exec_schedule@[email protected]
* igt@gem_exec_schedule@preempt-hang@vcs0:
- shard-glk: [PASS][16] -> [FAIL][17] ([i915#3457]) +33 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk7/igt@gem_exec_schedule@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk6/igt@gem_exec_schedule@[email protected]
* igt@gem_exec_schedule@u-submit-golden-slice@vecs0:
- shard-apl: NOTRUN -> [FAIL][18] ([i915#3457]) +10 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@gem_exec_schedule@[email protected]
* igt@gem_exec_schedule@u-submit-late-slice@vecs0:
- shard-apl: [PASS][19] -> [FAIL][20] ([i915#3457])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-apl7/igt@gem_exec_schedule@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@gem_exec_schedule@[email protected]
* igt@gem_mmap_gtt@cpuset-basic-small-copy-xy:
- shard-snb: NOTRUN -> [INCOMPLETE][21] ([i915#3468])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb5/igt@[email protected]
* igt@gem_mmap_gtt@cpuset-medium-copy-xy:
- shard-tglb: [PASS][22] -> [INCOMPLETE][23] ([i915#3468] / [i915#750])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-tglb3/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb3/igt@[email protected]
- shard-iclb: [PASS][24] -> [INCOMPLETE][25] ([i915#3468]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-iclb3/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-iclb1/igt@[email protected]
* igt@gem_render_copy@mixed-tiled-to-yf-tiled-ccs:
- shard-apl: NOTRUN -> [INCOMPLETE][26] ([i915#3468]) +2 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl6/igt@[email protected]
* igt@gem_render_copy@y-tiled-mc-ccs-to-yf-tiled-ccs:
- shard-tglb: NOTRUN -> [INCOMPLETE][27] ([i915#3468])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@gem_render_copy@yf-tiled-ccs-to-linear:
- shard-skl: NOTRUN -> [INCOMPLETE][28] ([i915#198] / [i915#3468])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl1/igt@[email protected]
* igt@gem_render_copy@yf-tiled-ccs-to-y-tiled-ccs:
- shard-skl: NOTRUN -> [INCOMPLETE][29] ([i915#3468]) +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@[email protected]
* igt@gem_userptr_blits@set-cache-level:
- shard-snb: NOTRUN -> [FAIL][30] ([i915#3324])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb5/igt@[email protected]
* igt@gem_userptr_blits@vma-merge:
- shard-apl: NOTRUN -> [FAIL][31] ([i915#3318] / [i915#3457])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
- shard-tglb: NOTRUN -> [FAIL][32] ([i915#3318] / [i915#3457])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@gen7_exec_parse@oacontrol-tracking:
- shard-tglb: NOTRUN -> [SKIP][33] ([fdo#109289])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@gen9_exec_parse@bb-large:
- shard-kbl: NOTRUN -> [FAIL][34] ([i915#3296])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl7/igt@[email protected]
* igt@gen9_exec_parse@cmd-crossing-page:
- shard-tglb: NOTRUN -> [SKIP][35] ([fdo#112306])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@i915_hangman@error-state-capture@bcs0:
- shard-snb: NOTRUN -> [DMESG-WARN][36] ([i915#3457]) +3 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb2/igt@i915_hangman@[email protected]
* igt@i915_module_load@reload-with-fault-injection:
- shard-snb: [PASS][37] -> [DMESG-WARN][38] ([i915#3389])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-snb6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb5/igt@[email protected]
* igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp:
- shard-apl: NOTRUN -> [SKIP][39] ([fdo#109271] / [i915#1937])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@i915_pm_lpsp@[email protected]
* igt@i915_pm_rpm@cursor:
- shard-kbl: [PASS][40] -> [DMESG-WARN][41] ([i915#3457])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-kbl4/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl4/igt@[email protected]
- shard-glk: [PASS][42] -> [DMESG-WARN][43] ([i915#3457]) +2 similar issues
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk3/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk4/igt@[email protected]
* igt@i915_pm_rpm@cursor-dpms:
- shard-iclb: [PASS][44] -> [DMESG-WARN][45] ([i915#3457])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-iclb6/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-iclb3/igt@[email protected]
* igt@i915_pm_rpm@gem-mmap-type@uc:
- shard-glk: [PASS][46] -> [DMESG-WARN][47] ([i915#3475])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk6/igt@i915_pm_rpm@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@i915_pm_rpm@[email protected]
* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-apl: NOTRUN -> [SKIP][48] ([fdo#109271]) +191 similar issues
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][49] ([fdo#109506] / [i915#2411])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@i915_pm_rpm@system-suspend:
- shard-skl: [PASS][50] -> [INCOMPLETE][51] ([i915#151])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-skl8/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@[email protected]
* igt@i915_pm_rps@min-max-config-loaded:
- shard-tglb: NOTRUN -> [DMESG-WARN][52] ([i915#3457])
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@i915_selftest@live@execlists:
- shard-skl: NOTRUN -> [INCOMPLETE][53] ([i915#2782] / [i915#3462])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl1/igt@i915_selftest@[email protected]
- shard-apl: NOTRUN -> [DMESG-FAIL][54] ([i915#3462])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@i915_selftest@[email protected]
* igt@i915_selftest@live@gt_pm:
- shard-skl: NOTRUN -> [DMESG-FAIL][55] ([i915#1886] / [i915#2291])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl1/igt@i915_selftest@live@gt_pm.html
* igt@i915_selftest@live@mman:
- shard-apl: NOTRUN -> [DMESG-WARN][56] ([i915#3457]) +5 similar issues
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@i915_selftest@[email protected]
- shard-skl: NOTRUN -> [DMESG-WARN][57] ([i915#3457]) +1 similar issue
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl1/igt@i915_selftest@[email protected]
* igt@i915_suspend@forcewake:
- shard-kbl: [PASS][58] -> [DMESG-WARN][59] ([i915#180]) +3 similar issues
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-kbl1/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl6/igt@[email protected]
* igt@kms_big_fb@y-tiled-8bpp-rotate-90:
- shard-tglb: NOTRUN -> [SKIP][60] ([fdo#111614]) +1 similar issue
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_big_joiner@basic:
- shard-skl: NOTRUN -> [SKIP][61] ([fdo#109271] / [i915#2705])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@[email protected]
* igt@kms_ccs@pipe-c-ccs-on-another-bo:
- shard-glk: NOTRUN -> [SKIP][62] ([fdo#109271]) +15 similar issues
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_chamelium@hdmi-edid-read:
- shard-tglb: NOTRUN -> [SKIP][63] ([fdo#109284] / [fdo#111827]) +4 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-with-enabled-mode:
- shard-kbl: NOTRUN -> [SKIP][64] ([fdo#109271] / [fdo#111827]) +4 similar issues
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl2/igt@[email protected]
* igt@kms_color_chamelium@pipe-a-ctm-limited-range:
- shard-apl: NOTRUN -> [SKIP][65] ([fdo#109271] / [fdo#111827]) +20 similar issues
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_color_chamelium@pipe-c-gamma:
- shard-glk: NOTRUN -> [SKIP][66] ([fdo#109271] / [fdo#111827]) +1 similar issue
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_color_chamelium@pipe-d-degamma:
- shard-skl: NOTRUN -> [SKIP][67] ([fdo#109271] / [fdo#111827]) +5 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes:
- shard-snb: NOTRUN -> [SKIP][68] ([fdo#109271] / [fdo#111827]) +9 similar issues
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb5/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-512x512-rapid-movement:
- shard-tglb: NOTRUN -> [SKIP][69] ([fdo#109279] / [i915#3359] / [i915#3457])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-64x21-random:
- shard-kbl: NOTRUN -> [FAIL][70] ([i915#3444] / [i915#3457]) +5 similar issues
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-dpms:
- shard-skl: [PASS][71] -> [FAIL][72] ([i915#3444] / [i915#3457])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-skl2/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-32x10-onscreen:
- shard-tglb: NOTRUN -> [SKIP][73] ([i915#3359] / [i915#3457])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque:
- shard-apl: NOTRUN -> [FAIL][74] ([i915#3444] / [i915#3457]) +8 similar issues
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl6/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-skl: NOTRUN -> [FAIL][75] ([i915#3444] / [i915#3457]) +6 similar issues
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-128x128-sliding:
- shard-glk: NOTRUN -> [FAIL][76] ([i915#3444] / [i915#3457])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-256x85-random:
- shard-snb: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#3457]) +27 similar issues
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb2/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-32x32-onscreen:
- shard-glk: NOTRUN -> [SKIP][78] ([fdo#109271] / [i915#3457]) +4 similar issues
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-512x170-rapid-movement:
- shard-kbl: NOTRUN -> [SKIP][79] ([fdo#109271] / [i915#3457]) +9 similar issues
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-dpms:
- shard-iclb: [PASS][80] -> [FAIL][81] ([i915#3457])
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-iclb5/igt@[email protected]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-iclb1/igt@[email protected]
* igt@kms_cursor_crc@pipe-d-cursor-128x42-onscreen:
- shard-tglb: NOTRUN -> [FAIL][82] ([i915#2124] / [i915#3457]) +3 similar issues
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_cursor_crc@pipe-d-cursor-256x85-offscreen:
- shard-tglb: [PASS][83] -> [FAIL][84] ([i915#2124] / [i915#3457]) +1 similar issue
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-tglb3/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb5/igt@[email protected]
* igt@kms_cursor_crc@pipe-d-cursor-32x32-offscreen:
- shard-tglb: NOTRUN -> [SKIP][85] ([i915#3319] / [i915#3457])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_cursor_crc@pipe-d-cursor-64x64-sliding:
- shard-apl: NOTRUN -> [SKIP][86] ([fdo#109271] / [i915#3457]) +27 similar issues
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_cursor_crc@pipe-d-cursor-alpha-opaque:
- shard-skl: NOTRUN -> [SKIP][87] ([fdo#109271] / [i915#3457]) +6 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl1/igt@[email protected]
* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: NOTRUN -> [INCOMPLETE][88] ([i915#155] / [i915#180] / [i915#636])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl7/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-blt:
- shard-kbl: NOTRUN -> [SKIP][89] ([fdo#109271]) +72 similar issues
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-move:
- shard-tglb: NOTRUN -> [SKIP][90] ([fdo#111825]) +9 similar issues
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-d:
- shard-kbl: NOTRUN -> [SKIP][91] ([fdo#109271] / [i915#533]) +1 similar issue
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
- shard-apl: NOTRUN -> [SKIP][92] ([fdo#109271] / [i915#533])
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-skl: NOTRUN -> [FAIL][93] ([fdo#108145] / [i915#265])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-alpha-transparent-fb:
- shard-apl: NOTRUN -> [FAIL][94] ([i915#265]) +1 similar issue
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl6/igt@[email protected]
- shard-skl: NOTRUN -> [FAIL][95] ([i915#265])
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-kbl: NOTRUN -> [FAIL][96] ([fdo#108145] / [i915#265]) +2 similar issues
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
- shard-apl: NOTRUN -> [FAIL][97] ([fdo#108145] / [i915#265]) +2 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-alpha-transparent-fb:
- shard-glk: NOTRUN -> [FAIL][98] ([i915#265])
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_plane_cursor@pipe-a-primary-size-64:
- shard-snb: NOTRUN -> [FAIL][99] ([i915#2657] / [i915#3457])
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb7/igt@[email protected]
* igt@kms_plane_cursor@pipe-a-viewport-size-64:
- shard-apl: NOTRUN -> [FAIL][100] ([i915#2657] / [i915#3457])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-overlay-size-128:
- shard-snb: NOTRUN -> [FAIL][101] ([i915#2657])
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-snb2/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-overlay-size-256:
- shard-glk: [PASS][102] -> [FAIL][103] ([i915#2657])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk3/igt@[email protected]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk4/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-overlay-size-64:
- shard-kbl: NOTRUN -> [FAIL][104] ([i915#2657] / [i915#3457]) +2 similar issues
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-primary-size-128:
- shard-tglb: NOTRUN -> [FAIL][105] ([i915#3461])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-viewport-size-128:
- shard-glk: NOTRUN -> [FAIL][106] ([i915#2657]) +1 similar issue
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk5/igt@[email protected]
* igt@kms_plane_cursor@pipe-b-viewport-size-256:
- shard-skl: NOTRUN -> [FAIL][107] ([i915#2657]) +1 similar issue
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_plane_cursor@pipe-c-overlay-size-128:
- shard-kbl: NOTRUN -> [FAIL][108] ([i915#2657])
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl3/igt@[email protected]
* igt@kms_plane_lowres@pipe-d-tiling-yf:
- shard-tglb: NOTRUN -> [SKIP][109] ([fdo#112054])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_plane_multiple@atomic-pipe-a-tiling-yf:
- shard-tglb: NOTRUN -> [SKIP][110] ([fdo#111615])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-2:
- shard-apl: NOTRUN -> [SKIP][111] ([fdo#109271] / [i915#658]) +5 similar issues
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][112] ([i915#2920])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-3:
- shard-skl: NOTRUN -> [SKIP][113] ([fdo#109271] / [i915#658]) +1 similar issue
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-3:
- shard-kbl: NOTRUN -> [SKIP][114] ([fdo#109271] / [i915#658]) +2 similar issues
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl2/igt@[email protected]
* igt@kms_psr@psr2_cursor_render:
- shard-tglb: NOTRUN -> [FAIL][115] ([i915#132] / [i915#3457])
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@kms_psr@psr2_cursor_render.html
* igt@kms_writeback@writeback-invalid-parameters:
- shard-apl: NOTRUN -> [SKIP][116] ([fdo#109271] / [i915#2437])
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@kms_writeback@writeback-pixel-formats:
- shard-skl: NOTRUN -> [SKIP][117] ([fdo#109271] / [i915#2437]) +1 similar issue
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@[email protected]
* igt@nouveau_crc@pipe-c-source-outp-complete:
- shard-tglb: NOTRUN -> [SKIP][118] ([i915#2530]) +1 similar issue
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@[email protected]
* igt@perf@polling-parameterized:
- shard-glk: [PASS][119] -> [FAIL][120] ([i915#1542])
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk1/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk7/igt@[email protected]
* igt@perf_pmu@busy-idle-no-semaphores@rcs0:
- shard-glk: [PASS][121] -> [WARN][122] ([i915#3457])
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-glk1/igt@perf_pmu@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-glk7/igt@perf_pmu@[email protected]
* igt@perf_pmu@module-unload:
- shard-skl: [PASS][123] -> [DMESG-WARN][124] ([i915#1982] / [i915#262])
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-skl10/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl3/igt@[email protected]
* igt@prime_nv_api@i915_self_import:
- shard-skl: NOTRUN -> [SKIP][125] ([fdo#109271]) +48 similar issues
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-skl2/igt@prime_nv_api@i915_self_import.html
* igt@prime_nv_test@i915_import_cpu_mmap:
- shard-tglb: NOTRUN -> [SKIP][126] ([fdo#109291])
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-tglb1/igt@prime_nv_test@i915_import_cpu_mmap.html
* igt@sysfs_clients@sema-50:
- shard-apl: NOTRUN -> [SKIP][127] ([fdo#109271] / [i915#2994]) +2 similar issues
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-apl7/igt@[email protected]
* igt@sysfs_clients@split-50:
- shard-kbl: NOTRUN -> [SKIP][128] ([fdo#109271] / [i915#2994]) +2 similar issues
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl7/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_fair@basic-pace@vcs1:
- shard-kbl: [FAIL][129] ([i915#2842] / [i915#3457]) -> [PASS][130]
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10094/shard-kbl1/igt@gem_exec_fair@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/shard-kbl1/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fence@parallel@vcs0:
- shard-glk: [FAIL][
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20142/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thomas Hellström
reviewerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
In reply to Christian KönigQuoted 52 lines · Christian König
Am 18.05.21 um 18:07 schrieb Thomas Hellström:
Quoted 51 lines · Christian König
Quoted 49 lines
Am 18.05.21 um 17:38 schrieb Thomas Hellström:
Quoted 47 lines · Christian König
Quoted 35 lines
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 34 lines · Christian König
Quoted 32 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 18 lines · Thomas Hellström
Quoted 16 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Christian.
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Amdgpu has the same functionality and you don't need to handle swap at all.
Just return from the
evict_flagsthat you want to drop the backing store as soon as the BO leaves the GTT domain.Hmm, the
pipeline_guttingfunction seems ok, but overly complex if the bo is already idle, Am I allowed to optimize it slightly for the latter case?Yeah, sure. We just never hat that use case so far.
One thing about the code here that makes me worried is that the "destination" ttm_tt is allocated *after* pipeline_gutting. We're not really allowed to fail here because that would leave the BO in a state where codepaths (fault for example) try to access a NULL ttm_tt. While the idle case can get away with ttm_tt_unpopulate, for the async case, ttm_tt really needs to be pre-allocated, so that we can leave the bo in a consistent state.
/Thomas
Quoted 33 lines
Christian.
Quoted 29 lines
/Thomas
Quoted 25 lines
Christian.
Quoted 21 lines
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2 10/15] drm/i915/ttm: Introduce a TTM i915 gem object backend
In reply to Thomas HellströmQuoted 326 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.Remove the old lmem backend.
Signed-off-by Thomas Hellström <[email protected]>---
v2:
- Break out needed TTM functionality to a separate patch (Reported by Christian König).
- Fix an unhandled error (Reported by Matthew Auld and Maarten Lankhorst)
- Remove a stray leftoversg_tableallocation (Reported by Matthew Auld)
- Usettm_tt_unpopulate()rather thanttm_tt_destroy()in the purge path as some TTM functionality relies on having attm_ttpresent for !is_iomem.--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 84 --- drivers/gpu/drm/i915/gem/i915_gem_lmem.h | 5 - drivers/gpu/drm/i915/gem/i915_gem_object.c | 125 +++-- 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 | 519 ++++++++++++++++++ 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 +- 15 files changed, 696 insertions(+), 141 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
-84@@ -4,74 +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)) { -intel_region_ttm_node_free (obj->mm.region, obj->mm.st_mm_node); -return PTR_ERR (pages); - } - -__i915_gem_object_set_pages (obj, pages,i915_sg_dma_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,@@ -103,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 +69
-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,69 @@ 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 +328,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 +421,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)
drivers/gpu/drm/i915/gem/i915_gem_object.c int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset, · line 452
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +10
-0+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--;
Can't pages_count be > 1, which would also be reflected in pages_pin_count? The vma_pin path looks very complex.
Quoted 15 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +7
-0+ } +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 +0
-0
drivers/gpu/drm/i915/gem/i915_gem_object.h static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj) · line 204
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +2
-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);
Interesting, so we bump the lru even when we just drop the lock?
Quoted 105 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +7
-0+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 +29
-0@@ -0,0 +1,519 @@ +// 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.
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 39
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +10
-0+* @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 {
What is the _tt here btw? Translation table? We also have use_tt elsewhere. ttm_tt looks like it just holds an array of pages, and associated data? ttm_pv?
Quoted 99 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +99
-0+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))
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 148
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +10
-0+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;
What's the story here?
Quoted 67 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +67
-0+} + +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_tt_unpopulate (bo->bdev, bo->ttm); + bo->ttm->page_flags |=TTM_PAGE_FLAG_ZERO_ALLOC ; + } + + obj->mm.madv = __I915_MADV_PURGED; +} + +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 *
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 225
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +10
-0+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 );
So at the moment we just have lmem using the new ttm backend, right? Stolen and system are unchanged?
Quoted 280 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +280
-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); + +if (man->use_tt) +return i915_ttm_tt_get_st (bo->ttm); + +return intel_region_ttm_node_to_st (obj->mm.region, res->mm_node); +} + +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_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 == -ENOSPC ? -ENXIO : 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_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 ; + } +
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 515
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +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); + obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; +i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); + + 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);
Move this further up, or add some onion?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2 11/15] drm/i915/lmem: Verify checks for lmem residency
In reply to Thomas HellströmQuoted 6 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]>
Christian König
maintainerRe: [PATCH v2 09/15] drm/ttm, drm/amdgpu: Allow the driver some control over swapping
In reply to Thomas HellströmAm 19.05.21 um 08:27 schrieb Thomas Hellström:
Quoted 56 lines · Christian König
Quoted 54 lines
Am 18.05.21 um 18:07 schrieb Thomas Hellström:
Quoted 53 lines · Christian König
Quoted 51 lines
Am 18.05.21 um 17:38 schrieb Thomas Hellström:
Quoted 39 lines · Christian König
Quoted 37 lines
Am 18.05.21 um 17:20 schrieb Thomas Hellström:
Quoted 36 lines · Christian König
Quoted 33 lines
Am 18.05.21 um 17:15 schrieb Thomas Hellström:
Quoted 18 lines · Thomas Hellström
Quoted 16 lines
We are calling the
eviction_valuabledriver callback at eviction time to determine whether we actually can evict a buffer object.
The upcoming i915 TTM backend needs the same functionality for swapout, and that might actually be beneficial to other drivers as well.Add an
eviction_valuablecall also in the swapout path. Try to keep the current behaviour for all drivers by returning true if the buffer object is already in theTTM_PL_SYSTEMplacement. We change behaviour for the case where a buffer object is in a TT backed placement when swapped out, in which case the drivers normaleviction_valuablepath is run.Finally export
ttm_tt_unpopulate()and don't swap out bos that are not populated. This allows a driver to purge a bo at swapout time if its content is no longer valuable rather than to have TTM swap the contents out.Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>Signed-off-by Thomas Hellström <[email protected]>Christian,
Here we have a
ttm_tt_unpopulate()export as well at the end. I figure you will push back on that one. What we really need is a functionality to just drop the bo contents and end up in system memory unpopulated. Should I perhaps add a utility function to do that instead? likettm_bo_purge()?We already have that. Just call
ttm_bo_validate()without any place to put the buffer.See how
ttm_bo_pipeline_gutting()is used.Christian.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
OK, so is that reentrant from the
move()orswap_notify()callback.That sounds like a design bug to me since you should never need to do this.
When you want to destroy the backing store of a buffer during eviction you should just do this by returning an empty placement from the
evict_flagscallback.So this is for the functionality where the user has indicated that the contents is no longer of value, but the buffer itself
is cached until evicted or swapped out for performance reasons. So the above would work for eviction, but what about swapout. Could we add some similar functionality there?Amdgpu has the same functionality and you don't need to handle swap at all.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Just return from the
evict_flagsthat you want to drop the backing store as soon as the BO leaves the GTT domain.Hmm, the
pipeline_guttingfunction seems ok, but overly complex if the bo is already idle, Am I allowed to optimize it slightly for the latter case?Yeah, sure. We just never hat that use case so far.
One thing about the code here that makes me worried is that the "destination"
ttm_ttis allocated *after*pipeline_gutting. We're not really allowed to fail here because that would leave the BO in a state where codepaths (fault for example) try to access a NULLttm_tt. While the idle case can get away withttm_tt_unpopulate, for the async case,ttm_ttreally needs to be pre-allocated, so that we can leave the bo in a consistent state.
Well the original plan was to make tt allocation purely optional.
But I didn't had the time so far to actually fix that.
Christian.
Quoted 37 lines
/Thomas
Quoted 33 lines
Christian.
Quoted 29 lines
/Thomas
Quoted 25 lines
Christian.
Quoted 21 lines
/Thomas
Quoted 18 lines
Regards,
Christian.Quoted 13 lines
/Thomas
Quoted 8 lines
Quoted 7 lines
Thanks,
Thomas
Thomas Hellström
reviewerRe: [Intel-gfx] [PATCH v2 10/15] drm/i915/ttm: Introduce a TTM i915 gem object backend
In reply to Matthew AuldThanks a lot for reviewing, Matthew!
Quoted 42 lines · Matthew Auld
Quoted 40 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.Remove the old lmem backend.
Signed-off-by Thomas Hellström <[email protected]>drivers/gpu/drm/i915/gem/i915_gem_object.c +23
-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) {
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c int i915_gem_object_read_from_page(struct drm_i915_gem_object *obj, u64 offset, · line 452
Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +6
-0+if (i915_vma_is_pinned (vma)) { +spin_unlock (&obj->vma.lock); +return false; + } +if (atomic_read (&vma->pages_count)) + pin_count--;Can't
pages_countbe > 1, which would also be reflected inpages_pin_count? Thevma_pinpath looks very complex.
Yes, and Maarten pointed out a bug in it as well. We now only take a pages_pin_count when vma->pages_count transitions from 0->1 so the above code should be correct, I think.
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +7
-0+ } +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 +0
-0@@ -200,6 +200,9 @@ static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj)
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h static inline bool i915_gem_object_trylock(struct drm_i915_gem_object *obj) · line 204
Quoted 4 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +2
-0static inline void i915_gem_object_unlock (struct drm_i915_gem_object *obj) { +if (obj->ops->adjust_lru) + obj->ops->adjust_lru (obj);Interesting, so we bump the lru even when we just drop the lock?
Yes, as an initial approximation. TTM has historically done this and it may not be the best choice, but dropping the lock means we've just used the object for something, typically CS, so hence we bump the LRU.
Quoted 110 lines
Quoted 110 lines
drivers/gpu/drm/i915/gem/i915_gem_object.h +7
-0+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 +34
-0@@ -0,0 +1,519 @@ +// 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
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 39
Quoted 5 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +5
-0+* 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 {What is the
_tthere btw? Translation table? We also haveuse_ttelsewhere.ttm_ttlooks like it just holds an array of pages, and associated data?ttm_pv?
It's just bad naming. i915_ttm_pv would be better, I agree, but other drivers consistently use tt.
Quoted 103 lines
Quoted 103 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +102
-0+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 */
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 148
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +7
-0+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;What's the story here?
Here it's indicated that the bo is about to be evicted and TTM asks us where to place it. We place it in system memory, but that system memory is not yet visible to GEM.
Quoted 72 lines
Quoted 72 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +71
-0+} + +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_tt_unpopulate (bo->bdev, bo->ttm); + bo->ttm->page_flags |=TTM_PAGE_FLAG_ZERO_ALLOC ; + } + + obj->mm.madv = __I915_MADV_PURGED; +} + +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); +
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 225
Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +6
-0+/* 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 );So at the moment we just have lmem using the new ttm backend, right? Stolen and system are unchanged?
ATM yes.
Quoted 284 lines
Quoted 284 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +283
-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); + +if (man->use_tt) +return i915_ttm_tt_get_st (bo->ttm); + +return intel_region_ttm_node_to_st (obj->mm.region, res->mm_node); +} + +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_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 == -ENOSPC ? -ENXIO : 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_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);
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c line 515
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c new file +7
-0+i915_gem_object_make_unshrinkable (obj); + obj->read_domains =I915_GEM_DOMAIN_WC |I915_GEM_DOMAIN_GTT ; +i915_gem_object_set_cache_coherency (obj,I915_CACHE_NONE ); + + 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);Move this further up, or add some onion?
Might need to revisit that again to figure out what destructors are called autmatically on failure there. Thing is once ttm_bo_init has succeeded, it's published on LRU lists and available for mmap, so we'd better have everything initialized.
Quoted 2 lines
Reviewed-by Matthew Auld <[email protected]>
/Thomas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx