intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration
@ 2021-06-30 13:06 Thomas Hellström
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic Thomas Hellström
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Hellström @ 2021-06-30 13:06 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Thomas Hellström, matthew.auld

Our dma-buf code is currently completely broken unless the importer is
dynamic in which case the sg_list caching saves the day. In particular,
the case where another instance of our driver tries to import a dma-buf
exported by our driver ends up in a recursive lock.

Since the recent TTM migration work spec specifies to fix up the dma-buf
code with migration and there's no point in doing so when it's
completely broken, take a first step to make at least the exporter obey
the dma-buf locking rules the dma-buf core enforces for a dynamic exporter:

- Implement and act on pin- and unpin.
- Call move_notify if migrating. (we opt not to migrate while dma-buf_mapped).
- map_dma_buf() is unconditionally called locked.

Add a selftest that ensures that it works with both our own and a fake
dynamic importer.

Also implement migration in the second patch before pinning in pin()
and map_dma_buf().

Note that the importer remains broken for other non-dynamic exporters, but
at least not for the same-driver-separate-instances case.

Regardless whether we want to fix this now with this series, or in an
unspecified future, the selftest may come in handy.

Thomas Hellström (2):
  drm/i915/gem: Make our dma-buf exporter dynamic
  drm/i915/gem: Migrate to system at dma-buf map time

 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  48 ++++++-
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 118 +++++++++++++++++-
 2 files changed, 162 insertions(+), 4 deletions(-)

-- 
2.31.1

_______________________________________________
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

* [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic
  2021-06-30 13:06 [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration Thomas Hellström
@ 2021-06-30 13:07 ` Thomas Hellström
  2021-06-30 14:01   ` Daniel Vetter
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 2/2] drm/i915/gem: Migrate to system at dma-buf map time Thomas Hellström
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Thomas Hellström @ 2021-06-30 13:07 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Thomas Hellström, matthew.auld

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.

Add a live selftest to exercise both dynamic and non-dynamic exports,
and as a workaround until we fully support dynamic import and export,
declare the exporter dynamic by providing pin() and unpin() implementations.
For dynamic importers, make sure we keep the pinning also in map_dma_buf(),
to ensure we never need to call dma_buf_move_notify().
Calling dma_buf_move_notify() is at the discretion of the exporter.

v2:
- Extend the selftest with a fake dynamic importer.
- Provide real pin and unpin callbacks to not abuse the interface.

Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  31 ++++-
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116 +++++++++++++++++-
 2 files changed, 143 insertions(+), 4 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..918c19df7b66 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,7 +27,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);
+	assert_object_held(obj);
+
+	/*
+	 * Note. In the dynamic importer case, the object is not yet pinned.
+	 * Let's pin it here to avoid having to call the move_notify
+	 * callback, The call of which is not yet implemented.
+	 */
+	ret = i915_gem_object_pin_pages(obj);
 	if (ret)
 		goto err;
 
@@ -168,6 +177,21 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
 	return err;
 }
 
+static int i915_gem_dmabuf_pin(struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
+
+	assert_object_held(obj);
+	return i915_gem_object_pin_pages(obj);
+}
+
+static void i915_gem_dmabuf_unpin(struct dma_buf_attachment *attach)
+{
+	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
+
+	i915_gem_object_unpin_pages(obj);
+}
+
 static const struct dma_buf_ops i915_dmabuf_ops =  {
 	.map_dma_buf = i915_gem_map_dma_buf,
 	.unmap_dma_buf = i915_gem_unmap_dma_buf,
@@ -177,6 +201,8 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
 	.vunmap = i915_gem_dmabuf_vunmap,
 	.begin_cpu_access = i915_gem_begin_cpu_access,
 	.end_cpu_access = i915_gem_end_cpu_access,
+	.pin = i915_gem_dmabuf_pin,
+	.unpin = i915_gem_dmabuf_unpin,
 };
 
 struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags)
@@ -241,7 +267,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

