Skip to contentSkip to conversation

drm/i915/gem: Introduce a migrate interface

PATCH Superseded Thomas Hellström 4 participants 19 messages Jun 24, 2021 – Jun 25, 2021

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover drm/i915/gem: Introduce a migrate interface

We want to be able to explicitly migrate objects between gem memory regions, initially for display and dma-buf, but there might be more use-cases coming up.

Introduce a gem migrate interface, add a selftest and use it for display fb pinning and dma-buf mapping.

This series should make the desktop light up on DG1 with DG1-enabled mesa.

Matthew Auld (1):
drm/i915/gem: Introduce a selftest for the gem object migrate
functionality

Thomas Hellström (3):
drm/i915/gem: Implement object migration drm/i915/display: Migrate objects to LMEM if possible for display drm/i915/gem: Migrate to system at dma-buf map time

 drivers/gpu/drm/i915/display/intel_display.c  |   5 +-
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |   9 +-
 drivers/gpu/drm/i915/gem/i915_gem_domain.c    |   2 +-
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c      |  21 --
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |  92 +++++++
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  12 +-
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |   9 +
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |  69 +++--
 drivers/gpu/drm/i915/gem/i915_gem_wait.c      |  19 ++
 .../drm/i915/gem/selftests/i915_gem_migrate.c | 237 ++++++++++++++++++
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 11 files changed, 434 insertions(+), 42 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
Signature · 6 lines
2.31.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/4 drm/i915/gem: Implement object migration

Introduce an interface to migrate objects between regions. This is primarily intended to migrate objects to LMEM for display and to SYSTEM for dma-buf, but might be reused in one form or another for performande-based migration.

---
 drivers/gpu/drm/i915/gem/i915_gem_object.c    | 91 +++++++++++++++++++
 drivers/gpu/drm/i915/gem/i915_gem_object.h    | 12 +++
 .../gpu/drm/i915/gem/i915_gem_object_types.h  |  9 ++
 drivers/gpu/drm/i915/gem/i915_gem_ttm.c       | 69 ++++++++++----
 drivers/gpu/drm/i915/gem/i915_gem_wait.c      | 19 ++++
 5 files changed, 183 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +91 -0
index 07e8ff9a8aae..6421c3a8b2f3 100644
@@ -513,6 +513,97 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj)
 	return obj->mem_flags & I915_BO_FLAG_IOMEM;
 }
 
+/**
+ * i915_gem_object_can_migrate - Whether an object likely can be migrated
+ *
+ * @obj: The object to migrate
+ * @id: The region intended to migrate to
+ *
+ * Check whether the object backend supports migration to the
+ * given region. Note that pinning may affect the ability to migrate.
+ *
+ * Return: true if migration is possible, false otherwise.
+ */
+bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
+				 enum intel_region_id id)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int num_allowed = obj->mm.n_placements;
+	struct intel_memory_region *mr;
+	unsigned int i;
+
+	GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
+	GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
+
+	if (!obj->ops->migrate)
+		return -EOPNOTSUPP;
+
+	mr = i915->mm.regions[id];
+	if (obj->mm.region == mr)
+		return true;
+
+	if (!i915_gem_object_evictable(obj))
+		return false;
+
+	if (!(obj->flags & I915_BO_ALLOC_USER))
+		return true;
+
+	if (num_allowed == 0)
+		return false;
+
+	for (i = 0; i < num_allowed; ++i) {
+		if (mr == obj->mm.placements[i])
+			return true;
+	}
+
+	return false;
+}
+
+/**
+ * i915_gem_object_migrate - Migrate an object to the desired region id
+ * @obj: The object to migrate.
+ * @ww: An optional struct i915_gem_ww_ctx. If NULL, the backend may
+ * not be successful in evicting other objects to make room for this object.
+ * @id: The region id to migrate to.
+ *
+ * Attempt to migrate the object to the desired memory region. The
+ * object backend must support migration and the object may not be
+ * pinned, (explicitly pinned pages or pinned vmas). The object must
+ * be locked.
+ * On successful completion, the object will have pages pointing to
+ * memory in the new region, but an async migration task may not have
+ * completed yet, and to accomplish that, i915_gem_object_wait_migration()
+ * must be called.
+ *
+ * Return: 0 on success. Negative error code on failure. In particular may
+ * return -ENXIO on lack of region space, -EDEADLK for deadlock avoidance
+ * if @ww is set, -EINTR or -ERESTARTSYS if signal pending, and
+ * -EBUSY if the object is pinned.
+ */
+int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
+			    struct i915_gem_ww_ctx *ww,
+			    enum intel_region_id id)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	struct intel_memory_region *mr;
+
+	GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
+	GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
+	assert_object_held(obj);
+
+	mr = i915->mm.regions[id];
+	if (obj->mm.region == mr)
+		return 0;
+
+	if (!i915_gem_object_evictable(obj))
+		return -EBUSY;
+
+	if (!obj->ops->migrate)
+		return -EOPNOTSUPP;
+
+	return obj->ops->migrate(obj, mr);
+}
+
 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 +12 -0
index ea3224a480c4..8cbd7a5334e2 100644
@@ -17,6 +17,8 @@
 #include "i915_gem_ww.h"
 #include "i915_vma_types.h"
 
+enum intel_region_id;
+
 /*
  * XXX: There is a prevalence of the assumption that we fit the
  * object's page count inside a 32bit _signed_ variable. Let's document
@@ -597,6 +599,16 @@ bool i915_gem_object_migratable(struct drm_i915_gem_object *obj);
 
 bool i915_gem_object_validates_to_lmem(struct drm_i915_gem_object *obj);
 
+int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
+			    struct i915_gem_ww_ctx *ww,
+			    enum intel_region_id id);
+
+bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
+				 enum intel_region_id id);
+
+int i915_gem_object_wait_migration(struct drm_i915_gem_object *obj,
+				   unsigned int flags);
+
 #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 +9 -0
index 441f913c87e6..ef3de2ae9723 100644
@@ -18,6 +18,7 @@
 
 struct drm_i915_gem_object;
 struct intel_fronbuffer;
+struct intel_memory_region;
 
 /*
  * struct i915_lut_handle tracks the fast lookups from handle to vma used
@@ -77,6 +78,14 @@ struct drm_i915_gem_object_ops {
 	 * delayed_free - Override the default delayed free implementation
 	 */
 	void (*delayed_free)(struct drm_i915_gem_object *obj);
+
+	/**
+	 * migrate - Migrate object to a different region either for
+	 * pinning or for as long as the object lock is held.
+	 */
+	int (*migrate)(struct drm_i915_gem_object *obj,
+		       struct intel_memory_region *mr);
+
 	void (*release)(struct drm_i915_gem_object *obj);
 
 	const struct vm_operations_struct *mmap_ops;
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +52 -17

108 lines not on this page · raw message

drivers/gpu/drm/i915/gem/i915_gem_wait.c +19 -0
index 1070d3afdce7..e9f7a8d9f0e2 100644
@@ -290,3 +290,22 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 	i915_gem_object_put(obj);
 	return ret;
 }
