All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf
@ 2021-07-01 20:20 ` Michael J. Ruhl
  0 siblings, 0 replies; 8+ messages in thread
From: Michael J. Ruhl @ 2021-07-01 20:20 UTC (permalink / raw)
  To: michael.j.ruhl, daniel, thomas.hellstrom, ckoenig.leichtzumerken,
	intel-gfx, dri-devel, matthew.auld, maarten.lankhorst

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>

If our exported dma-bufs are imported by another instance of our driver,
that instance will typically have the imported dma-bufs locked during
dma_buf_map_attachment(). But the exporter also locks the same reservation
object in the map_dma_buf() callback, which leads to recursive locking.

So taking the lock inside _pin_pages_unlocked() is incorrect.

Additionally, the current pinning code path is contrary to the defined
way that pinning should occur.

Remove the explicit pin/unpin from the map/umap functions and move them
to the attach/detach allowing correct locking to occur, and to match
the static dma-buf drm_prime pattern.

Add a live selftest to exercise both dynamic and non-dynamic
exports.

v2:
- Extend the selftest with a fake dynamic importer.
- Provide real pin and unpin callbacks to not abuse the interface.
v3: (ruhl)
- Remove the dynamic export support and move the pinning into the
  attach/detach path.
v4: (ruhl)
- Put pages does not need to assert on the dma-resv

Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  44 +++++--
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116 +++++++++++++++++-
 2 files changed, 146 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index 616c3a2f1baf..ccae17d5f441 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -12,6 +12,8 @@
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 
+I915_SELFTEST_DECLARE(static bool force_different_devices;)
+
 static struct drm_i915_gem_object *dma_buf_to_obj(struct dma_buf *buf)
 {
 	return to_intel_bo(buf->priv);
@@ -25,15 +27,11 @@ 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);
-	if (ret)
-		goto err;
-
 	/* Copy sg so that we make an independent mapping */
 	st = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
 	if (st == NULL) {
 		ret = -ENOMEM;
-		goto err_unpin_pages;
+		goto err;
 	}
 
 	ret = sg_alloc_table(st, obj->mm.pages->nents, GFP_KERNEL);
@@ -58,8 +56,6 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	sg_free_table(st);
 err_free:
 	kfree(st);
-err_unpin_pages:
-	i915_gem_object_unpin_pages(obj);
 err:
 	return ERR_PTR(ret);
 }
@@ -68,13 +64,9 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
 				   struct sg_table *sg,
 				   enum dma_data_direction dir)
 {
-	struct drm_i915_gem_object *obj = dma_buf_to_obj(attachment->dmabuf);
-
 	dma_unmap_sgtable(attachment->dev, sg, dir, DMA_ATTR_SKIP_CPU_SYNC);
 	sg_free_table(sg);
 	kfree(sg);
-
-	i915_gem_object_unpin_pages(obj);
 }
 
 static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct dma_buf_map *map)
@@ -168,7 +160,32 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
 	return err;
 }
 
+/**
+ * i915_gem_dmabuf_attach - Do any extra attach work necessary
+ * @dmabuf: imported dma-buf
+ * @attach: new attach to do work on
+ *
+ */
+static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
+				  struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+
+	assert_object_held(obj);
+	return i915_gem_object_pin_pages(obj);
+}
+
+static void i915_gem_dmabuf_detach(struct dma_buf *dmabuf,
+				   struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+
+	i915_gem_object_unpin_pages(obj);
+}
+
 static const struct dma_buf_ops i915_dmabuf_ops =  {
+	.attach = i915_gem_dmabuf_attach,
+	.detach = i915_gem_dmabuf_detach,
 	.map_dma_buf = i915_gem_map_dma_buf,
 	.unmap_dma_buf = i915_gem_unmap_dma_buf,
 	.release = drm_gem_dmabuf_release,
@@ -204,6 +221,8 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
 	struct sg_table *pages;
 	unsigned int sg_page_sizes;
 
+	assert_object_held(obj);
+
 	pages = dma_buf_map_attachment(obj->base.import_attach,
 				       DMA_BIDIRECTIONAL);
 	if (IS_ERR(pages))
@@ -241,7 +260,8 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
 	if (dma_buf->ops == &i915_dmabuf_ops) {
 		obj = dma_buf_to_obj(dma_buf);
 		/* is it from our device? */
-		if (obj->base.dev == dev) {
+		if (obj->base.dev == dev &&
+		    !I915_SELFTEST_ONLY(force_different_devices)) {
 			/*
 			 * Importing dmabuf exported from out own gem increases
 			 * refcount on gem itself instead of f_count of dmabuf.
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
index dd74bc09ec88..868b3469ecbd 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
@@ -35,7 +35,7 @@ static int igt_dmabuf_export(void *arg)
 static int igt_dmabuf_import_self(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
-	struct drm_i915_gem_object *obj;
+	struct drm_i915_gem_object *obj, *import_obj;
 	struct drm_gem_object *import;
 	struct dma_buf *dmabuf;
 	int err;
@@ -65,14 +65,125 @@ static int igt_dmabuf_import_self(void *arg)
 		err = -EINVAL;
 		goto out_import;
 	}
+	import_obj = to_intel_bo(import);
+
+	i915_gem_object_lock(import_obj, NULL);
+	err = ____i915_gem_object_get_pages(import_obj);
+	i915_gem_object_unlock(import_obj);
+	if (err) {
+		pr_err("Same object dma-buf get_pages failed!\n");
+		goto out_import;
+	}
 
 	err = 0;
 out_import:
-	i915_gem_object_put(to_intel_bo(import));
+	i915_gem_object_put(import_obj);
+out_dmabuf:
+	dma_buf_put(dmabuf);
+out:
+	i915_gem_object_put(obj);
+	return err;
+}
+
+static void igt_dmabuf_move_notify(struct dma_buf_attachment *attach)
+{
+	GEM_WARN_ON(1);
+}
+
+static const struct dma_buf_attach_ops igt_dmabuf_attach_ops = {
+	.move_notify = igt_dmabuf_move_notify,
+};
+
+static int igt_dmabuf_import_same_driver(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj, *import_obj;
+	struct drm_gem_object *import;
+	struct dma_buf *dmabuf;
+	struct dma_buf_attachment *import_attach;
+	struct sg_table *st;
+	long timeout;
+	int err;
+
+	force_different_devices = true;
+	obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+	if (IS_ERR(obj))
+		goto out_ret;
+
+	dmabuf = i915_gem_prime_export(&obj->base, 0);
+	if (IS_ERR(dmabuf)) {
+		pr_err("i915_gem_prime_export failed with err=%d\n",
+		       (int)PTR_ERR(dmabuf));
+		err = PTR_ERR(dmabuf);
+		goto out;
+	}
+
+	import = i915_gem_prime_import(&i915->drm, dmabuf);
+	if (IS_ERR(import)) {
+		pr_err("i915_gem_prime_import failed with err=%d\n",
+		       (int)PTR_ERR(import));
+		err = PTR_ERR(import);
+		goto out_dmabuf;
+	}
+
+	if (import == &obj->base) {
+		pr_err("i915_gem_prime_import reused gem object!\n");
+		err = -EINVAL;
+		goto out_import;
+	}
+
+	import_obj = to_intel_bo(import);
+
+	i915_gem_object_lock(import_obj, NULL);
+	err = ____i915_gem_object_get_pages(import_obj);
+	if (err) {
+		pr_err("Different objects dma-buf get_pages failed!\n");
+		i915_gem_object_unlock(import_obj);
+		goto out_import;
+	}
+
+	/*
+	 * If the exported object is not in system memory, something
+	 * weird is going on. TODO: When p2p is supported, this is no
+	 * longer considered weird.
+	 */
+	if (obj->mm.region != i915->mm.regions[INTEL_REGION_SMEM]) {
+		pr_err("Exported dma-buf is not in system memory\n");
+		err = -EINVAL;
+	}
+
+	i915_gem_object_unlock(import_obj);
+
+	/* Now try a fake dynamic importer */
+	import_attach = dma_buf_dynamic_attach(dmabuf, obj->base.dev->dev,
+					       &igt_dmabuf_attach_ops,
+					       NULL);
+	if (IS_ERR(import_attach))
+		goto out_import;
+
+	dma_resv_lock(dmabuf->resv, NULL);
+	st = dma_buf_map_attachment(import_attach, DMA_BIDIRECTIONAL);
+	dma_resv_unlock(dmabuf->resv);
+	if (IS_ERR(st))
+		goto out_detach;
+
+	timeout = dma_resv_wait_timeout(dmabuf->resv, false, true, 5 * HZ);
+	if (!timeout) {
+		pr_err("dmabuf wait for exclusive fence timed out.\n");
+		timeout = -ETIME;
+	}
+	err = timeout > 0 ? 0 : timeout;
+	dma_buf_unmap_attachment(import_attach, st, DMA_BIDIRECTIONAL);
+out_detach:
+	dma_buf_detach(dmabuf, import_attach);
+out_import:
+	i915_gem_object_put(import_obj);
 out_dmabuf:
 	dma_buf_put(dmabuf);
 out:
 	i915_gem_object_put(obj);
+out_ret:
+	force_different_devices = false;
 	return err;
 }
 
@@ -286,6 +397,7 @@ int i915_gem_dmabuf_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_dmabuf_export),
+		SUBTEST(igt_dmabuf_import_same_driver),
 	};
 
 	return i915_subtests(tests, i915);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-gfx] [PATCH v1 1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf
@ 2021-07-01 20:20 ` Michael J. Ruhl
  0 siblings, 0 replies; 8+ messages in thread
