All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop
@ 2018-01-15 16:00 Chris Wilson
  2018-01-15 16:45 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Chris Wilson @ 2018-01-15 16:00 UTC (permalink / raw)
  To: intel-gfx

Check that we can successfully wait upon a dma_fence using the
i915_sw_fence, including the optional timeout mechanism.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 139 +++++++++++++++++++++++++
 1 file changed, 139 insertions(+)

diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
index ea01d0fe3ace..599063fc3b37 100644
--- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
@@ -27,6 +27,7 @@
 #include <linux/prime_numbers.h>
 
 #include "../i915_selftest.h"
+#include "../i915_utils.h"
 
 static int __i915_sw_fence_call
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
@@ -606,6 +607,143 @@ static int test_timer(void *arg)
 	return -EINVAL;
 }
 
+static const char *mock_name(struct dma_fence *fence)
+{
+	return "mock";
+}
+
+static bool mock_enable_signaling(struct dma_fence *fence)
+{
+	return true;
+}
+
+static const struct dma_fence_ops mock_fence_ops = {
+	.get_driver_name = mock_name,
+	.get_timeline_name = mock_name,
+	.enable_signaling = mock_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = dma_fence_free,
+};
+
+static DEFINE_SPINLOCK(mock_fence_lock);
+
+static struct dma_fence *alloc_dma_fence(void)
+{
+	struct dma_fence *dma;
+
+	dma = kmalloc(sizeof(*dma), GFP_KERNEL);
+	if (dma)
+		dma_fence_init(dma, &mock_fence_ops, &mock_fence_lock, 0, 0);
+
+	return dma;
+}
+
+static struct i915_sw_fence *
+wrap_dma_fence(struct dma_fence *dma, unsigned long delay)
+{
+	struct i915_sw_fence *fence;
+	int err;
+
+	fence = alloc_fence();
+	if (!fence)
+		return ERR_PTR(-ENOMEM);
+
+	err = i915_sw_fence_await_dma_fence(fence, dma, delay, GFP_NOWAIT);
+	i915_sw_fence_commit(fence);
+	if (err) {
+		free_fence(fence);
+		return ERR_PTR(err);
+	}
+
+	return fence;
+}
+
+static int test_dma_fence(void *arg)
+{
+	struct i915_sw_fence *timeout = NULL, *not = NULL;
+	struct dma_fence *dma;
+	unsigned long delay;
+	int err;
+
+	for_each_prime_number(delay, i915_selftest.timeout_jiffies/2) {
+		unsigned long end = jiffies + delay;
+		unsigned long sleep;
+
+		dma = alloc_dma_fence();
+		if (!dma)
+			return -ENOMEM;
+
+		timeout = wrap_dma_fence(dma, delay);
+		if (IS_ERR(timeout)) {
+			err = PTR_ERR(timeout);
+			goto err;
+		}
+
+		not = wrap_dma_fence(dma, 0);
+		if (IS_ERR(not)) {
+			err = PTR_ERR(not);
+			goto err;
+		}
+
+		err = -EINVAL;
+		if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
+			pr_err("Fences immediately signaled\n");
+			goto err;
+		}
+
+		sleep = jiffies_to_usecs(delay) / 2;
+		usleep_range(sleep, sleep);
+		if (time_after(jiffies, end)) {
+			pr_debug("Slept too long skipping pass, delay=%lu\n",
+				 delay);
+			goto skip;
+		}
+
+		if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
+			pr_err("Fences signaled too early\n");
+			goto err;
+		}
+
+		do {
+			sleep = jiffies_to_usecs(end - jiffies + 1);
+			usleep_range(sleep, 2 * sleep);
+		} while (time_before(jiffies, end));
+
+		if (i915_sw_fence_done(not)) {
+			pr_err("No tiemout fence signaled!\n");
+			goto err;
+		}
+
+		if (!i915_sw_fence_done(timeout)) {
+			pr_err("Tiemout fence unsignaled!\n");
+			goto err;
+		}
+
+skip:
+		dma_fence_signal(dma);
+
+		if (!i915_sw_fence_done(timeout) || !i915_sw_fence_done(not)) {
+			pr_err("Fences unsignaled\n");
+			goto err;
+		}
+
+		free_fence(fetch_and_zero(&not));
+		free_fence(fetch_and_zero(&timeout));
+		dma_fence_put(dma);
+	}
+
+	return 0;
+
+err:
+	dma_fence_signal(dma);
+	if (!IS_ERR_OR_NULL(timeout))
+		free_fence(timeout);
+	if (!IS_ERR_OR_NULL(not))
+		free_fence(not);
+	dma_fence_put(dma);
+	return err;
+}
+
 int i915_sw_fence_mock_selftests(void)
 {
 	static const struct i915_subtest tests[] = {
@@ -618,6 +756,7 @@ int i915_sw_fence_mock_selftests(void)
 		SUBTEST(test_chain),
 		SUBTEST(test_ipc),
 		SUBTEST(test_timer),
+		SUBTEST(test_dma_fence),
 	};
 
 	return i915_subtests(tests, NULL);
-- 
2.15.1

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

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

* ✓ Fi.CI.BAT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
@ 2018-01-15 16:45 ` Patchwork
  2018-01-15 19:31 ` ✗ Fi.CI.IGT: failure " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-01-15 16:45 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/selftests: Test i915_sw_fence/dma_fence interop
URL   : https://patchwork.freedesktop.org/series/36493/
State : success

== Summary ==

Series 36493v1 drm/i915/selftests: Test i915_sw_fence/dma_fence interop
https://patchwork.freedesktop.org/api/1.0/series/36493/revisions/1/mbox/

Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:416s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:427s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:371s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:483s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:280s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:484s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:475s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:456s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:180  dwarn:0   dfail:0   fail:0   skip:108 time:276s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:514s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:390s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:400s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:416s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:457s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:494s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:451s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:502s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:578s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:530s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:489s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:527s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:405s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:571s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:469s

37eb04c6fe0cb220563d14430cd9cdec7be0138e drm-tip: 2018y-01m-15d-14h-18m-36s UTC integration manifest
6155b7b95f8b drm/i915/selftests: Test i915_sw_fence/dma_fence interop

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7675/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.IGT: failure for drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
  2018-01-15 16:45 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-01-15 19:31 ` Patchwork
  2018-01-15 20:25   ` Chris Wilson
  2018-01-15 20:43 ` [PATCH v2] " Chris Wilson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Patchwork @ 2018-01-15 19:31 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/selftests: Test i915_sw_fence/dma_fence interop
URL   : https://patchwork.freedesktop.org/series/36493/
State : failure

== Summary ==

Test drv_selftest:
        Subgroup mock_fence:
                pass       -> INCOMPLETE (shard-snb)
                pass       -> INCOMPLETE (shard-hsw)
Test kms_flip:
        Subgroup plain-flip-ts-check-interruptible:
                pass       -> FAIL       (shard-snb) fdo#100368

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

shard-hsw        total:2682 pass:1505 dwarn:0   dfail:0   fail:10  skip:1166 time:9014s
shard-snb        total:2682 pass:1275 dwarn:0   dfail:0   fail:11  skip:1395 time:7853s
Blacklisted hosts:
shard-apl        total:2682 pass:1655 dwarn:0   dfail:0   fail:23  skip:1003 time:13218s
shard-kbl        total:2672 pass:1776 dwarn:0   dfail:0   fail:23  skip:871 time:10159s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7675/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: ✗ Fi.CI.IGT: failure for drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-15 19:31 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-01-15 20:25   ` Chris Wilson
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-01-15 20:25 UTC (permalink / raw)
  To: Patchwork; +Cc: intel-gfx

Quoting Patchwork (2018-01-15 19:31:14)
> == Series Details ==
> 
> Series: drm/i915/selftests: Test i915_sw_fence/dma_fence interop
> URL   : https://patchwork.freedesktop.org/series/36493/
> State : failure
> 
> == Summary ==
> 
> Test drv_selftest:
>         Subgroup mock_fence:
>                 pass       -> INCOMPLETE (shard-snb)
>                 pass       -> INCOMPLETE (shard-hsw)

When testing, I didn't apply the patch!
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v2] drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
  2018-01-15 16:45 ` ✓ Fi.CI.BAT: success for " Patchwork
  2018-01-15 19:31 ` ✗ Fi.CI.IGT: failure " Patchwork