+
+/**
+ * i915_gem_object_wait_migrate - Sync an accelerated migration operation
+ * @obj: The migrating object.
+ * @flags: waiting flags. Currently supports only I915_WAIT_INTERRUPTIBLE.
+ *
+ * Wait for any pending async migration operation on the object,
+ * whether it's explicitly (i915_gem_object_migrate()) or implicitly
+ * (swapin, initial clearing) initiated.
+ *
+ * Return: 0 if successful, -ERESTARTSYS if a signal was hit during waiting.
+ */
+int i915_gem_object_wait_migration(struct drm_i915_gem_object *obj,
+				   unsigned int flags)
+{
+	might_sleep();
+	/* NOP for now. */
+	return 0;
+}
Signature · 6 lines
2.31.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/4 drm/i915/gem: Introduce a selftest for the gem object migrate functionality

In reply to Thomas Hellström

From: Matthew Auld <[email protected]>

A selftest for the gem object migrate functionality. Slightly adapted from the original by Matthew to the new interface and new fill blit code.

---
 drivers/gpu/drm/i915/gem/i915_gem_object.c    |   1 +
 .../drm/i915/gem/selftests/i915_gem_migrate.c | 237 ++++++++++++++++++
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 3 files changed, 239 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c
drivers/gpu/drm/i915/gem/i915_gem_object.c +1 -0
index 6421c3a8b2f3..24f4395bf387 100644
@@ -644,6 +644,7 @@ static const struct drm_gem_object_funcs i915_gem_object_funcs = {
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftests/huge_gem_object.c"
 #include "selftests/huge_pages.c"
+#include "selftests/i915_gem_migrate.c"
 #include "selftests/i915_gem_object.c"
 #include "selftests/i915_gem_coherency.c"
 #endif
drivers/gpu/drm/i915/gem/selftests/i915_gem_migrate.c new file +237 -0

237 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
index a68197cf1044..e2fd1b61af71 100644
@@ -40,6 +40,7 @@ selftest(hugepages, i915_gem_huge_page_live_selftests)
 selftest(gem_contexts, i915_gem_context_live_selftests)
 selftest(gem_execbuf, i915_gem_execbuffer_live_selftests)
 selftest(client, i915_gem_client_blt_live_selftests)
+selftest(gem_migrate, i915_gem_migrate_live_selftests)
 selftest(reset, intel_reset_live_selftests)
 selftest(memory_region, intel_memory_region_live_selftests)
 selftest(hangcheck, intel_hangcheck_live_selftests)
Signature · 1 line
2.31.1
#4 lore raw

PATCH 3/4 drm/i915/display: Migrate objects to LMEM if possible for display

In reply to Thomas Hellström

Objects intended to be used as display framebuffers must reside in LMEM for discrete. If they happen to not do that, migrate them to LMEM before pinning.

---
 drivers/gpu/drm/i915/display/intel_display.c |  5 ++++-
 drivers/gpu/drm/i915/gem/i915_gem_domain.c   |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c     | 21 --------------------
 drivers/gpu/drm/i915/gem/i915_gem_object.h   |  2 --
 4 files changed, 5 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +4 -1
index 4524dbfa5e42..83a4aba54d67 100644
@@ -1331,6 +1331,9 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
 	ret = i915_gem_object_lock(obj, &ww);
 	if (!ret && phys_cursor)
 		ret = i915_gem_object_attach_phys(obj, alignment);
+	else if (!ret && HAS_LMEM(dev_priv))
+		ret = i915_gem_object_migrate(obj, &ww, INTEL_REGION_LMEM);
+	/* TODO: Do we need to sync when migration becomes async? */
 	if (!ret)
 		ret = i915_gem_object_pin_pages(obj);
 	if (ret)
@@ -11770,7 +11773,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_validates_to_lmem(obj)) {
+	if (HAS_LMEM(i915) && !i915_gem_object_can_migrate(obj, INTEL_REGION_LMEM)) {
 		/* object is "remote", not in local memory */
 		i915_gem_object_put(obj);
 		return ERR_PTR(-EREMOTE);
drivers/gpu/drm/i915/gem/i915_gem_domain.c +1 -1
index 073822100da7..7d1400b13429 100644
@@ -375,7 +375,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 	struct i915_vma *vma;
 	int ret;
 
-	/* Frame buffer must be in LMEM (no migration yet) */
+	/* Frame buffer must be in LMEM */
 	if (HAS_LMEM(i915) && !i915_gem_object_is_lmem(obj))
 		return ERR_PTR(-EINVAL);
 
drivers/gpu/drm/i915/gem/i915_gem_lmem.c +0 -21
index 41d5182cd367..be1d122574af 100644
@@ -23,27 +23,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
 	return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
 }
 
-/**
- * i915_gem_object_validates_to_lmem - Whether the object is resident in
- * lmem when pages are present.
- * @obj: The object to check.
- *
- * Migratable objects residency may change from under us if the object is
- * not pinned or locked. This function is intended to be used to check whether
- * the object can only reside in lmem when pages are present.
- *
- * Return: Whether the object is always resident in lmem when pages are
- * present.
- */
-bool i915_gem_object_validates_to_lmem(struct drm_i915_gem_object *obj)
-{
-	struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
-
-	return !i915_gem_object_migratable(obj) &&
-		mr && (mr->type == INTEL_MEMORY_LOCAL ||
-		       mr->type == INTEL_MEMORY_STOLEN_LOCAL);
-}
-
 /**
  * i915_gem_object_is_lmem - Whether the object is resident in
  * lmem
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -2
index 8cbd7a5334e2..d423d8cac4f2 100644
@@ -597,8 +597,6 @@ 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);
-
 int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
 			    struct i915_gem_ww_ctx *ww,
 			    enum intel_region_id id);
Signature · 1 line
2.31.1
#5 lore raw

PATCH 4/4 drm/i915/gem: Migrate to system at dma-buf map time

In reply to Thomas Hellström

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +8 -1
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	struct scatterlist *src, *dst;
 	int ret, i;
 
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);
+	if (ret)
+		return ERR_PTR(ret);
+
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+	i915_gem_object_unlock(obj);
 	if (ret)
 		goto err;
 
Signature · 6 lines
2.31.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: Introduce a migrate interface

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm/i915/gem: Introduce a migrate interface
URL : https://patchwork.freedesktop.org/series/91890/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
ee56ef21edf6 drm/i915/gem: Implement object migration
c7fc34104143 drm/i915/gem: Introduce a selftest for the gem object migrate functionality
-:31: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#31: 
new file mode 100644

total: 0 errors, 1 warnings, 0 checks, 251 lines checked 974c401400ff drm/i915/display: Migrate objects to LMEM if possible for display de1e6e1fa3f7 drm/i915/gem: Migrate to system at dma-buf map time

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/gem: Introduce a migrate interface

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm/i915/gem: Introduce a migrate interface
URL : https://patchwork.freedesktop.org/series/91890/
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/i915/display/intel_display.c:1896:21:    expected struct i915_vma *[assigned] vma
+drivers/gpu/drm/i915/display/intel_display.c:1896:21:    got void [noderef] __iomem *[assigned] iomem
+drivers/gpu/drm/i915/display/intel_display.c:1896:21: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_reset.c:1396:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block
+drivers/gpu/drm/i915/gt/intel_ring_submission.c:1207:24: warning: Using plain integer as NULL pointer
+drivers/gpu/drm/i915/i915_perf.c:1434:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/i915_perf.c:1488:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/selftests/i915_syncmap.c:80:54: warning: dubious: x | !y
+./include/asm-generic/bitops/find.h:112:45: warning: shift count is negative (-262080)
+./include/asm-generic/bitops/find.h:32:31: warning: shift count is negative (-262080)
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write8' - different lock contexts for basic block

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: Introduce a migrate interface

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm/i915/gem: Introduce a migrate interface
URL : https://patchwork.freedesktop.org/series/91890/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10278 -> Patchwork_20462
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/index.html

New tests
---------

New tests have been introduced between CI_DRM_10278 and Patchwork_20462:

### New IGT tests (1) ###

* igt@i915_selftest@live@gem_migrate:
- Statuses : 34 pass(s)
- Exec time: [0.43, 5.13] s

Known issues
------------

Here are the changes found in Patchwork_20462 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@module-reload:
- fi-kbl-7500u: [PASS][1] -> [INCOMPLETE][2] ([i915#151] / [i915#2405])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/fi-kbl-7500u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/fi-kbl-7500u/igt@[email protected]

* igt@runner@aborted:
- fi-kbl-7500u: NOTRUN -> [FAIL][3] ([fdo#109271] / [i915#1814] / [i915#2722] / [i915#3363])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/fi-kbl-7500u/igt@[email protected]

#### Possible fixes ####

* igt@i915_module_load@reload:
- {fi-tgl-dsi}: [DMESG-WARN][4] ([i915#1982] / [k.org#205379]) -> [PASS][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/fi-tgl-dsi/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/fi-tgl-dsi/igt@[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
[i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2405]: https://gitlab.freedesktop.org/drm/intel/issues/2405
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[k.org#205379]: https://bugzilla.kernel.org/show_bug.cgi?id=205379

Participating hosts (43 -> 39)
------------------------------

Missing (4): fi-ilk-m540 fi-bsw-cyan fi-bdw-samus fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_10278 -> Patchwork_20462

CI-20190529: 20190529
CI_DRM_10278: 33497e95c159f1fe3393f1016b1ec1187eab1589 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6119: a306810ebbc8984bde38a57ef0c33eea394f4e18 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20462: de1e6e1fa3f7380663488844a29ddb461157ef3c @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

de1e6e1fa3f7 drm/i915/gem: Migrate to system at dma-buf map time 974c401400ff drm/i915/display: Migrate objects to LMEM if possible for display c7fc34104143 drm/i915/gem: Introduce a selftest for the gem object migrate functionality ee56ef21edf6 drm/i915/gem: Implement object migration

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/gem: Introduce a migrate interface

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm/i915/gem: Introduce a migrate interface
URL : https://patchwork.freedesktop.org/series/91890/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10278_full -> Patchwork_20462_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with Patchwork_20462_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20462_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_20462_full:

### IGT changes ###

#### Warnings ####

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-5:
- shard-iclb: [SKIP][1] ([i915#658]) -> [SKIP][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb2/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_10278_full and Patchwork_20462_full:

### New IGT tests (1) ###

* igt@i915_selftest@live@gem_migrate:
- Statuses : 7 pass(s)
- Exec time: [0.50, 5.13] s

Known issues
------------

Here are the changes found in Patchwork_20462_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_persistence@idempotent:
- shard-snb: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#1099]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-snb7/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-iclb: [PASS][4] -> [TIMEOUT][5] ([i915#2369] / [i915#2481] / [i915#3070])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb6/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb8/igt@[email protected]

* igt@gem_exec_capture@pi@rcs0:
- shard-skl: [PASS][6] -> [INCOMPLETE][7] ([i915#2369])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl1/igt@gem_exec_capture@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl3/igt@gem_exec_capture@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-glk: [PASS][8] -> [FAIL][9] ([i915#2842])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk6/igt@gem_exec_fair@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-kbl: NOTRUN -> [FAIL][10] ([i915#2842])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_params@no-vebox:
- shard-iclb: NOTRUN -> [SKIP][11] ([fdo#109283])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@gem_exec_reloc@basic-wide-active@bcs0:
- shard-apl: NOTRUN -> [FAIL][12] ([i915#3633]) +3 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@gem_exec_reloc@[email protected]

* igt@gem_exec_reloc@basic-wide-active@rcs0:
- shard-kbl: NOTRUN -> [FAIL][13] ([i915#3633]) +4 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@gem_exec_reloc@[email protected]

* igt@gem_pread@exhaustion:
- shard-apl: NOTRUN -> [WARN][14] ([i915#2658])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]

* igt@gem_render_copy@yf-tiled-to-vebox-yf-tiled:
- shard-iclb: NOTRUN -> [SKIP][15] ([i915#768])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@gem_userptr_blits@dmabuf-sync:
- shard-apl: NOTRUN -> [SKIP][16] ([fdo#109271] / [i915#3323])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]

* igt@gem_userptr_blits@input-checking:
- shard-apl: NOTRUN -> [DMESG-WARN][17] ([i915#3002])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl8/igt@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-apl: NOTRUN -> [FAIL][18] ([i915#3318])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]

* igt@gen7_exec_parse@basic-offset:
- shard-apl: NOTRUN -> [SKIP][19] ([fdo#109271]) +290 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@gen9_exec_parse@batch-invalid-length:
- shard-snb: NOTRUN -> [SKIP][20] ([fdo#109271]) +129 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-snb7/igt@[email protected]

* igt@gen9_exec_parse@bb-start-far:
- shard-iclb: NOTRUN -> [SKIP][21] ([fdo#112306])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@i915_hangman@engine-error@vecs0:
- shard-kbl: NOTRUN -> [SKIP][22] ([fdo#109271]) +141 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@i915_hangman@[email protected]

* igt@i915_suspend@fence-restore-untiled:
- shard-apl: NOTRUN -> [DMESG-WARN][23] ([i915#180])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl3/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-apl: [PASS][24] -> [DMESG-WARN][25] ([i915#180])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl3/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd:
- shard-skl: NOTRUN -> [SKIP][26] ([fdo#109271] / [fdo#111827]) +2 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl7/igt@[email protected]

* igt@kms_chamelium@vga-hpd-for-each-pipe:
- shard-glk: NOTRUN -> [SKIP][27] ([fdo#109271] / [fdo#111827]) +2 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk7/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-ctm-limited-range:
- shard-apl: NOTRUN -> [SKIP][28] ([fdo#109271] / [fdo#111827]) +28 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl8/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-degamma:
- shard-kbl: NOTRUN -> [SKIP][29] ([fdo#109271] / [fdo#111827]) +14 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@[email protected]

* igt@kms_color_chamelium@pipe-c-ctm-limited-range:
- shard-snb: NOTRUN -> [SKIP][30] ([fdo#109271] / [fdo#111827]) +7 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-snb5/igt@[email protected]

* igt@kms_content_protection@atomic:
- shard-apl: NOTRUN -> [TIMEOUT][31] ([i915#1319]) +2 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@kms_content_protection@uevent:
- shard-apl: NOTRUN -> [FAIL][32] ([i915#2105])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-32x32-onscreen:
- shard-skl: NOTRUN -> [SKIP][33] ([fdo#109271]) +20 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl7/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-skl: NOTRUN -> [INCOMPLETE][34] ([i915#2405] / [i915#300])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl7/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-iclb: [PASS][35] -> [INCOMPLETE][36] ([i915#1185])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb3/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-256x256-random:
- shard-glk: NOTRUN -> [SKIP][37] ([fdo#109271]) +26 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk7/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-64x21-sliding:
- shard-iclb: NOTRUN -> [SKIP][38] ([fdo#109278]) +3 similar issues
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@kms_cursor_legacy@cursorb-vs-flipa-atomic-transitions:
- shard-iclb: NOTRUN -> [SKIP][39] ([fdo#109274] / [fdo#109278])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb8888-mmap-cpu-ytiled:
- shard-glk: [PASS][40] -> [DMESG-WARN][41] ([i915#118] / [i915#95]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk5/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk8/igt@[email protected]

* igt@kms_flip@absolute-wf_vblank-interruptible@a-edp1:
- shard-skl: [PASS][42] -> [DMESG-WARN][43] ([i915#1982])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl5/igt@kms_flip@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl2/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@a-edp1:
- shard-skl: [PASS][44] -> [FAIL][45] ([i915#79])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl7/igt@kms_flip@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a2:
- shard-glk: [PASS][46] -> [FAIL][47] ([i915#79])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk2/igt@kms_flip@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk1/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@a-dp1:
- shard-kbl: [PASS][48] -> [DMESG-WARN][49] ([i915#180]) +5 similar issues
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl4/igt@kms_flip@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl3/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend@b-edp1:
- shard-skl: [PASS][50] -> [INCOMPLETE][51] ([i915#198])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl10/igt@kms_flip@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl6/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@c-edp1:
- shard-skl: [PASS][52] -> [FAIL][53] ([i915#2122]) +1 similar issue
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl2/igt@kms_flip@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl9/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs:
- shard-apl: NOTRUN -> [SKIP][54] ([fdo#109271] / [i915#2672])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl3/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs.html

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-draw-blt:
- shard-iclb: NOTRUN -> [SKIP][55] ([fdo#109280]) +5 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- shard-apl: NOTRUN -> [SKIP][56] ([fdo#109271] / [i915#533]) +2 similar issues
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-alpha-basic:
- shard-apl: NOTRUN -> [FAIL][57] ([fdo#108145] / [i915#265]) +3 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl8/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-kbl: NOTRUN -> [FAIL][58] ([fdo#108145] / [i915#265])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl7/igt@[email protected]

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-1:
- shard-apl: NOTRUN -> [SKIP][59] ([fdo#109271] / [i915#658]) +3 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-5:
- shard-kbl: NOTRUN -> [SKIP][60] ([fdo#109271] / [i915#658]) +1 similar issue
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-2:
- shard-glk: NOTRUN -> [SKIP][61] ([fdo#109271] / [i915#658])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk7/igt@[email protected]

* igt@kms_psr@psr2_suspend:
- shard-iclb: [PASS][62] -> [SKIP][63] ([fdo#109441]) +1 similar issue
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb2/igt@kms_psr@psr2_suspend.html
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb8/igt@kms_psr@psr2_suspend.html

* igt@kms_sequence@queue-idle:
- shard-tglb: [PASS][64] -> [DMESG-WARN][65] ([i915#2868])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-tglb5/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-tglb5/igt@[email protected]

* igt@kms_setmode@clone-exclusive-crtc:
- shard-skl: NOTRUN -> [WARN][66] ([i915#2100])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl3/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-apl: NOTRUN -> [DMESG-WARN][67] ([i915#165])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
- shard-skl: [PASS][68] -> [INCOMPLETE][69] ([i915#198] / [i915#2405])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl9/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl6/igt@[email protected]

* igt@kms_vblank@pipe-d-wait-idle:
- shard-kbl: NOTRUN -> [SKIP][70] ([fdo#109271] / [i915#533])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl1/igt@[email protected]

* igt@kms_writeback@writeback-invalid-parameters:
- shard-apl: NOTRUN -> [SKIP][71] ([fdo#109271] / [i915#2437]) +1 similar issue
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl8/igt@[email protected]

* igt@nouveau_crc@pipe-c-source-outp-complete:
- shard-iclb: NOTRUN -> [SKIP][72] ([i915#2530])
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-skl: [PASS][73] -> [FAIL][74] ([i915#1542])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl10/igt@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl5/igt@[email protected]

* igt@perf@polling-small-buf:
- shard-skl: [PASS][75] -> [FAIL][76] ([i915#1722])
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl10/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl6/igt@[email protected]

* igt@sysfs_clients@create:
- shard-apl: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#2994]) +2 similar issues
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl2/igt@[email protected]

* igt@sysfs_clients@fair-1:
- shard-kbl: NOTRUN -> [SKIP][78] ([fdo#109271] / [i915#2994])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl4/igt@[email protected]

#### Possible fixes ####

* igt@feature_discovery@psr2:
- shard-iclb: [SKIP][79] ([i915#658]) -> [PASS][80]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb7/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb2/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-tglb: [TIMEOUT][81] ([i915#2369] / [i915#3063]) -> [PASS][82]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-tglb5/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-tglb5/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-glk: [FAIL][83] ([i915#2846]) -> [PASS][84]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk1/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk3/igt@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-tglb: [FAIL][85] ([i915#2842]) -> [PASS][86]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-tglb2/igt@gem_exec_fair@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-tglb3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [FAIL][87] ([i915#2849]) -> [PASS][88]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb4/igt@gem_exec_fair@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_mmap_gtt@big-copy-xy:
- shard-skl: [FAIL][89] ([i915#307]) -> [PASS][90] +1 similar issue
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl7/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl9/igt@[email protected]

* igt@gem_workarounds@suspend-resume-fd:
- shard-kbl: [DMESG-WARN][91] ([i915#180]) -> [PASS][92] +2 similar issues
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl2/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl7/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: [DMESG-WARN][93] ([i915#180]) -> [PASS][94] +2 similar issues
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl3/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]

* igt@kms_big_fb@linear-64bpp-rotate-0:
- shard-iclb: [DMESG-WARN][95] ([i915#3621]) -> [PASS][96]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb1/igt@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb4/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-c-128x128-left-edge:
- shard-skl: [DMESG-WARN][97] ([i915#1982]) -> [PASS][98]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl9/igt@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl6/igt@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [INCOMPLETE][99] ([i915#155] / [i915#180] / [i915#636]) -> [PASS][100]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl7/igt@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl1/igt@[email protected]

* igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible@ac-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][101] ([i915#2122]) -> [PASS][102]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk7/igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible@ac-hdmi-a1-hdmi-a2.html
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk6/igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible@ac-hdmi-a1-hdmi-a2.html

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible@ac-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][103] ([i915#79]) -> [PASS][104]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-glk4/igt@kms_flip@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-glk5/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-ts-check@c-edp1:
- shard-skl: [FAIL][105] ([i915#2122]) -> [PASS][106]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl6/igt@kms_flip@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl1/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-skl: [FAIL][107] ([i915#1188]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl7/igt@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: [FAIL][109] ([fdo#108145] / [i915#265]) -> [PASS][110] +1 similar issue
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl3/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl6/igt@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [SKIP][111] ([fdo#109441]) -> [PASS][112] +1 similar issue
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb7/igt@kms_psr@psr2_cursor_render.html
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb2/igt@kms_psr@psr2_cursor_render.html

* igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
- shard-kbl: [INCOMPLETE][113] ([i915#155]) -> [PASS][114]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl3/igt@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl6/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rc6_residency@rc6-fence:
- shard-iclb: [WARN][115] ([i915#1804] / [i915#2684]) -> [WARN][116] ([i915#2684]) +1 similar issue
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb7/igt@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
- shard-iclb: [SKIP][117] -> [SKIP][118] ([i915#658])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-iclb2/igt@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-iclb8/igt@[email protected]

* igt@runner@aborted:
- shard-kbl: ([FAIL][119], [FAIL][120], [FAIL][121], [FAIL][122], [FAIL][123], [FAIL][124], [FAIL][125], [FAIL][126]) ([i915#180] / [i915#1814] / [i915#3002] / [i915#3363] / [i915#92]) -> ([FAIL][127], [FAIL][128], [FAIL][129], [FAIL][130], [FAIL][131], [FAIL][132], [FAIL][133]) ([i915#1436] / [i915#180] / [i915#1814] / [i915#2505] / [i915#3002] / [i915#3363])
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl3/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl2/igt@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl3/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl2/igt@[email protected]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl3/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl3/igt@[email protected]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl7/igt@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-kbl7/igt@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl6/igt@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl7/igt@[email protected]
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl2/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl3/igt@[email protected]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl3/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl1/igt@[email protected]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-kbl1/igt@[email protected]
- shard-apl: ([FAIL][134], [FAIL][135], [FAIL][136], [FAIL][137], [FAIL][138]) ([fdo#109271] / [i915#180] / [i915#3363]) -> ([FAIL][139], [FAIL][140], [FAIL][141]) ([i915#180] / [i915#3002] / [i915#3363])
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl3/igt@[email protected]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl8/igt@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl3/igt@[email protected]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl1/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-apl3/igt@[email protected]
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl1/igt@[email protected]
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl8/igt@[email protected]
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-apl3/igt@[email protected]
- shard-skl: ([FAIL][142], [FAIL][143]) ([i915#1814] / [i915#3002] / [i915#3363]) -> [FAIL][144] ([i915#3002] / [i915#3363])
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl5/igt@[email protected]
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10278/shard-skl9/igt@[email protected]
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/shard-skl2/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112306]: https://bugs.freedesktop.org/show_bug.cgi?id=112306
[i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1185]: https://gitlab.freedesktop.org/drm/intel/issues/1185
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20462/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Re: [PATCH 1/4] drm/i915/gem: Implement object migration

In reply to Thomas Hellström
Quoted 38 lines · Thomas Hellström

Introduce an interface to migrate objects between regions. This is primarily intended to migrate objects to LMEM for display and to SYSTEM for dma-buf, but might be reused in one form or another for performande-based migration.

---
  drivers/gpu/drm/i915/gem/i915_gem_object.c    | 91 +++++++++++++++++++
  drivers/gpu/drm/i915/gem/i915_gem_object.h    | 12 +++
  .../gpu/drm/i915/gem/i915_gem_object_types.h  |  9 ++
  drivers/gpu/drm/i915/gem/i915_gem_ttm.c       | 69 ++++++++++----
  drivers/gpu/drm/i915/gem/i915_gem_wait.c      | 19 ++++
  5 files changed, 183 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_object.c +16 -0
index 07e8ff9a8aae..6421c3a8b2f3 100644
@@ -513,6 +513,97 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj)
  	return obj->mem_flags & I915_BO_FLAG_IOMEM;
  }
 
+/**
+ * i915_gem_object_can_migrate - Whether an object likely can be migrated
+ *
+ * @obj: The object to migrate
+ * @id: The region intended to migrate to
+ *
+ * Check whether the object backend supports migration to the
+ * given region. Note that pinning may affect the ability to migrate.
+ *
+ * Return: true if migration is possible, false otherwise.
+ */
+bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
+				 enum intel_region_id id)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	unsigned int num_allowed = obj->mm.n_placements;