* [Intel-gfx] [PATCH 2/2] drm/i915/gem: Migrate to system at dma-buf map time
  2021-06-30 13:06 [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration Thomas Hellström
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic Thomas Hellström
@ 2021-06-30 13:07 ` Thomas Hellström
  2021-06-30 17:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: dma-buf fixes for migration Patchwork
  2021-06-30 18:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Hellström @ 2021-06-30 13:07 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Thomas Hellström, matthew.auld

Until we support p2p dma or as a complement to that, migrate data
to system memory at dma-buf map 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.

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

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index 918c19df7b66..13312d89c2ed 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -34,7 +34,14 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	 * Let's pin it here to avoid having to call the move_notify
 	 * callback, The call of which is not yet implemented.
 	 */
-	ret = i915_gem_object_pin_pages(obj);
+	if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
+		return ERR_PTR(-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);
 	if (ret)
 		goto err;
 
@@ -180,9 +187,19 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
 static int i915_gem_dmabuf_pin(struct dma_buf_attachment *attach)
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->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_unpin(struct dma_buf_attachment *attach)
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

* Re: [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic Thomas Hellström
@ 2021-06-30 14:01   ` Daniel Vetter
  2021-06-30 14:06     ` Ruhl, Michael J
  2021-06-30 17:14     ` Daniel Vetter
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Vetter @ 2021-06-30 14:01 UTC (permalink / raw)
  To: Thomas Hellström, Christian König
  Cc: intel-gfx, dri-devel, matthew.auld

On Wed, Jun 30, 2021 at 03:07:00PM +0200, Thomas Hellström wrote:
> 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.
> 
> Add a live selftest to exercise both dynamic and non-dynamic exports,
> and as a workaround until we fully support dynamic import and export,
> declare the exporter dynamic by providing pin() and unpin() implementations.
> For dynamic importers, make sure we keep the pinning also in map_dma_buf(),
> to ensure we never need to call dma_buf_move_notify().
> Calling dma_buf_move_notify() is at the discretion of the exporter.
> 
> v2:
> - Extend the selftest with a fake dynamic importer.
> - Provide real pin and unpin callbacks to not abuse the interface.
> 
> Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

I'm not happy with this, because i915 is currently violating the dma-resv
fencing rules for dynamic dma-buf.

Yes since this is just the exporter we can probably get away with yolo'ing
things, but Christian and me just spend a lot of angry typing figuring out
what the rules actually are, so I really don't like bending them even more
just because it's less typing.

All we need for a quick interim fix is to not take the dma_resv_lock from
our map/unamp callbacks. Pinning our backing storage from attach/detach
callbacks (which are also called under dma_resv_lock) would also achieve
that, without mudding any waters. So essentially just moving the
pin/unpin_pages_unlocked and we should be good, which is almost as little
typing.

Michael, since Thomas is on vacations now, care to type that up? The
selftest is imo solid.

This is also consistent with what all other ttm based drivers do (aside
from amdgpu, which is fully dynamic), see drm_gem_map_attach in
drm_prime.c

Adding Christian as fyi.
-Daniel

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  31 ++++-
>  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116 +++++++++++++++++-
>  2 files changed, 143 insertions(+), 4 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..918c19df7b66 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,7 +27,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);
> +	assert_object_held(obj);
> +
> +	/*
> +	 * Note. In the dynamic importer case, the object is not yet pinned.
> +	 * Let's pin it here to avoid having to call the move_notify
> +	 * callback, The call of which is not yet implemented.
> +	 */
> +	ret = i915_gem_object_pin_pages(obj);
>  	if (ret)
>  		goto err;
>  
> @@ -168,6 +177,21 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
>  	return err;
>  }
>  
> +static int i915_gem_dmabuf_pin(struct dma_buf_attachment *attach)
> +{
> +	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
> +
> +	assert_object_held(obj);
> +	return i915_gem_object_pin_pages(obj);
> +}
> +
> +static void i915_gem_dmabuf_unpin(struct dma_buf_attachment *attach)
> +{
> +	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
> +
> +	i915_gem_object_unpin_pages(obj);
> +}
> +
>  static const struct dma_buf_ops i915_dmabuf_ops =  {
>  	.map_dma_buf = i915_gem_map_dma_buf,
>  	.unmap_dma_buf = i915_gem_unmap_dma_buf,
> @@ -177,6 +201,8 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
>  	.vunmap = i915_gem_dmabuf_vunmap,
>  	.begin_cpu_access = i915_gem_begin_cpu_access,
>  	.end_cpu_access = i915_gem_end_cpu_access,
> +	.pin = i915_gem_dmabuf_pin,
> +	.unpin = i915_gem_dmabuf_unpin,
>  };
>  
>  struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags)
> @@ -241,7 +267,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
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
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 1/2] drm/i915/gem: Make our dma-buf exporter dynamic
  2021-06-30 14:01   ` Daniel Vetter
@ 2021-06-30 14:06     ` Ruhl, Michael J
  2021-06-30 17:14     ` Daniel Vetter
  1 sibling, 0 replies; 8+ messages in thread
From: Ruhl, Michael J @ 2021-06-30 14:06 UTC (permalink / raw)
  To: Daniel Vetter, Thomas Hellström, Christian König
  Cc: intel-gfx, Auld, Matthew, dri-devel

>-----Original Message-----
>From: Daniel Vetter <daniel@ffwll.ch>
>Sent: Wednesday, June 30, 2021 10:02 AM
>To: Thomas Hellström <thomas.hellstrom@linux.intel.com>; Christian König
><ckoenig.leichtzumerken@gmail.com>
>Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Auld,
>Matthew <matthew.auld@intel.com>; maarten.lankhorst@linux.intel.com;
>daniel@ffwll.ch; Ruhl, Michael J <michael.j.ruhl@intel.com>
>Subject: Re: [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic
>
>On Wed, Jun 30, 2021 at 03:07:00PM +0200, Thomas Hellström wrote:
>> 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.
>>
>> Add a live selftest to exercise both dynamic and non-dynamic exports,
>> and as a workaround until we fully support dynamic import and export,
>> declare the exporter dynamic by providing pin() and unpin()
>implementations.
>> For dynamic importers, make sure we keep the pinning also in
>map_dma_buf(),
>> to ensure we never need to call dma_buf_move_notify().
>> Calling dma_buf_move_notify() is at the discretion of the exporter.
>>
>> v2:
>> - Extend the selftest with a fake dynamic importer.
>> - Provide real pin and unpin callbacks to not abuse the interface.
>>
>> Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
>I'm not happy with this, because i915 is currently violating the dma-resv
>fencing rules for dynamic dma-buf.
>
>Yes since this is just the exporter we can probably get away with yolo'ing
>things, but Christian and me just spend a lot of angry typing figuring out
>what the rules actually are, so I really don't like bending them even more
>just because it's less typing.
>
>All we need for a quick interim fix is to not take the dma_resv_lock from
>our map/unamp callbacks. Pinning our backing storage from attach/detach
>callbacks (which are also called under dma_resv_lock) would also achieve
>that, without mudding any waters. So essentially just moving the
>pin/unpin_pages_unlocked and we should be good, which is almost as little
>typing.
>
>Michael, since Thomas is on vacations now, care to type that up? The
>selftest is imo solid.

Yes, I will get that done.

Mike

>This is also consistent with what all other ttm based drivers do (aside
>from amdgpu, which is fully dynamic), see drm_gem_map_attach in
>drm_prime.c
>
>Adding Christian as fyi.
>-Daniel
>
>> ---
>>  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  31 ++++-
>>  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116
>+++++++++++++++++-
>>  2 files changed, 143 insertions(+), 4 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..918c19df7b66 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,7 +27,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);
>> +	assert_object_held(obj);
>> +
>> +	/*
>> +	 * Note. In the dynamic importer case, the object is not yet pinned.
>> +	 * Let's pin it here to avoid having to call the move_notify
>> +	 * callback, The call of which is not yet implemented.
>> +	 */
>> +	ret = i915_gem_object_pin_pages(obj);
>>  	if (ret)
>>  		goto err;
>>
>> @@ -168,6 +177,21 @@ static int i915_gem_end_cpu_access(struct
>dma_buf *dma_buf, enum dma_data_direct
>>  	return err;
>>  }
>>
>> +static int i915_gem_dmabuf_pin(struct dma_buf_attachment *attach)
>> +{
>> +	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach-
>>dmabuf);
>> +
>> +	assert_object_held(obj);
>> +	return i915_gem_object_pin_pages(obj);
>> +}
>> +
>> +static void i915_gem_dmabuf_unpin(struct dma_buf_attachment *attach)
>> +{
>> +	struct drm_i915_gem_object *obj = dma_buf_to_obj(attach-
>>dmabuf);
>> +
>> +	i915_gem_object_unpin_pages(obj);
>> +}
>> +
>>  static const struct dma_buf_ops i915_dmabuf_ops =  {
>>  	.map_dma_buf = i915_gem_map_dma_buf,
>>  	.unmap_dma_buf = i915_gem_unmap_dma_buf,
>> @@ -177,6 +201,8 @@ static const struct dma_buf_ops i915_dmabuf_ops =
>{
>>  	.vunmap = i915_gem_dmabuf_vunmap,
>>  	.begin_cpu_access = i915_gem_begin_cpu_access,
>>  	.end_cpu_access = i915_gem_end_cpu_access,
>> +	.pin = i915_gem_dmabuf_pin,
>> +	.unpin = i915_gem_dmabuf_unpin,
>>  };
>>
>>  struct dma_buf *i915_gem_prime_export(struct drm_gem_object
>*gem_obj, int flags)
>> @@ -241,7 +267,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
>>
>
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>http://blog.ffwll.ch
_______________________________________________
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 1/2] drm/i915/gem: Make our dma-buf exporter dynamic
  2021-06-30 14:01   ` Daniel Vetter
  2021-06-30 14:06     ` Ruhl, Michael J
@ 2021-06-30 17:14     ` Daniel Vetter
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2021-06-30 17:14 UTC (permalink / raw)
  To: Thomas Hellström, Christian König
  Cc: intel-gfx, Matthew Auld, dri-devel