From: Michael J. Ruhl @ 2021-07-01 20:20 UTC (permalink / raw)
  To: michael.j.ruhl, daniel, thomas.hellstrom, ckoenig.leichtzumerken,
	intel-gfx, dri-devel, matthew.auld, maarten.lankhorst

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>

If our exported dma-bufs are imported by another instance of our driver,
that instance will typically have the imported dma-bufs locked during
dma_buf_map_attachment(). But the exporter also locks the same reservation
object in the map_dma_buf() callback, which leads to recursive locking.

So taking the lock inside _pin_pages_unlocked() is incorrect.

Additionally, the current pinning code path is contrary to the defined
way that pinning should occur.

Remove the explicit pin/unpin from the map/umap functions and move them
to the attach/detach allowing correct locking to occur, and to match
the static dma-buf drm_prime pattern.

Add a live selftest to exercise both dynamic and non-dynamic
exports.

v2:
- Extend the selftest with a fake dynamic importer.
- Provide real pin and unpin callbacks to not abuse the interface.
v3: (ruhl)
- Remove the dynamic export support and move the pinning into the
  attach/detach path.
v4: (ruhl)
- Put pages does not need to assert on the dma-resv

Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  44 +++++--
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116 +++++++++++++++++-
 2 files changed, 146 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index 616c3a2f1baf..ccae17d5f441 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -12,6 +12,8 @@
 #include "i915_gem_object.h"
 #include "i915_scatterlist.h"
 