drivers/gpu/drm/i915/gem/i915_gem_object.c bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj) · line 541

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +10 -0
+	struct intel_memory_region *mr;
+	unsigned int i;
+
+	GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
+	GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
+
+	if (!obj->ops->migrate)
+		return -EOPNOTSUPP;
+
+	mr = i915->mm.regions[id];

if (!mr)

    return false;

?

Quoted 43 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +43 -0
+	if (obj->mm.region == mr)
+		return true;
+
+	if (!i915_gem_object_evictable(obj))
+		return false;
+
+	if (!(obj->flags & I915_BO_ALLOC_USER))
+		return true;
+
+	if (num_allowed == 0)
+		return false;
+
+	for (i = 0; i < num_allowed; ++i) {
+		if (mr == obj->mm.placements[i])
+			return true;
+	}
+
+	return false;
+}
+
+/**
+ * i915_gem_object_migrate - Migrate an object to the desired region id
+ * @obj: The object to migrate.
+ * @ww: An optional struct i915_gem_ww_ctx. If NULL, the backend may
+ * not be successful in evicting other objects to make room for this object.
+ * @id: The region id to migrate to.
+ *
+ * Attempt to migrate the object to the desired memory region. The
+ * object backend must support migration and the object may not be
+ * pinned, (explicitly pinned pages or pinned vmas). The object must
+ * be locked.
+ * On successful completion, the object will have pages pointing to
+ * memory in the new region, but an async migration task may not have
+ * completed yet, and to accomplish that, i915_gem_object_wait_migration()
+ * must be called.
+ *
+ * Return: 0 on success. Negative error code on failure. In particular may
+ * return -ENXIO on lack of region space, -EDEADLK for deadlock avoidance
+ * if @ww is set, -EINTR or -ERESTARTSYS if signal pending, and
+ * -EBUSY if the object is pinned.
+ */
+int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
+			    struct i915_gem_ww_ctx *ww,