@ 2018-01-15 20:43 ` Chris Wilson
  2018-01-16  9:48   ` Tvrtko Ursulin
  2018-01-15 21:05 ` ✓ Fi.CI.BAT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2) Patchwork
  2018-01-15 21:50 ` ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 1 reply; 10+ messages in thread
From: Chris Wilson @ 2018-01-15 20:43 UTC (permalink / raw)
  To: intel-gfx

Check that we can successfully wait upon a dma_fence using the
i915_sw_fence, including the optional timeout mechanism.

v2: Account for the rounding up of the timeout to the next second.
Unfortunately, the minimum delay is then 1 second.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 137 +++++++++++++++++++++++++
 1 file changed, 137 insertions(+)

diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
index ea01d0fe3ace..b51319677110 100644
--- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
@@ -27,6 +27,7 @@
 #include <linux/prime_numbers.h>
 
 #include "../i915_selftest.h"
+#include "../i915_utils.h"
 
 static int __i915_sw_fence_call
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
@@ -606,6 +607,141 @@ static int test_timer(void *arg)
 	return -EINVAL;
 }
 
+static const char *mock_name(struct dma_fence *fence)
+{
+	return "mock";
+}
+
+static bool mock_enable_signaling(struct dma_fence *fence)
+{
+	return true;
+}
+
+static const struct dma_fence_ops mock_fence_ops = {
+	.get_driver_name = mock_name,
+	.get_timeline_name = mock_name,
+	.enable_signaling = mock_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = dma_fence_free,
+};
+
+static DEFINE_SPINLOCK(mock_fence_lock);
+
+static struct dma_fence *alloc_dma_fence(void)
+{
+	struct dma_fence *dma;
+
+	dma = kmalloc(sizeof(*dma), GFP_KERNEL);
+	if (dma)
+		dma_fence_init(dma, &mock_fence_ops, &mock_fence_lock, 0, 0);
+
+	return dma;
+}
+
+static struct i915_sw_fence *
+wrap_dma_fence(struct dma_fence *dma, unsigned long delay)
+{
+	struct i915_sw_fence *fence;
+	int err;
+
+	fence = alloc_fence();
+	if (!fence)
+		return ERR_PTR(-ENOMEM);
+
+	err = i915_sw_fence_await_dma_fence(fence, dma, delay, GFP_NOWAIT);
+	i915_sw_fence_commit(fence);
+	if (err < 0) {
+		free_fence(fence);
+		return ERR_PTR(err);
+	}
+
+	return fence;
+}
+
+static int test_dma_fence(void *arg)
+{
+	struct i915_sw_fence *timeout = NULL, *not = NULL;
+	unsigned long delay = i915_selftest.timeout_jiffies;
+	unsigned long end, sleep;
+	struct dma_fence *dma;
+	int err;
+
+	dma = alloc_dma_fence();
+	if (!dma)
+		return -ENOMEM;
+
+	timeout = wrap_dma_fence(dma, delay);
+	if (IS_ERR(timeout)) {
+		err = PTR_ERR(timeout);
+		goto err;
+	}
+
+	not = wrap_dma_fence(dma, 0);
+	if (IS_ERR(not)) {
+		err = PTR_ERR(not);
+		goto err;
+	}
+
+	err = -EINVAL;
+	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
+		pr_err("Fences immediately signaled\n");
+		goto err;
+	}
+
+	/* We round the timeout for the fence up to the next second */
+	end = round_jiffies_up(jiffies + delay);
+
+	sleep = jiffies_to_usecs(delay) / 3;
+	usleep_range(sleep, 2 * sleep);
+	if (time_after(jiffies, end)) {
+		pr_debug("Slept too long, delay=%lu, skipping!\n", delay);
+		goto skip;
+	}
+
+	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
+		pr_err("Fences signaled too early\n");
+		goto err;
+	}
+
+	do {
+		sleep = jiffies_to_usecs(end - jiffies + 1);
+		usleep_range(sleep, 2 * sleep);
+	} while (!time_after(jiffies, end));
+
+	if (i915_sw_fence_done(not)) {
+		pr_err("No tiemout fence signaled!\n");
+		goto err;
+	}
+
+	if (!i915_sw_fence_done(timeout)) {
+		pr_err("Timeout fence unsignaled!\n");
+		goto err;
+	}
+
+skip:
+	dma_fence_signal(dma);
+
+	if (!i915_sw_fence_done(timeout) || !i915_sw_fence_done(not)) {
+		pr_err("Fences unsignaled\n");
+		goto err;
+	}
+
+	free_fence(fetch_and_zero(&not));
+	free_fence(fetch_and_zero(&timeout));
+	dma_fence_put(dma);
+
+	return 0;
+
+err:
+	dma_fence_signal(dma);
+	if (!IS_ERR_OR_NULL(timeout))
+		free_fence(timeout);
+	if (!IS_ERR_OR_NULL(not))
+		free_fence(not);
+	dma_fence_put(dma);
+	return err;
+}
+
 int i915_sw_fence_mock_selftests(void)
 {
 	static const struct i915_subtest tests[] = {
@@ -618,6 +754,7 @@ int i915_sw_fence_mock_selftests(void)
 		SUBTEST(test_chain),
 		SUBTEST(test_ipc),
 		SUBTEST(test_timer),
+		SUBTEST(test_dma_fence),
 	};
 
 	return i915_subtests(tests, NULL);
-- 
2.15.1

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

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

* ✓ Fi.CI.BAT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2)
  2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
                   ` (2 preceding siblings ...)
  2018-01-15 20:43 ` [PATCH v2] " Chris Wilson