+I915_SELFTEST_DECLARE(static bool force_different_devices;)
+
 static struct drm_i915_gem_object *dma_buf_to_obj(struct dma_buf *buf)
 {
 	return to_intel_bo(buf->priv);
@@ -25,15 +27,11 @@ 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);
-	if (ret)
-		goto err;
-
 	/* Copy sg so that we make an independent mapping */
 	st = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
 	if (st == NULL) {
 		ret = -ENOMEM;
-		goto err_unpin_pages;
+		goto err;
 	}
 
 	ret = sg_alloc_table(st, obj->mm.pages->nents, GFP_KERNEL);
@@ -58,8 +56,6 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	sg_free_table(st);
 err_free:
 	kfree(st);
-err_unpin_pages:
-	i915_gem_object_unpin_pages(obj);
 err:
 	return ERR_PTR(ret);
 }
@@ -68,13 +64,9 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
 				   struct sg_table *sg,
 				   enum dma_data_direction dir)
 {
-	struct drm_i915_gem_object *obj = dma_buf_to_obj(attachment->dmabuf);
-
 	dma_unmap_sgtable(attachment->dev, sg, dir, DMA_ATTR_SKIP_CPU_SYNC);
 	sg_free_table(sg);
 	kfree(sg);
-
-	i915_gem_object_unpin_pages(obj);
 }
 
 static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct dma_buf_map *map)
@@ -168,7 +160,32 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
 	return err;
 }
 