drivers/gpu/drm/i915/gem/i915_gem_object.c bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj) · line 594

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +10 -0
+			    enum intel_region_id id)
+{
+	struct drm_i915_private *i915 = to_i915(obj->base.dev);
+	struct intel_memory_region *mr;
+
+	GEM_BUG_ON(id >= INTEL_REGION_UNKNOWN);
+	GEM_BUG_ON(obj->mm.madv != I915_MADV_WILLNEED);
+	assert_object_held(obj);
+
+	mr = i915->mm.regions[id];

GEM_BUG_ON(!mr) ?

Quoted 163 lines
drivers/gpu/drm/i915/gem/i915_gem_object.c +12 -0
+	if (obj->mm.region == mr)
+		return 0;
+
+	if (!i915_gem_object_evictable(obj))
+		return -EBUSY;
+
+	if (!obj->ops->migrate)
+		return -EOPNOTSUPP;
+
+	return obj->ops->migrate(obj, mr);
+}
+
  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 +12 -0
index ea3224a480c4..8cbd7a5334e2 100644
@@ -17,6 +17,8 @@
  #include "i915_gem_ww.h"
  #include "i915_vma_types.h"
 
+enum intel_region_id;
+
  /*
   * XXX: There is a prevalence of the assumption that we fit the
   * object's page count inside a 32bit _signed_ variable. Let's document
@@ -597,6 +599,16 @@ bool i915_gem_object_migratable(struct drm_i915_gem_object *obj);
 
  bool i915_gem_object_validates_to_lmem(struct drm_i915_gem_object *obj);
 
+int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
+			    struct i915_gem_ww_ctx *ww,
+			    enum intel_region_id id);
+
+bool i915_gem_object_can_migrate(struct drm_i915_gem_object *obj,
+				 enum intel_region_id id);
+
+int i915_gem_object_wait_migration(struct drm_i915_gem_object *obj,
+				   unsigned int flags);
+
  #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 +9 -0
index 441f913c87e6..ef3de2ae9723 100644
@@ -18,6 +18,7 @@
 
  struct drm_i915_gem_object;
  struct intel_fronbuffer;
+struct intel_memory_region;
 
  /*
   * struct i915_lut_handle tracks the fast lookups from handle to vma used
@@ -77,6 +78,14 @@ struct drm_i915_gem_object_ops {
  	 * delayed_free - Override the default delayed free implementation
  	 */
  	void (*delayed_free)(struct drm_i915_gem_object *obj);