On Wed, Jun 30, 2021 at 4:01 PM Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Jun 30, 2021 at 03:07:00PM +0200, Thomas Hellström wrote:
> > 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.
> >
> > Add a live selftest to exercise both dynamic and non-dynamic exports,
> > and as a workaround until we fully support dynamic import and export,
> > declare the exporter dynamic by providing pin() and unpin() implementations.
> > For dynamic importers, make sure we keep the pinning also in map_dma_buf(),
> > to ensure we never need to call dma_buf_move_notify().
> > Calling dma_buf_move_notify() is at the discretion of the exporter.
> >
> > v2:
> > - Extend the selftest with a fake dynamic importer.
> > - Provide real pin and unpin callbacks to not abuse the interface.
> >
> > Reported-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
> > Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> I'm not happy with this, because i915 is currently violating the dma-resv
> fencing rules for dynamic dma-buf.
>
> Yes since this is just the exporter we can probably get away with yolo'ing
> things, but Christian and me just spend a lot of angry typing figuring out
> what the rules actually are, so I really don't like bending them even more
> just because it's less typing.

To clarify what I meant here: I think the code is correct in the sense
that it's not breaking any other existing code upstream in a
functional or security relevant way.

What I meant with yolo merging is that if we land some dynamic dma-buf
exporter support just to fix a bug which with slightly more lines can
be fixed without resorting to quickly enabling dynamic dma-buf
exporting while a) we know i915 is breaking dma-resv rules already and
b) there was just a few weeks of rather angry discussions on this
topic.