@ 2018-01-15 21:05 ` Patchwork
  2018-01-15 21:50 ` ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-01-15 21:05 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2)
URL   : https://patchwork.freedesktop.org/series/36493/
State : success

== Summary ==

Series 36493v2 drm/i915/selftests: Test i915_sw_fence/dma_fence interop
https://patchwork.freedesktop.org/api/1.0/series/36493/revisions/2/mbox/

Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-kbl-r) fdo#104172 +1

fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:423s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:424s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:373s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:492s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:281s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:483s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:490s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:476s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:279s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:517s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:410s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:453s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:412s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:460s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:500s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:451s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:505s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:579s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:428s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:533s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:486s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:499s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:533s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:401s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:572s
fi-glk-dsi       total:288  pass:257  dwarn:0   dfail:0   fail:1   skip:30  time:471s

37eb04c6fe0cb220563d14430cd9cdec7be0138e drm-tip: 2018y-01m-15d-14h-18m-36s UTC integration manifest
9595f1e7c0d3 drm/i915/selftests: Test i915_sw_fence/dma_fence interop

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7676/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2)
  2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
                   ` (3 preceding siblings ...)
  2018-01-15 21:05 ` ✓ Fi.CI.BAT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2) Patchwork
@ 2018-01-15 21:50 ` Patchwork
  4 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2018-01-15 21:50 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2)
URL   : https://patchwork.freedesktop.org/series/36493/
State : success

== Summary ==

Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-pri-indfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623
Test gem_softpin:
        Subgroup noreloc-s4:
                fail       -> SKIP       (shard-snb) fdo#103375
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2723 pass:1547 dwarn:1   dfail:0   fail:9   skip:1166 time:9195s
shard-snb        total:2723 pass:1316 dwarn:1   dfail:0   fail:10  skip:1396 time:8020s
Blacklisted hosts:
shard-apl        total:2646 pass:1648 dwarn:1   dfail:0   fail:22  skip:974 time:13157s
shard-kbl        total:2713 pass:1799 dwarn:15  dfail:0   fail:23  skip:875 time:10345s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7676/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-15 20:43 ` [PATCH v2] " Chris Wilson
@ 2018-01-16  9:48   ` Tvrtko Ursulin
  2018-01-16 10:05     ` Chris Wilson
  2018-01-16 10:50     ` Chris Wilson
  0 siblings, 2 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2018-01-16  9:48 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 15/01/2018 20:43, Chris Wilson wrote:
> Check that we can successfully wait upon a dma_fence using the
> i915_sw_fence, including the optional timeout mechanism.
> 
> v2: Account for the rounding up of the timeout to the next second.
> Unfortunately, the minimum delay is then 1 second.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 137 +++++++++++++++++++++++++
>   1 file changed, 137 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> index ea01d0fe3ace..b51319677110 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
> @@ -27,6 +27,7 @@
>   #include <linux/prime_numbers.h>
>   
>   #include "../i915_selftest.h"
> +#include "../i915_utils.h"
>   
>   static int __i915_sw_fence_call
>   fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
> @@ -606,6 +607,141 @@ static int test_timer(void *arg)
>   	return -EINVAL;
>   }
>   
> +static const char *mock_name(struct dma_fence *fence)
> +{
> +	return "mock";
> +}
> +
> +static bool mock_enable_signaling(struct dma_fence *fence)
> +{
> +	return true;
> +}
> +
> +static const struct dma_fence_ops mock_fence_ops = {
> +	.get_driver_name = mock_name,
> +	.get_timeline_name = mock_name,
> +	.enable_signaling = mock_enable_signaling,
> +	.wait = dma_fence_default_wait,
> +	.release = dma_fence_free,
> +};
> +
> +static DEFINE_SPINLOCK(mock_fence_lock);
> +
> +static struct dma_fence *alloc_dma_fence(void)
> +{
> +	struct dma_fence *dma;
> +
> +	dma = kmalloc(sizeof(*dma), GFP_KERNEL);
> +	if (dma)
> +		dma_fence_init(dma, &mock_fence_ops, &mock_fence_lock, 0, 0);
> +
> +	return dma;
> +}
> +
> +static struct i915_sw_fence *
> +wrap_dma_fence(struct dma_fence *dma, unsigned long delay)

await_dma_fence?

> +{
> +	struct i915_sw_fence *fence;
> +	int err;
> +
> +	fence = alloc_fence();
> +	if (!fence)
> +		return ERR_PTR(-ENOMEM);
> +
> +	err = i915_sw_fence_await_dma_fence(fence, dma, delay, GFP_NOWAIT);
> +	i915_sw_fence_commit(fence);
> +	if (err < 0) {
> +		free_fence(fence);
> +		return ERR_PTR(err);
> +	}
> +
> +	return fence;
> +}
> +
> +static int test_dma_fence(void *arg)
> +{
> +	struct i915_sw_fence *timeout = NULL, *not = NULL;
> +	unsigned long delay = i915_selftest.timeout_jiffies;
> +	unsigned long end, sleep;
> +	struct dma_fence *dma;
> +	int err;
> +
> +	dma = alloc_dma_fence();
> +	if (!dma)
> +		return -ENOMEM;
> +
> +	timeout = wrap_dma_fence(dma, delay);
> +	if (IS_ERR(timeout)) {
> +		err = PTR_ERR(timeout);
> +		goto err;
> +	}
> +
> +	not = wrap_dma_fence(dma, 0);
> +	if (IS_ERR(not)) {
> +		err = PTR_ERR(not);
> +		goto err;
> +	}
> +
> +	err = -EINVAL;
> +	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
> +		pr_err("Fences immediately signaled\n");
> +		goto err;
> +	}
> +
> +	/* We round the timeout for the fence up to the next second */
> +	end = round_jiffies_up(jiffies + delay);
> +
> +	sleep = jiffies_to_usecs(delay) / 3;
> +	usleep_range(sleep, 2 * sleep);
> +	if (time_after(jiffies, end)) {
> +		pr_debug("Slept too long, delay=%lu, skipping!\n", delay);
> +		goto skip;
> +	}
> +
> +	if (i915_sw_fence_done(timeout) || i915_sw_fence_done(not)) {
> +		pr_err("Fences signaled too early\n");
> +		goto err;
> +	}
> +
> +	do {
> +		sleep = jiffies_to_usecs(end - jiffies + 1);
> +		usleep_range(sleep, 2 * sleep);
> +	} while (!time_after(jiffies, end));
> +
> +	if (i915_sw_fence_done(not)) {
> +		pr_err("No tiemout fence signaled!\n");
> +		goto err;
> +	}
> +
> +	if (!i915_sw_fence_done(timeout)) {
> +		pr_err("Timeout fence unsignaled!\n");
> +		goto err;
> +	}
> +
> +skip:
> +	dma_fence_signal(dma);
> +
> +	if (!i915_sw_fence_done(timeout) || !i915_sw_fence_done(not)) {
> +		pr_err("Fences unsignaled\n");
> +		goto err;
> +	}
> +
> +	free_fence(fetch_and_zero(&not));
> +	free_fence(fetch_and_zero(&timeout));

A bit of an overkill with fetch_and_zero.

> +	dma_fence_put(dma);
> +
> +	return 0;
> +
> +err:
> +	dma_fence_signal(dma);
> +	if (!IS_ERR_OR_NULL(timeout))
> +		free_fence(timeout);
> +	if (!IS_ERR_OR_NULL(not))
> +		free_fence(not);
> +	dma_fence_put(dma);
> +	return err;
> +}
> +
>   int i915_sw_fence_mock_selftests(void)
>   {
>   	static const struct i915_subtest tests[] = {
> @@ -618,6 +754,7 @@ int i915_sw_fence_mock_selftests(void)
>   		SUBTEST(test_chain),
>   		SUBTEST(test_ipc),
>   		SUBTEST(test_timer),
> +		SUBTEST(test_dma_fence),
>   	};
>   
>   	return i915_subtests(tests, NULL);
> 

Looks OK anyway.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

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

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

* Re: [PATCH v2] drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-16  9:48   ` Tvrtko Ursulin
@ 2018-01-16 10:05     ` Chris Wilson
  2018-01-16 10:50     ` Chris Wilson
  1 sibling, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-01-16 10:05 UTC (permalink / raw)
  To: Tvrtko Ursulin, intel-gfx