+
+	/**
+	 * migrate - Migrate object to a different region either for
+	 * pinning or for as long as the object lock is held.
+	 */
+	int (*migrate)(struct drm_i915_gem_object *obj,
+		       struct intel_memory_region *mr);
+
  	void (*release)(struct drm_i915_gem_object *obj);
 
  	const struct vm_operations_struct *mmap_ops;
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +36 -17
index c39d982c4fa6..b01bf0650ab0 100644
@@ -617,7 +617,8 @@ struct ttm_device_funcs *i915_ttm_driver(void)
  	return &i915_ttm_bo_driver;
  }
 
-static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
+static int __i915_ttm_get_pages(struct drm_i915_gem_object *obj,
+				struct ttm_placement *placement)
  {
  	struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
  	struct ttm_operation_ctx ctx = {
@@ -625,19 +626,12 @@ static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
  		.no_wait_gpu = false,
  	};
  	struct sg_table *st;
-	struct ttm_place requested, busy[I915_TTM_MAX_PLACEMENTS];
-	struct ttm_placement placement;
  	int real_num_busy;
  	int ret;
 
-	GEM_BUG_ON(obj->mm.n_placements > I915_TTM_MAX_PLACEMENTS);
-
-	/* Move to the requested placement. */
-	i915_ttm_placement_from_obj(obj, &requested, busy, &placement);
-
  	/* First try only the requested placement. No eviction. */
-	real_num_busy = fetch_and_zero(&placement.num_busy_placement);
-	ret = ttm_bo_validate(bo, &placement, &ctx);
+	real_num_busy = fetch_and_zero(&placement->num_busy_placement);
+	ret = ttm_bo_validate(bo, placement, &ctx);
  	if (ret) {
  		ret = i915_ttm_err_to_gem(ret);
  		/*
@@ -652,8 +646,8 @@ static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
  		 * If the initial attempt fails, allow all accepted placements,
  		 * evicting if necessary.
  		 */
-		placement.num_busy_placement = real_num_busy;
-		ret = ttm_bo_validate(bo, &placement, &ctx);
+		placement->num_busy_placement = real_num_busy;
+		ret = ttm_bo_validate(bo, placement, &ctx);
  		if (ret)
  			return i915_ttm_err_to_gem(ret);
  	}
@@ -668,16 +662,56 @@ static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
  		i915_ttm_adjust_gem_after_move(obj);
  	}
 