+/**
+ * i915_gem_dmabuf_attach - Do any extra attach work necessary
+ * @dmabuf: imported dma-buf
+ * @attach: new attach to do work on
+ *
+ */
+static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
+				  struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+
+	assert_object_held(obj);
+	return i915_gem_object_pin_pages(obj);
+}
+
+static void i915_gem_dmabuf_detach(struct dma_buf *dmabuf,
+				   struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+
+	i915_gem_object_unpin_pages(obj);
+}
+
 static const struct dma_buf_ops i915_dmabuf_ops =  {
+	.attach = i915_gem_dmabuf_attach,
+	.detach = i915_gem_dmabuf_detach,
 	.map_dma_buf = i915_gem_map_dma_buf,
 	.unmap_dma_buf = i915_gem_unmap_dma_buf,
 	.release = drm_gem_dmabuf_release,
@@ -204,6 +221,8 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
 	struct sg_table *pages;
 	unsigned int sg_page_sizes;
 
+	assert_object_held(obj);
+
 	pages = dma_buf_map_attachment(obj->base.import_attach,
 				       DMA_BIDIRECTIONAL);
 	if (IS_ERR(pages))
@@ -241,7 +260,8 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
 	if (dma_buf->ops == &i915_dmabuf_ops) {
 		obj = dma_buf_to_obj(dma_buf);
 		/* is it from our device? */
-		if (obj->base.dev == dev) {
+		if (obj->base.dev == dev &&
+		    !I915_SELFTEST_ONLY(force_different_devices)) {
 			/*
 			 * Importing dmabuf exported from out own gem increases
 			 * refcount on gem itself instead of f_count of dmabuf.
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
index dd74bc09ec88..868b3469ecbd 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
@@ -35,7 +35,7 @@ static int igt_dmabuf_export(void *arg)
 static int igt_dmabuf_import_self(void *arg)
 {
 	struct drm_i915_private *i915 = arg;
-	struct drm_i915_gem_object *obj;
+	struct drm_i915_gem_object *obj, *import_obj;
 	struct drm_gem_object *import;
 	struct dma_buf *dmabuf;
 	int err;
@@ -65,14 +65,125 @@ static int igt_dmabuf_import_self(void *arg)
 		err = -EINVAL;
 		goto out_import;
 	}
+	import_obj = to_intel_bo(import);
+
+	i915_gem_object_lock(import_obj, NULL);
+	err = ____i915_gem_object_get_pages(import_obj);
+	i915_gem_object_unlock(import_obj);
+	if (err) {
+		pr_err("Same object dma-buf get_pages failed!\n");
+		goto out_import;
+	}
 
 	err = 0;
 out_import:
-	i915_gem_object_put(to_intel_bo(import));
+	i915_gem_object_put(import_obj);
+out_dmabuf:
+	dma_buf_put(dmabuf);
+out:
+	i915_gem_object_put(obj);
+	return err;
+}
+
+static void igt_dmabuf_move_notify(struct dma_buf_attachment *attach)
+{
+	GEM_WARN_ON(1);
+}
+
+static const struct dma_buf_attach_ops igt_dmabuf_attach_ops = {
+	.move_notify = igt_dmabuf_move_notify,
+};
+
+static int igt_dmabuf_import_same_driver(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct drm_i915_gem_object *obj, *import_obj;
+	struct drm_gem_object *import;
+	struct dma_buf *dmabuf;
+	struct dma_buf_attachment *import_attach;
+	struct sg_table *st;
+	long timeout;
+	int err;
+
+	force_different_devices = true;
+	obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+	if (IS_ERR(obj))
+		goto out_ret;
+
+	dmabuf = i915_gem_prime_export(&obj->base, 0);
+	if (IS_ERR(dmabuf)) {
+		pr_err("i915_gem_prime_export failed with err=%d\n",
+		       (int)PTR_ERR(dmabuf));
+		err = PTR_ERR(dmabuf);
+		goto out;
+	}
+
+	import = i915_gem_prime_import(&i915->drm, dmabuf);
+	if (IS_ERR(import)) {
+		pr_err("i915_gem_prime_import failed with err=%d\n",
+		       (int)PTR_ERR(import));
+		err = PTR_ERR(import);
+		goto out_dmabuf;
+	}
+
+	if (import == &obj->base) {
+		pr_err("i915_gem_prime_import reused gem object!\n");
+		err = -EINVAL;
+		goto out_import;
+	}
+
+	import_obj = to_intel_bo(import);
+
+	i915_gem_object_lock(import_obj, NULL);
+	err = ____i915_gem_object_get_pages(import_obj);
+	if (err) {
+		pr_err("Different objects dma-buf get_pages failed!\n");
+		i915_gem_object_unlock(import_obj);
+		goto out_import;
+	}
+
+	/*
+	 * If the exported object is not in system memory, something
+	 * weird is going on. TODO: When p2p is supported, this is no
+	 * longer considered weird.
+	 */
+	if (obj->mm.region != i915->mm.regions[INTEL_REGION_SMEM]) {
+		pr_err("Exported dma-buf is not in system memory\n");
+		err = -EINVAL;
+	}
+
+	i915_gem_object_unlock(import_obj);
+
+	/* Now try a fake dynamic importer */
+	import_attach = dma_buf_dynamic_attach(dmabuf, obj->base.dev->dev,
+					       &igt_dmabuf_attach_ops,
+					       NULL);
+	if (IS_ERR(import_attach))
+		goto out_import;
+
+	dma_resv_lock(dmabuf->resv, NULL);
+	st = dma_buf_map_attachment(import_attach, DMA_BIDIRECTIONAL);
+	dma_resv_unlock(dmabuf->resv);
+	if (IS_ERR(st))
+		goto out_detach;
+
+	timeout = dma_resv_wait_timeout(dmabuf->resv, false, true, 5 * HZ);
+	if (!timeout) {
+		pr_err("dmabuf wait for exclusive fence timed out.\n");
+		timeout = -ETIME;
+	}
+	err = timeout > 0 ? 0 : timeout;
+	dma_buf_unmap_attachment(import_attach, st, DMA_BIDIRECTIONAL);
+out_detach:
+	dma_buf_detach(dmabuf, import_attach);
+out_import:
+	i915_gem_object_put(import_obj);
 out_dmabuf:
 	dma_buf_put(dmabuf);
 out:
 	i915_gem_object_put(obj);
+out_ret:
+	force_different_devices = false;
 	return err;
 }
 
@@ -286,6 +397,7 @@ int i915_gem_dmabuf_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(igt_dmabuf_export),
+		SUBTEST(igt_dmabuf_import_same_driver),
 	};
 
 	return i915_subtests(tests, i915);
-- 
2.31.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time
  2021-07-01 20:20 ` [Intel-gfx] " Michael J. Ruhl
@ 2021-07-01 20:20   ` Michael J. Ruhl
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael J. Ruhl @ 2021-07-01 20:20 UTC (permalink / raw)
  To: michael.j.ruhl, daniel, thomas.hellstrom, ckoenig.leichtzumerken,
	intel-gfx, dri-devel, matthew.auld, maarten.lankhorst

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>

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

v2:
- Rebase on dynamic exporter. Update the igt_dmabuf_import_same_driver
  selftest to migrate if we are LMEM capable.
v3:
- Migrate also in the pin() callback.
v4:
- Migrate in attach

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c           | 12 +++++++++++-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c |  4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index ccae17d5f441..280291a4a9dc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -170,9 +170,19 @@ static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
 				  struct dma_buf_attachment *attach)
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+	int ret;
 
 	assert_object_held(obj);
-	return i915_gem_object_pin_pages(obj);
+
+	if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
+		return -EOPNOTSUPP;
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_wait_migration(obj, 0);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+
+	return ret;
 }
 
 static void i915_gem_dmabuf_detach(struct dma_buf *dmabuf,
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
index 868b3469ecbd..b1e87ec08741 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
@@ -106,7 +106,9 @@ static int igt_dmabuf_import_same_driver(void *arg)
 	int err;
 
 	force_different_devices = true;
-	obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+	obj = i915_gem_object_create_lmem(i915, PAGE_SIZE, 0);
+	if (IS_ERR(obj))
+		obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
 	if (IS_ERR(obj))
 		goto out_ret;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-gfx] [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time
@ 2021-07-01 20:20   ` Michael J. Ruhl
  0 siblings, 0 replies; 8+ messages in thread
From: Michael J. Ruhl @ 2021-07-01 20:20 UTC (permalink / raw)
  To: michael.j.ruhl, daniel, thomas.hellstrom, ckoenig.leichtzumerken,
	intel-gfx, dri-devel, matthew.auld, maarten.lankhorst

From: Thomas Hellström <thomas.hellstrom@linux.intel.com>

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

v2:
- Rebase on dynamic exporter. Update the igt_dmabuf_import_same_driver
  selftest to migrate if we are LMEM capable.
v3:
- Migrate also in the pin() callback.
v4:
- Migrate in attach

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c           | 12 +++++++++++-
 drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c |  4 +++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index ccae17d5f441..280291a4a9dc 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -170,9 +170,19 @@ static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
 				  struct dma_buf_attachment *attach)
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
+	int ret;
 
 	assert_object_held(obj);
-	return i915_gem_object_pin_pages(obj);
+
+	if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
+		return -EOPNOTSUPP;
+	ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
+	if (!ret)
+		ret = i915_gem_object_wait_migration(obj, 0);
+	if (!ret)
+		ret = i915_gem_object_pin_pages(obj);
+
+	return ret;
 }
 
 static void i915_gem_dmabuf_detach(struct dma_buf *dmabuf,
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
index 868b3469ecbd..b1e87ec08741 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
@@ -106,7 +106,9 @@ static int igt_dmabuf_import_same_driver(void *arg)
 	int err;
 
 	force_different_devices = true;
-	obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+	obj = i915_gem_object_create_lmem(i915, PAGE_SIZE, 0);
+	if (IS_ERR(obj))
+		obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
 	if (IS_ERR(obj))
 		goto out_ret;
 
-- 
2.31.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v1,1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf
  2021-07-01 20:20 ` [Intel-gfx] " Michael J. Ruhl
  (?)
  (?)
@ 2021-07-02  1:51 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2021-07-02  1:51 UTC (permalink / raw)
  To: Michael J. Ruhl; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 14144 bytes --]