Quoting Tvrtko Ursulin (2018-01-16 09:48:48)
> 
> On 15/01/2018 20:43, Chris Wilson wrote:
> > +static struct dma_fence *alloc_dma_fence(void)
> > +{
> > +     struct dma_fence *dma;
> > +
> > +     dma = kmalloc(sizeof(*dma), GFP_KERNEL);
> > +     if (dma)
> > +             dma_fence_init(dma, &mock_fence_ops, &mock_fence_lock, 0, 0);
> > +
> > +     return dma;
> > +}
> > +
> > +static struct i915_sw_fence *
> > +wrap_dma_fence(struct dma_fence *dma, unsigned long delay)
> 
> await_dma_fence?

Hmm, but no, I think I prefer having the distinction that this is
creating a i915_sw_fence rather than attaching it to an existing fence,
which is what the await routines do.

[snip]

> > +skip:
> > +     dma_fence_signal(dma);
> > +
> > +     if (!i915_sw_fence_done(timeout) || !i915_sw_fence_done(not)) {
> > +             pr_err("Fences unsignaled\n");
> > +             goto err;
> > +     }
> > +
> > +     free_fence(fetch_and_zero(&not));
> > +     free_fence(fetch_and_zero(&timeout));
> 
> A bit of an overkill with fetch_and_zero.