-	/* 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);
+	if (!obj->mm.pages) {
+		/* 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_gem_object_set_pages(obj, st, i915_sg_dma_sizes(st->sgl));
+	}
 
  	return ret;
  }
 
+static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
+{
+	struct ttm_place requested, busy[I915_TTM_MAX_PLACEMENTS];
+	struct ttm_placement placement;
+
+	GEM_BUG_ON(obj->mm.n_placements > I915_TTM_MAX_PLACEMENTS);
+
+	/* Move to the requested placement. */
+	i915_ttm_placement_from_obj(obj, &requested, busy, &placement);
+
+	return __i915_ttm_get_pages(obj, &placement);
+}
+
+static int i915_ttm_migrate(struct drm_i915_gem_object *obj,
+			    struct intel_memory_region *mr)
+{
+	struct ttm_place requested;
+	struct ttm_placement placement;
+	int ret;
+
+	i915_ttm_place_from_region(mr, &requested, obj->flags);
+	placement.num_placement = 1;
+	placement.num_busy_placement = 1;

drivers/gpu/drm/i915/gem/i915_gem_ttm.c static int i915_ttm_get_pages(struct drm_i915_gem_object *obj) · line 709

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +10 -0
+	placement.placement = &requested;
+	placement.busy_placement = &requested;
+
+	ret = __i915_ttm_get_pages(obj, &placement);
+	if (ret)
+		return ret;
+
+	if (obj->mm.region != mr) {
+		intel_memory_region_put(obj->mm.region);
+		obj->mm.region = intel_memory_region_get(mr);

i915_gem_object_{init,release}_memory_region?

Quoted 34 lines
drivers/gpu/drm/i915/gem/i915_gem_ttm.c +6 -0
+	}
+
+	return 0;
+}
+
  static void i915_ttm_put_pages(struct drm_i915_gem_object *obj,
  			       struct sg_table *st)
  {
@@ -814,6 +848,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,
+	.migrate = i915_ttm_migrate,
  	.mmap_offset = i915_ttm_mmap_offset,
  	.mmap_ops = &vm_ops_ttm,
  };
drivers/gpu/drm/i915/gem/i915_gem_wait.c +9 -0
index 1070d3afdce7..e9f7a8d9f0e2 100644
@@ -290,3 +290,22 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
  	i915_gem_object_put(obj);
  	return ret;
  }
+
+/**
+ * i915_gem_object_wait_migrate - Sync an accelerated migration operation
+ * @obj: The migrating object.
+ * @flags: waiting flags. Currently supports only I915_WAIT_INTERRUPTIBLE.
+ *
+ * Wait for any pending async migration operation on the object,
+ * whether it's explicitly (i915_gem_object_migrate()) or implicitly
+ * (swapin, initial clearing) initiated.

drivers/gpu/drm/i915/gem/i915_gem_wait.c i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · line 311

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_wait.c +10 -0
+ *
+ * Return: 0 if successful, -ERESTARTSYS if a signal was hit during waiting.
+ */
+int i915_gem_object_wait_migration(struct drm_i915_gem_object *obj,
+				   unsigned int flags)
+{
+	might_sleep();
+	/* NOP for now. */
+	return 0;
+}

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

RE: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

In reply to Thomas Hellström
Quoted 27 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld, Matthew <[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table *i915_gem_map_dma_buf(struct

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

I know for the dynamic version of dma-buf, there is a check to make sure that the lock is held when called.

I think you will run into some issues if you try to get it here as well.

Mike

Quoted 12 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +7 -0
+	if (ret)
+		return ERR_PTR(ret);
+
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+	i915_gem_object_unlock(obj);
	if (ret)
		goto err;

--
2.31.1

#7 lore raw

Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Michael,

thanks for looking at this.

Quoted 27 lines · Michael J
Quoted 27 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld, Matthew <[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table *i915_gem_map_dma_buf(struct

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
Quoted 4 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

/Thomas

Quoted 20 lines

I know for the dynamic version of dma-buf, there is a check to make sure that the lock is held when called.

I think you will run into some issues if you try to get it here as well.

Mike

Quoted 12 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +7 -0
+	if (ret)
+		return ERR_PTR(ret);
+
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+	i915_gem_object_unlock(obj);
	if (ret)
		goto err;

--
2.31.1

#8 lore raw

RE: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 49 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Michael,

thanks for looking at this.

Quoted 6 lines · Michael J
Quoted 6 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map

time

Quoted 9 lines
Quoted 9 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 6 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 6 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible combinations for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic, during attach)
2) in the ops->pin function (export_dynamic and !CONFIG_DMABUF_MOVE_NOTIFY) during mapping
3) and possibly in ops->map_dma_buf (exort_dynamic iand CONFIG_DMABUF_MOVE_NOTIFY)

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available here.

Mike

Quoted 23 lines

/Thomas

Quoted 20 lines

I know for the dynamic version of dma-buf, there is a check to make sure that the lock is held when called.

I think you will run into some issues if you try to get it here as well.

Mike

Quoted 12 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +7 -0
+	if (ret)
+		return ERR_PTR(ret);
+
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+	i915_gem_object_unlock(obj);
	if (ret)
		goto err;

--
2.31.1

#9 lore raw

Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 66 lines · Michael J
Quoted 47 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Michael,

thanks for looking at this.

Quoted 6 lines · Michael J
Quoted 6 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map

time

Quoted 8 lines
Quoted 8 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 6 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 6 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible combinations for the migrate to be attempted:

Quoted 8 lines

1) in the ops->pin function (export_dynamic != import_dynamic, during attach)
2) in the ops->pin function (export_dynamic and !CONFIG_DMABUF_MOVE_NOTIFY) during mapping
3) and possibly in ops->map_dma_buf (exort_dynamic iand CONFIG_DMABUF_MOVE_NOTIFY)

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available here.