== Series Details ==

Series: series starting with [v1,1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf
URL   : https://patchwork.freedesktop.org/series/92133/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10301 -> Patchwork_20517
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_20517 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_20517, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_20517:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@dmabuf:
    - fi-cfl-8700k:       [PASS][1] -> [DMESG-FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-cfl-8700k/igt@i915_selftest@live@dmabuf.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-cfl-8700k/igt@i915_selftest@live@dmabuf.html
    - fi-glk-dsi:         [PASS][3] -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-glk-dsi/igt@i915_selftest@live@dmabuf.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-glk-dsi/igt@i915_selftest@live@dmabuf.html
    - fi-snb-2520m:       [PASS][5] -> [DMESG-FAIL][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-snb-2520m/igt@i915_selftest@live@dmabuf.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-snb-2520m/igt@i915_selftest@live@dmabuf.html
    - fi-bsw-kefka:       [PASS][7] -> [DMESG-FAIL][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-bsw-kefka/igt@i915_selftest@live@dmabuf.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bsw-kefka/igt@i915_selftest@live@dmabuf.html
    - fi-skl-6600u:       [PASS][9] -> [DMESG-FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-skl-6600u/igt@i915_selftest@live@dmabuf.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-skl-6600u/igt@i915_selftest@live@dmabuf.html
    - fi-pnv-d510:        [PASS][11] -> [DMESG-FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-pnv-d510/igt@i915_selftest@live@dmabuf.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-pnv-d510/igt@i915_selftest@live@dmabuf.html
    - fi-kbl-7567u:       [PASS][13] -> [DMESG-FAIL][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-kbl-7567u/igt@i915_selftest@live@dmabuf.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-7567u/igt@i915_selftest@live@dmabuf.html
    - fi-icl-y:           [PASS][15] -> [DMESG-FAIL][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-icl-y/igt@i915_selftest@live@dmabuf.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-icl-y/igt@i915_selftest@live@dmabuf.html
    - fi-ilk-650:         [PASS][17] -> [DMESG-FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-ilk-650/igt@i915_selftest@live@dmabuf.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-ilk-650/igt@i915_selftest@live@dmabuf.html
    - fi-ivb-3770:        [PASS][19] -> [DMESG-FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-ivb-3770/igt@i915_selftest@live@dmabuf.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-ivb-3770/igt@i915_selftest@live@dmabuf.html
    - fi-skl-6700k2:      [PASS][21] -> [DMESG-FAIL][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-skl-6700k2/igt@i915_selftest@live@dmabuf.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-skl-6700k2/igt@i915_selftest@live@dmabuf.html
    - fi-elk-e7500:       [PASS][23] -> [DMESG-FAIL][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-elk-e7500/igt@i915_selftest@live@dmabuf.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-elk-e7500/igt@i915_selftest@live@dmabuf.html
    - fi-bxt-dsi:         [PASS][25] -> [DMESG-FAIL][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-bxt-dsi/igt@i915_selftest@live@dmabuf.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bxt-dsi/igt@i915_selftest@live@dmabuf.html
    - fi-hsw-4770:        [PASS][27] -> [DMESG-FAIL][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-hsw-4770/igt@i915_selftest@live@dmabuf.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-hsw-4770/igt@i915_selftest@live@dmabuf.html
    - fi-snb-2600:        [PASS][29] -> [DMESG-FAIL][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-snb-2600/igt@i915_selftest@live@dmabuf.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-snb-2600/igt@i915_selftest@live@dmabuf.html
    - fi-bwr-2160:        [PASS][31] -> [DMESG-FAIL][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-bwr-2160/igt@i915_selftest@live@dmabuf.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bwr-2160/igt@i915_selftest@live@dmabuf.html
    - fi-kbl-soraka:      [PASS][33] -> [DMESG-FAIL][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-kbl-soraka/igt@i915_selftest@live@dmabuf.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-soraka/igt@i915_selftest@live@dmabuf.html
    - fi-bsw-nick:        [PASS][35] -> [DMESG-FAIL][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-bsw-nick/igt@i915_selftest@live@dmabuf.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bsw-nick/igt@i915_selftest@live@dmabuf.html
    - fi-kbl-7500u:       [PASS][37] -> [DMESG-FAIL][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-kbl-7500u/igt@i915_selftest@live@dmabuf.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-7500u/igt@i915_selftest@live@dmabuf.html
    - fi-bdw-5557u:       [PASS][39] -> [DMESG-FAIL][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-bdw-5557u/igt@i915_selftest@live@dmabuf.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bdw-5557u/igt@i915_selftest@live@dmabuf.html
    - fi-kbl-guc:         [PASS][41] -> [DMESG-FAIL][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-kbl-guc/igt@i915_selftest@live@dmabuf.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-guc/igt@i915_selftest@live@dmabuf.html
    - fi-kbl-r:           [PASS][43] -> [DMESG-FAIL][44]
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-kbl-r/igt@i915_selftest@live@dmabuf.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-r/igt@i915_selftest@live@dmabuf.html

  * igt@runner@aborted:
    - fi-snb-2520m:       NOTRUN -> [FAIL][45]
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-snb-2520m/igt@runner@aborted.html
    - fi-snb-2600:        NOTRUN -> [FAIL][46]
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-snb-2600/igt@runner@aborted.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@i915_selftest@live@dmabuf:
    - {fi-hsw-gt1}:       [PASS][47] -> [DMESG-FAIL][48]
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-hsw-gt1/igt@i915_selftest@live@dmabuf.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-hsw-gt1/igt@i915_selftest@live@dmabuf.html
    - {fi-ehl-2}:         [PASS][49] -> [DMESG-FAIL][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-ehl-2/igt@i915_selftest@live@dmabuf.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-ehl-2/igt@i915_selftest@live@dmabuf.html
    - {fi-tgl-1115g4}:    [PASS][51] -> [DMESG-FAIL][52]
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-tgl-1115g4/igt@i915_selftest@live@dmabuf.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-tgl-1115g4/igt@i915_selftest@live@dmabuf.html
    - {fi-jsl-1}:         [PASS][53] -> [DMESG-FAIL][54]
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-jsl-1/igt@i915_selftest@live@dmabuf.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-jsl-1/igt@i915_selftest@live@dmabuf.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s0:
    - fi-cfl-8109u:       [PASS][55] -> [INCOMPLETE][56] ([i915#155])
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10301/fi-cfl-8109u/igt@gem_exec_suspend@basic-s0.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-cfl-8109u/igt@gem_exec_suspend@basic-s0.html

  * igt@runner@aborted:
    - fi-ilk-650:         NOTRUN -> [FAIL][57] ([fdo#109271])
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-ilk-650/igt@runner@aborted.html
    - fi-pnv-d510:        NOTRUN -> [FAIL][58] ([fdo#109271] / [i915#2403] / [i915#2505])
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-pnv-d510/igt@runner@aborted.html
    - fi-cfl-8700k:       NOTRUN -> [FAIL][59] ([i915#3363])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-cfl-8700k/igt@runner@aborted.html
    - fi-skl-6600u:       NOTRUN -> [FAIL][60] ([i915#1436] / [i915#3363])
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-skl-6600u/igt@runner@aborted.html
    - fi-glk-dsi:         NOTRUN -> [FAIL][61] ([i915#3363] / [k.org#202321])
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-glk-dsi/igt@runner@aborted.html
    - fi-kbl-r:           NOTRUN -> [FAIL][62] ([i915#1436] / [i915#3363])
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-r/igt@runner@aborted.html
    - fi-bdw-5557u:       NOTRUN -> [FAIL][63] ([i915#3462])
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bdw-5557u/igt@runner@aborted.html
    - fi-bwr-2160:        NOTRUN -> [FAIL][64] ([i915#2505])
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bwr-2160/igt@runner@aborted.html
    - fi-kbl-soraka:      NOTRUN -> [FAIL][65] ([i915#1436] / [i915#3363])
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-soraka/igt@runner@aborted.html
    - fi-hsw-4770:        NOTRUN -> [FAIL][66] ([fdo#109271] / [i915#1436] / [i915#2505])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-hsw-4770/igt@runner@aborted.html
    - fi-kbl-7500u:       NOTRUN -> [FAIL][67] ([i915#1436] / [i915#3363])
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-7500u/igt@runner@aborted.html
    - fi-kbl-guc:         NOTRUN -> [FAIL][68] ([i915#1436] / [i915#3363])
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-guc/igt@runner@aborted.html
    - fi-ivb-3770:        NOTRUN -> [FAIL][69] ([fdo#109271])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-ivb-3770/igt@runner@aborted.html
    - fi-bxt-dsi:         NOTRUN -> [FAIL][70] ([i915#3363])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-bxt-dsi/igt@runner@aborted.html
    - fi-elk-e7500:       NOTRUN -> [FAIL][71] ([fdo#109271])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-elk-e7500/igt@runner@aborted.html
    - fi-icl-y:           NOTRUN -> [FAIL][72] ([i915#2782])
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-icl-y/igt@runner@aborted.html
    - fi-kbl-7567u:       NOTRUN -> [FAIL][73] ([i915#1436] / [i915#3363])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-kbl-7567u/igt@runner@aborted.html
    - fi-skl-6700k2:      NOTRUN -> [FAIL][74] ([i915#1436] / [i915#3363])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20517/fi-skl-6700k2/igt@runner@aborted.html

  
  {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#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
  [i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
  [i915#2403]: https://gitlab.freedesktop.org/drm/intel/issues/2403
  [i915#2505]: https://gitlab.freedesktop.org/drm/intel/issues/2505
  [i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
  [i915#2966]: https://gitlab.freedesktop.org/drm/intel/issues/2966
  [i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
  [i915#3462]: https://gitlab.freedesktop.org/drm/intel/issues/3462
  [i915#3626]: https://gitlab.freedesktop.org/drm/intel/issues/3626
  [i915#3717]: https://gitlab.freedesktop.org/drm/intel/issues/3717
  [k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321


Participating hosts (37 -> 32)
------------------------------

  Missing    (5): fi-cml-s fi-tgl-dsi fi-bsw-cyan fi-kbl-8809g fi-bdw-samus 


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

  * Linux: CI_DRM_10301 -> Patchwork_20517

  CI-20190529: 20190529
  CI_DRM_10301: 3d3ff5917ce204b783f4847c14e8839fde358a3a @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6128: b24e5949af7e51f0af484d2ce4cb4c5a41ac5358 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_20517: 6fc93a202468bf450a19e405c92e0de94eb4d9a7 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

6fc93a202468 drm/i915/gem: Migrate to system at dma-buf attach time
95bf4957ab06 drm/i915/gem: Correct the locking and pin pattern for dma-buf

== Logs ==

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

[-- Attachment #1.2: Type: text/html, Size: 16718 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-gfx] [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time
  2021-07-01 20:20   ` [Intel-gfx] " Michael J. Ruhl
  (?)
@ 2021-07-02  6:31     ` kernel test robot
  -1 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-07-02  6:31 UTC (permalink / raw)
  To: Michael J. Ruhl, daniel, thomas.hellstrom,
	ckoenig.leichtzumerken, intel-gfx, dri-devel, matthew.auld,
	maarten.lankhorst
  Cc: clang-built-linux, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4322 bytes --]

Hi "Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-r025-20210630 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9eb613b2de3163686b1a4bd1160f15ac56a4b083)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
        git checkout d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: error: implicit declaration of function 'i915_gem_object_can_migrate' [-Werror,-Wimplicit-function-declaration]
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: did you mean 'i915_gem_object_pin_map'?
   drivers/gpu/drm/i915/gem/i915_gem_object.h:452:20: note: 'i915_gem_object_pin_map' declared here
   void *__must_check i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
                      ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: error: implicit declaration of function 'i915_gem_object_migrate' [-Werror,-Wimplicit-function-declaration]
           ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
                 ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: error: implicit declaration of function 'i915_gem_object_wait_migration' [-Werror,-Wimplicit-function-declaration]
                   ret = i915_gem_object_wait_migration(obj, 0);
                         ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   3 errors generated.


vim +/i915_gem_object_can_migrate +177 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

   162	
   163	/**
   164	 * i915_gem_dmabuf_attach - Do any extra attach work necessary
   165	 * @dmabuf: imported dma-buf
   166	 * @attach: new attach to do work on
   167	 *
   168	 */
   169	static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
   170					  struct dma_buf_attachment *attach)
   171	{
   172		struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
   173		int ret;
   174	
   175		assert_object_held(obj);
   176	
 > 177		if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
   178			return -EOPNOTSUPP;
 > 179		ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
   180		if (!ret)
 > 181			ret = i915_gem_object_wait_migration(obj, 0);
   182		if (!ret)
   183			ret = i915_gem_object_pin_pages(obj);
   184	
   185		return ret;
   186	}
   187	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42894 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-gfx] [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time
@ 2021-07-02  6:31     ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-07-02  6:31 UTC (permalink / raw)
  To: Michael J. Ruhl, daniel, thomas.hellstrom,
	ckoenig.leichtzumerken, intel-gfx, dri-devel, matthew.auld,
	maarten.lankhorst
  Cc: clang-built-linux, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4322 bytes --]

Hi "Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-r025-20210630 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9eb613b2de3163686b1a4bd1160f15ac56a4b083)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
        git checkout d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: error: implicit declaration of function 'i915_gem_object_can_migrate' [-Werror,-Wimplicit-function-declaration]
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: did you mean 'i915_gem_object_pin_map'?
   drivers/gpu/drm/i915/gem/i915_gem_object.h:452:20: note: 'i915_gem_object_pin_map' declared here
   void *__must_check i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
                      ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: error: implicit declaration of function 'i915_gem_object_migrate' [-Werror,-Wimplicit-function-declaration]
           ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
                 ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: error: implicit declaration of function 'i915_gem_object_wait_migration' [-Werror,-Wimplicit-function-declaration]
                   ret = i915_gem_object_wait_migration(obj, 0);
                         ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   3 errors generated.


vim +/i915_gem_object_can_migrate +177 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

   162	
   163	/**
   164	 * i915_gem_dmabuf_attach - Do any extra attach work necessary
   165	 * @dmabuf: imported dma-buf
   166	 * @attach: new attach to do work on
   167	 *
   168	 */
   169	static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
   170					  struct dma_buf_attachment *attach)
   171	{
   172		struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
   173		int ret;
   174	
   175		assert_object_held(obj);
   176	
 > 177		if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
   178			return -EOPNOTSUPP;
 > 179		ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
   180		if (!ret)
 > 181			ret = i915_gem_object_wait_migration(obj, 0);
   182		if (!ret)
   183			ret = i915_gem_object_pin_pages(obj);
   184	
   185		return ret;
   186	}
   187	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42894 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-gfx] [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time
@ 2021-07-02  6:31     ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-07-02  6:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4411 bytes --]

Hi "Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-r025-20210630 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9eb613b2de3163686b1a4bd1160f15ac56a4b083)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Michael-J-Ruhl/drm-i915-gem-Correct-the-locking-and-pin-pattern-for-dma-buf/20210702-042115
        git checkout d1c1ca8d45e76fc2b9ee679c170848e6c6138f6e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: error: implicit declaration of function 'i915_gem_object_can_migrate' [-Werror,-Wimplicit-function-declaration]
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: did you mean 'i915_gem_object_pin_map'?
   drivers/gpu/drm/i915/gem/i915_gem_object.h:452:20: note: 'i915_gem_object_pin_map' declared here
   void *__must_check i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
                      ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: error: implicit declaration of function 'i915_gem_object_migrate' [-Werror,-Wimplicit-function-declaration]
           ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
                 ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:179:8: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: error: implicit declaration of function 'i915_gem_object_wait_migration' [-Werror,-Wimplicit-function-declaration]
                   ret = i915_gem_object_wait_migration(obj, 0);
                         ^
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:181:9: note: did you mean 'i915_gem_object_can_migrate'?
   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:177:7: note: 'i915_gem_object_can_migrate' declared here
           if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
                ^
   3 errors generated.


vim +/i915_gem_object_can_migrate +177 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

   162	
   163	/**
   164	 * i915_gem_dmabuf_attach - Do any extra attach work necessary
   165	 * @dmabuf: imported dma-buf
   166	 * @attach: new attach to do work on
   167	 *
   168	 */
   169	static int i915_gem_dmabuf_attach(struct dma_buf *dmabuf,
   170					  struct dma_buf_attachment *attach)
   171	{
   172		struct drm_i915_gem_object *obj = dma_buf_to_obj(dmabuf);
   173		int ret;
   174	
   175		assert_object_held(obj);
   176	
 > 177		if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
   178			return -EOPNOTSUPP;
 > 179		ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
   180		if (!ret)
 > 181			ret = i915_gem_object_wait_migration(obj, 0);
   182		if (!ret)
   183			ret = i915_gem_object_pin_pages(obj);
   184	
   185		return ret;
   186	}
   187	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42894 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-02  6:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 20:20 [PATCH v1 1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf Michael J. Ruhl
2021-07-01 20:20 ` [Intel-gfx] " Michael J. Ruhl
2021-07-01 20:20 ` [PATCH v1 2/2] drm/i915/gem: Migrate to system at dma-buf attach time Michael J. Ruhl
2021-07-01 20:20   ` [Intel-gfx] " Michael J. Ruhl
2021-07-02  6:31   ` kernel test robot
2021-07-02  6:31     ` kernel test robot
2021-07-02  6:31     ` kernel test robot
2021-07-02  1:51 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v1,1/2] drm/i915/gem: Correct the locking and pin pattern for dma-buf Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.