That's just a recipe to piss people off, at least if I'd be in
Christian's shoes and see this land I'd get furious. So yolo on the
collaboration and people side of things, not so much technically
incorrect.

Plus with the sketch I described below we can fix the underlying issue
we're seeing in a clean way, by essentially aligning what i915 does to
what all other non-dynamic dma-buf ttm driver implementations do in
drm_prime.c. Defacto that's the only way that works, and it is the
contract for non-dynamic dma-buf for a driver using dma_resv_lock. The
only reason we could get away without lockdep splats with our current
dma-buf code in i915 of attempting to handle dma-buf more dynamic was
because we used our completely independent locking design (and also
never shared with another i915 instance). That illusion falls apart
with i915 using dma-resv and with now multiple i915 instances being
possible.

tldr; Using this way we can cleanly untangle solving the locking issue
at hand from the fairly bigger topic of how we are going to support
dynamic dma-buf and p2p and all that in i915.

I hope this explains a bit better why I have my take here like that.
-Daniel

> All we need for a quick interim fix is to not take the dma_resv_lock from
> our map/unamp callbacks. Pinning our backing storage from attach/detach
> callbacks (which are also called under dma_resv_lock) would also achieve
> that, without mudding any waters. So essentially just moving the
> pin/unpin_pages_unlocked and we should be good, which is almost as little
> typing.
>
> Michael, since Thomas is on vacations now, care to type that up? The
> selftest is imo solid.
>
> This is also consistent with what all other ttm based drivers do (aside
> from amdgpu, which is fully dynamic), see drm_gem_map_attach in
> drm_prime.c
>
> Adding Christian as fyi.
> -Daniel
>
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  31 ++++-
> >  .../drm/i915/gem/selftests/i915_gem_dmabuf.c  | 116 +++++++++++++++++-
> >  2 files changed, 143 insertions(+), 4 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..918c19df7b66 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,7 +27,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);
> > +     assert_object_held(obj);
> > +
> > +     /*
> > +      * Note. In the dynamic importer case, the object is not yet pinned.
> > +      * Let's pin it here to avoid having to call the move_notify
> > +      * callback, The call of which is not yet implemented.
> > +      */
> > +     ret = i915_gem_object_pin_pages(obj);
> >       if (ret)
> >               goto err;
> >
> > @@ -168,6 +177,21 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_direct
> >       return err;
> >  }
> >
> > +static int i915_gem_dmabuf_pin(struct dma_buf_attachment *attach)
> > +{
> > +     struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
> > +
> > +     assert_object_held(obj);
> > +     return i915_gem_object_pin_pages(obj);
> > +}
> > +
> > +static void i915_gem_dmabuf_unpin(struct dma_buf_attachment *attach)
> > +{
> > +     struct drm_i915_gem_object *obj = dma_buf_to_obj(attach->dmabuf);
> > +
> > +     i915_gem_object_unpin_pages(obj);
> > +}
> > +
> >  static const struct dma_buf_ops i915_dmabuf_ops =  {
> >       .map_dma_buf = i915_gem_map_dma_buf,
> >       .unmap_dma_buf = i915_gem_unmap_dma_buf,
> > @@ -177,6 +201,8 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
> >       .vunmap = i915_gem_dmabuf_vunmap,
> >       .begin_cpu_access = i915_gem_begin_cpu_access,
> >       .end_cpu_access = i915_gem_end_cpu_access,
> > +     .pin = i915_gem_dmabuf_pin,
> > +     .unpin = i915_gem_dmabuf_unpin,
> >  };
> >
> >  struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags)
> > @@ -241,7 +267,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
> >
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
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

* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: dma-buf fixes for migration
  2021-06-30 13:06 [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration Thomas Hellström
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic Thomas Hellström
  2021-06-30 13:07 ` [Intel-gfx] [PATCH 2/2] drm/i915/gem: Migrate to system at dma-buf map time Thomas Hellström
@ 2021-06-30 17:46 ` Patchwork
  2021-06-30 18:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
  3 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2021-06-30 17:46 UTC (permalink / raw)
  To: Thomas Hellström; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/gem: dma-buf fixes for migration
URL   : https://patchwork.freedesktop.org/series/92070/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
3b50433924c8 drm/i915/gem: Make our dma-buf exporter dynamic
-:16: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#16: 
declare the exporter dynamic by providing pin() and unpin() implementations.

total: 0 errors, 1 warnings, 0 checks, 202 lines checked
bde352ace7ae drm/i915/gem: Migrate to system at dma-buf map time


_______________________________________________
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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gem: dma-buf fixes for migration
  2021-06-30 13:06 [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration Thomas Hellström
                   ` (2 preceding siblings ...)
  2021-06-30 17:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: dma-buf fixes for migration Patchwork
@ 2021-06-30 18:15 ` Patchwork
  3 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2021-06-30 18:15 UTC (permalink / raw)
  To: Thomas Hellström; +Cc: intel-gfx


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

== Series Details ==

Series: drm/i915/gem: dma-buf fixes for migration
URL   : https://patchwork.freedesktop.org/series/92070/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10295 -> Patchwork_20494
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_20494 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_20494, 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_20494/index.html

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

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

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

  * igt@runner@aborted:
    - fi-snb-2520m:       NOTRUN -> [FAIL][51]
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-snb-2520m/igt@runner@aborted.html
    - fi-snb-2600:        NOTRUN -> [FAIL][52]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/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-tgl-dsi}:       [PASS][53] -> [DMESG-FAIL][54]
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-tgl-dsi/igt@i915_selftest@live@dmabuf.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-tgl-dsi/igt@i915_selftest@live@dmabuf.html
    - {fi-hsw-gt1}:       [PASS][55] -> [DMESG-FAIL][56]
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-hsw-gt1/igt@i915_selftest@live@dmabuf.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-hsw-gt1/igt@i915_selftest@live@dmabuf.html
    - {fi-ehl-2}:         [PASS][57] -> [DMESG-FAIL][58]
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-ehl-2/igt@i915_selftest@live@dmabuf.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-ehl-2/igt@i915_selftest@live@dmabuf.html
    - {fi-tgl-1115g4}:    [PASS][59] -> [DMESG-FAIL][60]
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-tgl-1115g4/igt@i915_selftest@live@dmabuf.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-tgl-1115g4/igt@i915_selftest@live@dmabuf.html
    - {fi-jsl-1}:         [PASS][61] -> [DMESG-FAIL][62]
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-jsl-1/igt@i915_selftest@live@dmabuf.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-jsl-1/igt@i915_selftest@live@dmabuf.html
    - {fi-dg1-1}:         [PASS][63] -> [DMESG-FAIL][64]
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-dg1-1/igt@i915_selftest@live@dmabuf.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-dg1-1/igt@i915_selftest@live@dmabuf.html

  * igt@runner@aborted:
    - {fi-dg1-1}:         NOTRUN -> [FAIL][65]
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-dg1-1/igt@runner@aborted.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-cml-s:           [PASS][66] -> [DMESG-FAIL][67] ([i915#2291] / [i915#541])
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10295/fi-cml-s/igt@i915_selftest@live@gt_heartbeat.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-cml-s/igt@i915_selftest@live@gt_heartbeat.html

  * igt@runner@aborted:
    - fi-ilk-650:         NOTRUN -> [FAIL][68] ([fdo#109271])
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-ilk-650/igt@runner@aborted.html
    - fi-pnv-d510:        NOTRUN -> [FAIL][69] ([fdo#109271] / [i915#2403] / [i915#2505])
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-pnv-d510/igt@runner@aborted.html
    - fi-bsw-kefka:       NOTRUN -> [FAIL][70] ([fdo#109271] / [i915#1436])
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-bsw-kefka/igt@runner@aborted.html
    - fi-cfl-8700k:       NOTRUN -> [FAIL][71] ([i915#3363])
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-cfl-8700k/igt@runner@aborted.html
    - fi-skl-6600u:       NOTRUN -> [FAIL][72] ([i915#1436] / [i915#3363])
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-skl-6600u/igt@runner@aborted.html
    - fi-cfl-8109u:       NOTRUN -> [FAIL][73] ([i915#3363])
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-cfl-8109u/igt@runner@aborted.html
    - fi-glk-dsi:         NOTRUN -> [FAIL][74] ([i915#3363] / [k.org#202321])
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-glk-dsi/igt@runner@aborted.html
    - fi-bsw-nick:        NOTRUN -> [FAIL][75] ([fdo#109271] / [i915#1436])
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-bsw-nick/igt@runner@aborted.html
    - fi-kbl-8809g:       NOTRUN -> [FAIL][76] ([i915#1436] / [i915#3363])
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-8809g/igt@runner@aborted.html
    - fi-kbl-r:           NOTRUN -> [FAIL][77] ([i915#1436] / [i915#3363])
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-r/igt@runner@aborted.html
    - fi-bdw-5557u:       NOTRUN -> [FAIL][78] ([i915#1602] / [i915#2029])
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-bdw-5557u/igt@runner@aborted.html
    - fi-bwr-2160:        NOTRUN -> [FAIL][79] ([i915#2505])
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-bwr-2160/igt@runner@aborted.html
    - fi-kbl-soraka:      NOTRUN -> [FAIL][80] ([i915#1436] / [i915#3363])
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-soraka/igt@runner@aborted.html
    - fi-hsw-4770:        NOTRUN -> [FAIL][81] ([fdo#109271] / [i915#1436] / [i915#2505])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-hsw-4770/igt@runner@aborted.html
    - fi-kbl-7500u:       NOTRUN -> [FAIL][82] ([i915#1436] / [i915#3363])
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-7500u/igt@runner@aborted.html
    - fi-kbl-guc:         NOTRUN -> [FAIL][83] ([i915#1436] / [i915#3363])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-guc/igt@runner@aborted.html
    - fi-ivb-3770:        NOTRUN -> [FAIL][84] ([fdo#109271])
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-ivb-3770/igt@runner@aborted.html
    - fi-bxt-dsi:         NOTRUN -> [FAIL][85] ([i915#3363])
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-bxt-dsi/igt@runner@aborted.html
    - fi-elk-e7500:       NOTRUN -> [FAIL][86] ([fdo#109271])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-elk-e7500/igt@runner@aborted.html
    - fi-cml-s:           NOTRUN -> [FAIL][87] ([i915#3363] / [i915#3462])
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-cml-s/igt@runner@aborted.html
    - fi-cfl-guc:         NOTRUN -> [FAIL][88] ([i915#3363])
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-cfl-guc/igt@runner@aborted.html
    - fi-icl-y:           NOTRUN -> [FAIL][89] ([i915#2782])
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-icl-y/igt@runner@aborted.html
    - fi-kbl-7567u:       NOTRUN -> [FAIL][90] ([i915#1436] / [i915#3363])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/fi-kbl-7567u/igt@runner@aborted.html
    - fi-skl-6700k2:      NOTRUN -> [FAIL][91] ([i915#1436] / [i915#3363])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20494/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#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
  [i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
  [i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
  [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#541]: https://gitlab.freedesktop.org/drm/intel/issues/541
  [k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321


Participating hosts (39 -> 36)
------------------------------

  Missing    (3): fi-ilk-m540 fi-bsw-cyan fi-bdw-samus 


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

  * Linux: CI_DRM_10295 -> Patchwork_20494

  CI-20190529: 20190529
  CI_DRM_10295: 683b7f160eb6993ccfc19e67e3c7111f12946bea @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_6124: 357d5477c93f2bdd3354afe91b89ccfd4ee4fd56 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_20494: bde352ace7ae5caa0350095bf3330bb5a783dba0 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

bde352ace7ae drm/i915/gem: Migrate to system at dma-buf map time
3b50433924c8 drm/i915/gem: Make our dma-buf exporter dynamic

== Logs ==

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

[-- Attachment #1.2: Type: text/html, Size: 20216 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

end of thread, other threads:[~2021-06-30 18:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 13:06 [Intel-gfx] [PATCH 0/2] drm/i915/gem: dma-buf fixes for migration Thomas Hellström
2021-06-30 13:07 ` [Intel-gfx] [PATCH 1/2] drm/i915/gem: Make our dma-buf exporter dynamic Thomas Hellström
2021-06-30 14:01   ` Daniel Vetter
2021-06-30 14:06     ` Ruhl, Michael J
2021-06-30 17:14     ` Daniel Vetter
2021-06-30 13:07 ` [Intel-gfx] [PATCH 2/2] drm/i915/gem: Migrate to system at dma-buf map time Thomas Hellström
2021-06-30 17:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gem: dma-buf fixes for migration Patchwork
2021-06-30 18:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).