Mike

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

/Thomas

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

RE: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 88 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 1:52 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 9 lines
Quoted 9 lines

time

Hi, Michael,

thanks for looking at this.

Quoted 2 lines · Michael J
Quoted 2 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf

Of

Quoted 44 lines
Quoted 31 lines
Quoted 4 lines
Quoted 4 lines

Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map

time

Quoted 8 lines
Quoted 8 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 6 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 6 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

Quoted 7 lines

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible combinations for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic, during

attach)

Quoted 1 line

2) in the ops->pin function (export_dynamic and

!CONFIG_DMABUF_MOVE_NOTIFY) during mapping

Quoted 1 line

3) and possibly in ops->map_dma_buf (exort_dynamic iand

CONFIG_DMABUF_MOVE_NOTIFY)

Quoted 3 lines

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available

Quoted 7 lines

here.

Quoted 2 lines

Mike

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

That is the sticky part of the move notify API.

If you do the attach_dynamic you have to have an ops with move_notify.

(https://elixir.bootlin.com/linux/v5.13-rc7/source/drivers/dma-buf/dma-buf.c#L730)

If you don't have that, i.e. just the pin interface, the attach will be rejected, and you will not get the callbacks.

So I think that the only thing we can do for now is to dop the locking and add the

assert_object_held();

M

Quoted 2 lines

/Thomas

#11 lore raw

Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Mike,

Quoted 92 lines · Michael J
Quoted 84 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 1:52 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 9 lines
Quoted 9 lines

time

Hi, Michael,

thanks for looking at this.

Quoted 2 lines · Michael J
Quoted 2 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf

Of

Quoted 44 lines
Quoted 31 lines
Quoted 4 lines
Quoted 4 lines

Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map

time

Quoted 8 lines
Quoted 8 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 6 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme · line 28

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 6 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

Quoted 7 lines

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible combinations for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic, during

attach)

Quoted 1 line

2) in the ops->pin function (export_dynamic and

!CONFIG_DMABUF_MOVE_NOTIFY) during mapping

Quoted 1 line

3) and possibly in ops->map_dma_buf (exort_dynamic iand

Quoted 8 lines

CONFIG_DMABUF_MOVE_NOTIFY)

Quoted 2 lines

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available

here.

Quoted 1 line

Mike

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

Quoted 8 lines

That is the sticky part of the move notify API.

If you do the attach_dynamic you have to have an ops with move_notify.

(https://elixir.bootlin.com/linux/v5.13-rc7/source/drivers/dma-buf/dma-buf.c#L730)

If you don't have that, i.e. just the pin interface, the attach will be rejected, and you will not get the callbacks.

I understood that as the requirement for move_notify is only if the *importer* declares dynamic. A dynamic exporter could choose whether to call move_notify() on eviction or to pin and never evict. If the importer is non-dynamic, the core calls pin() and the only choice is to pin and never evict.

So if we temporarily choose to pin and never evict for *everything*, (as the current code does now), I think we should be good for now, and then we can implement all fancy p2p and move_notify stuff on top of that.

/Thomas

Quoted 12 lines

So I think that the only thing we can do for now is to dop the locking and add the

assert_object_held();

M

Quoted 2 lines

/Thomas

#12 lore raw

RE: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 125 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 2:50 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Mike,

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 1:52 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 14 lines
Quoted 14 lines

time

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 2 lines
Quoted 2 lines

time

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi, Michael,

thanks for looking at this.

Quoted 2 lines · Michael J
Quoted 2 lines

-----Original Message-----
From: dri-devel <[email protected]> On

Behalf

Quoted 8 lines
Quoted 8 lines

Of

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

time

Quoted 4 lines
Quoted 4 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

Signed-off-by Thomas Hellström

<[email protected]>

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 19 lines
Quoted 10 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 10 lines

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 4 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible

combinations

Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic, during

attach)

Quoted 1 line

2) in the ops->pin function (export_dynamic and

!CONFIG_DMABUF_MOVE_NOTIFY) during mapping

Quoted 1 line

3) and possibly in ops->map_dma_buf (exort_dynamic iand

CONFIG_DMABUF_MOVE_NOTIFY)

Quoted 2 lines

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available

here.

Quoted 1 line

Mike

Quoted 8 lines
Quoted 3 lines

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

That is the sticky part of the move notify API.

If you do the attach_dynamic you have to have an ops with move_notify.

(https://elixir.bootlin.com/linux/v5.13-rc7/source/drivers/dma-buf/dma-

buf.c#L730)

Quoted 3 lines

If you don't have that, i.e. just the pin interface, the attach will be rejected, and you will not get the callbacks.

I understood that as the requirement for move_notify is only if the *importer* declares dynamic. A dynamic exporter could choose whether to call move_notify() on eviction or to pin and never evict. If the importer is non-dynamic, the core calls pin() and the only choice is to pin and never evict.

Quoted 3 lines

So if we temporarily choose to pin and never evict for *everything*, (as the current code does now), I think we should be good for now, and then we can implement all fancy p2p and move_notify stuff on top of that.

/sigh.

You are correct. I was mistakenly placing the pin API (dma_buf_ops) in the attach_ops. 😐 Must be Friday.

Upon further reflection, I think that your path will work.

However, is doing a pin (with no locking) from the dma_buf_mapping any different from using the pin API + export_dynamic?

M

Quoted 16 lines

/Thomas

Quoted 2 lines

So I think that the only thing we can do for now is to dop the locking and add

the

Quoted 10 lines

assert_object_held();

M

Quoted 2 lines

/Thomas

#13 lore raw

Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 131 lines · Michael J
Quoted 123 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 2:50 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Hi, Mike,

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 1:52 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 14 lines
Quoted 14 lines

time

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 2 lines
Quoted 2 lines

time

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Hi, Michael,

thanks for looking at this.

Quoted 2 lines · Michael J
Quoted 2 lines

-----Original Message-----
From: dri-devel <[email protected]> On

Behalf

Quoted 8 lines
Quoted 8 lines

Of

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; [email protected]
Cc: Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

time

Quoted 4 lines
Quoted 4 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

Signed-off-by Thomas Hellström

<[email protected]>

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 19 lines
Quoted 10 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 10 lines

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Quoted 5 lines

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 4 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs says that we're then guaranteed to get called with the object lock held.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

I figure if we make the exporter dynamic, we need to migrate already at dma_buf_pin time so we don't pin the object in the wrong location.

The exporter as dynamic (ops->pin is available) is optional, but importer dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible

combinations

Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic, during

attach)