'Twas forgotten leftovers.
 
> > +     dma_fence_put(dma);
> > +
> > +     return 0;
> > +
> > +err:
> > +     dma_fence_signal(dma);
> > +     if (!IS_ERR_OR_NULL(timeout))
> > +             free_fence(timeout);
> > +     if (!IS_ERR_OR_NULL(not))
> > +             free_fence(not);
> > +     dma_fence_put(dma);
> > +     return err;
> > +}
> > +
> >   int i915_sw_fence_mock_selftests(void)
> >   {
> >       static const struct i915_subtest tests[] = {
> > @@ -618,6 +754,7 @@ int i915_sw_fence_mock_selftests(void)
> >               SUBTEST(test_chain),
> >               SUBTEST(test_ipc),
> >               SUBTEST(test_timer),
> > +             SUBTEST(test_dma_fence),
> >       };
> >   
> >       return i915_subtests(tests, NULL);
> > 
> 
> Looks OK anyway.
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

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

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

* Re: [PATCH v2] drm/i915/selftests: Test i915_sw_fence/dma_fence interop
  2018-01-16  9:48   ` Tvrtko Ursulin
  2018-01-16 10:05     ` Chris Wilson
@ 2018-01-16 10:50     ` Chris Wilson
  1 sibling, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2018-01-16 10:50 UTC (permalink / raw)
  To: Tvrtko Ursulin, intel-gfx

Quoting Tvrtko Ursulin (2018-01-16 09:48:48)
> 
> On 15/01/2018 20:43, Chris Wilson wrote:
> > Check that we can successfully wait upon a dma_fence using the
> > i915_sw_fence, including the optional timeout mechanism.
> > 
> > v2: Account for the rounding up of the timeout to the next second.
> > Unfortunately, the minimum delay is then 1 second.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> Looks OK anyway.
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Fixed up the overkill, and pushed. Thanks for the suggestion and
reviewing, (Also included the comment rewrite in the push as a bonus.)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-01-16 10:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 16:00 [PATCH] drm/i915/selftests: Test i915_sw_fence/dma_fence interop Chris Wilson
2018-01-15 16:45 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-01-15 19:31 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-01-15 20:25   ` Chris Wilson
2018-01-15 20:43 ` [PATCH v2] " Chris Wilson
2018-01-16  9:48   ` Tvrtko Ursulin
2018-01-16 10:05     ` Chris Wilson
2018-01-16 10:50     ` Chris Wilson
2018-01-15 21:05 ` ✓ Fi.CI.BAT: success for drm/i915/selftests: Test i915_sw_fence/dma_fence interop (rev2) Patchwork
2018-01-15 21:50 ` ✓ Fi.CI.IGT: " 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.