Quoted 1 line

2) in the ops->pin function (export_dynamic and

!CONFIG_DMABUF_MOVE_NOTIFY) during mapping

Quoted 1 line

3) and possibly in ops->map_dma_buf (exort_dynamic iand

CONFIG_DMABUF_MOVE_NOTIFY)

Quoted 2 lines

Since one possibility has to be in the mapping function, it seems that if we can figure out the locking, that the migrate should probably be available

here.

Quoted 1 line

Mike

Quoted 8 lines
Quoted 3 lines

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

That is the sticky part of the move notify API.

If you do the attach_dynamic you have to have an ops with move_notify.

(https://elixir.bootlin.com/linux/v5.13-rc7/source/drivers/dma-buf/dma-

buf.c#L730)

Quoted 2 lines

If you don't have that, i.e. just the pin interface, the attach will be rejected, and you will not get the callbacks.

I understood that as the requirement for move_notify is only if the *importer* declares dynamic. A dynamic exporter could choose whether to call move_notify() on eviction or to pin and never evict. If the importer is non-dynamic, the core calls pin() and the only choice is to pin and never evict.

Quoted 3 lines

So if we temporarily choose to pin and never evict for *everything*, (as the current code does now), I think we should be good for now, and then we can implement all fancy p2p and move_notify stuff on top of that.

/sigh.

You are correct. I was mistakenly placing the pin API (dma_buf_ops) in the attach_ops. 😐 Must be Friday.

Quoted 6 lines

Upon further reflection, I think that your path will work.

However, is doing a pin (with no locking) from the dma_buf_mapping any different from using the pin API + export_dynamic?

M

Yes, it's different for dynamic importers only that would otherwise never pin, and we could mistakenly evict the object without having implemented calling move_notify. If we pin, we never evict.

/Thomas

Quoted 4 lines
Quoted 4 lines

/Thomas

Quoted 1 line

So I think that the only thing we can do for now is to dop the locking and add

Quoted 8 lines
Quoted 8 lines

the

Quoted 7 lines

assert_object_held();

M

Quoted 2 lines

/Thomas

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

RE: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 156 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 3:10 PM>To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf map time

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 2:50 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 16 lines
Quoted 16 lines

time

Hi, Mike,

Quoted 7 lines · Michael J
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 1:52 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 3 lines
Quoted 3 lines

time

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Michael J
Quoted 7 lines
Quoted 7 lines

-----Original Message-----
From: Thomas Hellström <[email protected]>
Sent: Friday, June 25, 2021 12:18 PM
To: Ruhl, Michael J <[email protected]>; intel- [email protected]; [email protected]
Cc: Auld, Matthew <[email protected]>
Subject: Re: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-

buf

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

map

Quoted 6 lines
Quoted 6 lines

time

Hi, Michael,

thanks for looking at this.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Michael J
Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: dri-devel <[email protected]> On

Behalf

Quoted 4 lines
Quoted 4 lines

Of

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Thomas Hellström
Sent: Thursday, June 24, 2021 2:31 PM
To: [email protected]; dri-

[email protected]

Quoted 33 lines
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Cc Thomas Hellström <[email protected]>; Auld,

Matthew

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [PATCH 4/4] drm/i915/gem: Migrate to system at dma-buf

map

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

time

Quoted 4 lines
Quoted 4 lines

Until we support p2p dma or as a complement to that, migrate data to system memory at dma-buf map time if possible.

Signed-off-by Thomas Hellström

<[email protected]>

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 10 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c static struct sg_table

Quoted 10 lines

---
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 9 ++++++++-

1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +0 -0
index 616c3a2f1baf..a52f885bc09a 100644
@@ -25,7 +25,14 @@ static struct sg_table

*i915_gem_map_dma_buf(struct

Quoted 8 lines

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

Quoted 6 lines

dma_buf_attachment *attachme

	struct scatterlist *src, *dst;
	int ret, i;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +1 -1
-	ret = i915_gem_object_pin_pages_unlocked(obj);
+	ret = i915_gem_object_lock_interruptible(obj, NULL);

Hmm, I believe in most cases that the caller should be holding the lock (object dma-resv) on this object already.

Yes, I agree, In particular for other instances of our own driver,  at least since the dma_resv introduction.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

But I also think that's a pre-existing bug, since i915_gem_object_pin_pages_unlocked() will also take the lock.

Ouch yes. Missed that.

Quoted 2 lines

I Think we need to initially make the exporter dynamic-capable to resolve this, and drop the locking here completely, as dma-buf docs

says

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

that we're then guaranteed to get called with the object lock held.

I figure if we make the exporter dynamic, we need to migrate already

at

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

dma_buf_pin time so we don't pin the object in the wrong location.

The exporter as dynamic (ops->pin is available) is optional, but

importer

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

dynamic (ops->move_notify) is required.

With that in mind, it would seem that there are three possible

combinations

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

for the migrate to be attempted:

1) in the ops->pin function (export_dynamic != import_dynamic,

during

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

attach)

Quoted 1 line

2) in the ops->pin function (export_dynamic and

!CONFIG_DMABUF_MOVE_NOTIFY) during mapping

Quoted 1 line

3) and possibly in ops->map_dma_buf (exort_dynamic iand

CONFIG_DMABUF_MOVE_NOTIFY)

Quoted 1 line

Since one possibility has to be in the mapping function, it seems that if

we

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can figure out the locking, that the migrate should probably be

available

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

here.

Quoted 1 line

Mike

So perhaps just to initially fix the bug, we could just implement NOP pin() and unpin() callbacks and drop the locking in map_attach() and replace it with an assert_object_held();

That is the sticky part of the move notify API.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

If you do the attach_dynamic you have to have an ops with move_notify.

(https://elixir.bootlin.com/linux/v5.13-rc7/source/drivers/dma-buf/dma-

buf.c#L730)

Quoted 2 lines

If you don't have that, i.e. just the pin interface, the attach will be rejected, and you will not get the callbacks.

I understood that as the requirement for move_notify is only if the *importer* declares dynamic. A dynamic exporter could choose whether

to

Quoted 7 lines
Quoted 7 lines

call move_notify() on eviction or to pin and never evict. If the importer is non-dynamic, the core calls pin() and the only choice is to pin and never evict.

So if we temporarily choose to pin and never evict for *everything*, (as the current code does now), I think we should be good for now, and then we can implement all fancy p2p and move_notify stuff on top of that.

Quoted 8 lines

/sigh.

You are correct. I was mistakenly placing the pin API (dma_buf_ops) in the attach_ops. 😐 Must be Friday.

Upon further reflection, I think that your path will work.

However, is doing a pin (with no locking) from the dma_buf_mapping any

Quoted 8 lines

different

Quoted 3 lines

from using the pin API + export_dynamic?

M

Yes, it's different for dynamic importers only that would otherwise never pin, and we could mistakenly evict the object without having implemented calling move_notify. If we pin, we never evict.

Ahh. Got it. That is an interesting nuance. I need to remember that there are other things than i915... 😊

So that would definitely put the migrate code in the pin path.

M

Quoted 4 lines

/Thomas

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines

/Thomas

Quoted 1 line

So I think that the only thing we can do for now is to dop the locking and

add

Quoted 8 lines
Quoted 8 lines

the

Quoted 7 lines

assert_object_held();

M

Quoted 2 lines

/Thomas

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx