public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait
@ 2017-10-06 19:01 Chris Wilson
  2017-10-06 19:24 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-06 19:01 UTC (permalink / raw)
  To: intel-gfx

v2: Hook the syncobj array to the execbuf!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_busy.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c
index f050454b..ce631d56 100644
--- a/benchmarks/gem_busy.c
+++ b/benchmarks/gem_busy.c
@@ -58,6 +58,15 @@
 #define DMABUF 0x4
 #define WAIT 0x8
 #define SYNC 0x10
+#define SYNCOBJ 0x20
+
+#define LOCAL_I915_EXEC_FENCE_ARRAY (1 << 19)
+struct local_gem_exec_fence {
+	uint32_t handle;
+	uint32_t flags;
+#define LOCAL_EXEC_FENCE_WAIT (1 << 0)
+#define LOCAL_EXEC_FENCE_SIGNAL (1 << 1)
+};
 
 static void gem_busy(int fd, uint32_t handle)
 {
@@ -109,11 +118,54 @@ static int sync_merge(int fd1, int fd2)
 	return data.fence;
 }
 
+static uint32_t __syncobj_create(int fd)
+{
+	struct local_syncobj_create {
+		uint32_t handle, flags;
+	} arg;
+#define LOCAL_IOCTL_SYNCOBJ_CREATE        DRM_IOWR(0xBF, struct local_syncobj_create)
+
+	memset(&arg, 0, sizeof(arg));
+	ioctl(fd, LOCAL_IOCTL_SYNCOBJ_CREATE, &arg);
+
+	return arg.handle;
+}
+
+static uint32_t syncobj_create(int fd)
+{
+	uint32_t ret;
+
+	igt_assert_neq((ret = __syncobj_create(fd)), 0);
+
+	return ret;
+}
+
+#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
+#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
+struct local_syncobj_wait {
+       __u64 handles;
+       /* absolute timeout */
+       __s64 timeout_nsec;
+       __u32 count_handles;
+       __u32 flags;
+       __u32 first_signaled; /* only valid when not waiting all */
+       __u32 pad;
+};
+#define LOCAL_IOCTL_SYNCOBJ_WAIT	DRM_IOWR(0xC3, struct local_syncobj_wait)
+static int __syncobj_wait(int fd, struct local_syncobj_wait *args)
+{
+	int err = 0;
+	if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_WAIT, args))
+		err = -errno;
+	return err;
+}
+
 static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
 	struct drm_i915_gem_exec_object2 obj[2];
 	struct drm_i915_gem_relocation_entry reloc[2];
+	struct local_gem_exec_fence syncobj;
 	unsigned engines[16];
 	unsigned nengine;
 	uint32_t *batch;
@@ -150,6 +202,15 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
 			return 77;
 	}
 
+	if (flags & SYNCOBJ) {
+		syncobj.handle = syncobj_create(fd);
+		syncobj.flags = LOCAL_EXEC_FENCE_SIGNAL;
+
+		execbuf.cliprects_ptr = (uintptr_t)&syncobj;
+		execbuf.num_cliprects = 1;
+		execbuf.flags |= LOCAL_I915_EXEC_FENCE_ARRAY;
+	}
+
 	if (ring == -1) {
 		nengine = 0;
 		for (ring = 1; ring < 16; ring++) {
@@ -235,6 +296,14 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
 					struct pollfd pfd = { .fd = dmabuf, .events = POLLOUT };
 					for (int inner = 0; inner < 1024; inner++)
 						poll(&pfd, 1, 0);
+				} else if (flags & SYNCOBJ) {
+					struct local_syncobj_wait arg = {
+						.handles = to_user_pointer(&syncobj.handle),
+						.count_handles = 1,
+					};
+
+					for (int inner = 0; inner < 1024; inner++)
+						__syncobj_wait(fd, &arg);
 				} else if (flags & SYNC) {
 					struct pollfd pfd = { .fd = fence, .events = POLLOUT };
 					for (int inner = 0; inner < 1024; inner++)
@@ -275,7 +344,7 @@ int main(int argc, char **argv)
 	int ncpus = 1;
 	int c;
 
-	while ((c = getopt (argc, argv, "e:r:dfswWI")) != -1) {
+	while ((c = getopt (argc, argv, "e:r:dfsSwWI")) != -1) {
 		switch (c) {
 		case 'e':
 			if (strcmp(optarg, "rcs") == 0)
@@ -314,6 +383,10 @@ int main(int argc, char **argv)
 			flags |= SYNC;
 			break;
 
+		case 'S':
+			flags |= SYNCOBJ;
+			break;
+
 		case 'W':
 			flags |= WRITE;
 			break;
-- 
2.14.2

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

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

* ✓ Fi.CI.BAT: success for benchmark/gem_busy: Compare polling with syncobj_wait
  2017-10-06 19:01 [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait Chris Wilson
@ 2017-10-06 19:24 ` Patchwork
  2017-10-07  4:36 ` ✗ Fi.CI.IGT: warning " Patchwork
  2017-10-12  9:53 ` [PATCH igt] " Tvrtko Ursulin
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-06 19:24 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: benchmark/gem_busy: Compare polling with syncobj_wait
URL   : https://patchwork.freedesktop.org/series/31507/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
d8954f05024d73a8b3f26fa0d5892d067a70fdac igt/gem_exec_scheduler: Add small priority sorting smoketest

with latest DRM-Tip kernel build CI_DRM_3188
aaf31e875e72 drm-tip: 2017y-10m-06d-17h-24m-22s UTC integration manifest

No testlist changes.

Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-byt-j1900) fdo#101705

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

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:458s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:477s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:394s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:566s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:288s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:531s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:532s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:546s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:523s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:563s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:647s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:441s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:608s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:419s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:476s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:505s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:591s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:488s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:599s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:658s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:472s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:664s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:540s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:524s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:483s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:587s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:441s

== Logs ==

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

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

* ✗ Fi.CI.IGT: warning for benchmark/gem_busy: Compare polling with syncobj_wait
  2017-10-06 19:01 [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait Chris Wilson
  2017-10-06 19:24 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-07  4:36 ` Patchwork
  2017-10-12  9:53 ` [PATCH igt] " Tvrtko Ursulin
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-07  4:36 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: benchmark/gem_busy: Compare polling with syncobj_wait
URL   : https://patchwork.freedesktop.org/series/31507/
State : warning

== Summary ==

Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test gem_eio:
        Subgroup in-flight-external:
                pass       -> DMESG-WARN (shard-hsw) fdo#102886 +1
Test kms_cursor_legacy:
        Subgroup cursorA-vs-flipA-atomic-transitions:
                fail       -> PASS       (shard-hsw) fdo#102723
Test gem_render_tiled_blits:
        Subgroup basic:
                pass       -> DMESG-WARN (shard-hsw)

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886
fdo#102723 https://bugs.freedesktop.org/show_bug.cgi?id=102723

shard-hsw        total:2446 pass:1327 dwarn:7   dfail:0   fail:9   skip:1103 time:10028s

== Logs ==

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

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

* Re: [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait
  2017-10-06 19:01 [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait Chris Wilson
  2017-10-06 19:24 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-10-07  4:36 ` ✗ Fi.CI.IGT: warning " Patchwork
@ 2017-10-12  9:53 ` Tvrtko Ursulin
  2017-10-12 11:34   ` Chris Wilson
  2 siblings, 1 reply; 5+ messages in thread
From: Tvrtko Ursulin @ 2017-10-12  9:53 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 06/10/2017 20:01, Chris Wilson wrote:
> v2: Hook the syncobj array to the execbuf!
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   benchmarks/gem_busy.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 74 insertions(+), 1 deletion(-)
> 
> diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c
> index f050454b..ce631d56 100644
> --- a/benchmarks/gem_busy.c
> +++ b/benchmarks/gem_busy.c
> @@ -58,6 +58,15 @@
>   #define DMABUF 0x4
>   #define WAIT 0x8
>   #define SYNC 0x10
> +#define SYNCOBJ 0x20
> +
> +#define LOCAL_I915_EXEC_FENCE_ARRAY (1 << 19)
> +struct local_gem_exec_fence {
> +	uint32_t handle;
> +	uint32_t flags;
> +#define LOCAL_EXEC_FENCE_WAIT (1 << 0)
> +#define LOCAL_EXEC_FENCE_SIGNAL (1 << 1)
> +};
>   
>   static void gem_busy(int fd, uint32_t handle)
>   {
> @@ -109,11 +118,54 @@ static int sync_merge(int fd1, int fd2)
>   	return data.fence;
>   }
>   
> +static uint32_t __syncobj_create(int fd)
> +{
> +	struct local_syncobj_create {
> +		uint32_t handle, flags;
> +	} arg;
> +#define LOCAL_IOCTL_SYNCOBJ_CREATE        DRM_IOWR(0xBF, struct local_syncobj_create)
> +
> +	memset(&arg, 0, sizeof(arg));
> +	ioctl(fd, LOCAL_IOCTL_SYNCOBJ_CREATE, &arg);
> +
> +	return arg.handle;
> +}
> +
> +static uint32_t syncobj_create(int fd)
> +{
> +	uint32_t ret;
> +
> +	igt_assert_neq((ret = __syncobj_create(fd)), 0);
> +
> +	return ret;
> +}
> +
> +#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
> +#define LOCAL_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
> +struct local_syncobj_wait {
> +       __u64 handles;
> +       /* absolute timeout */
> +       __s64 timeout_nsec;
> +       __u32 count_handles;
> +       __u32 flags;
> +       __u32 first_signaled; /* only valid when not waiting all */
> +       __u32 pad;
> +};
> +#define LOCAL_IOCTL_SYNCOBJ_WAIT	DRM_IOWR(0xC3, struct local_syncobj_wait)
> +static int __syncobj_wait(int fd, struct local_syncobj_wait *args)
> +{
> +	int err = 0;
> +	if (drmIoctl(fd, LOCAL_IOCTL_SYNCOBJ_WAIT, args))
> +		err = -errno;
> +	return err;
> +}
> +
>   static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
>   {
>   	struct drm_i915_gem_execbuffer2 execbuf;
>   	struct drm_i915_gem_exec_object2 obj[2];
>   	struct drm_i915_gem_relocation_entry reloc[2];
> +	struct local_gem_exec_fence syncobj;
>   	unsigned engines[16];
>   	unsigned nengine;
>   	uint32_t *batch;
> @@ -150,6 +202,15 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
>   			return 77;
>   	}
>   
> +	if (flags & SYNCOBJ) {
> +		syncobj.handle = syncobj_create(fd);
> +		syncobj.flags = LOCAL_EXEC_FENCE_SIGNAL;
> +
> +		execbuf.cliprects_ptr = (uintptr_t)&syncobj;

to_user_pointer if you want.

> +		execbuf.num_cliprects = 1;
> +		execbuf.flags |= LOCAL_I915_EXEC_FENCE_ARRAY;
> +	}
> +
>   	if (ring == -1) {
>   		nengine = 0;
>   		for (ring = 1; ring < 16; ring++) {
> @@ -235,6 +296,14 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
>   					struct pollfd pfd = { .fd = dmabuf, .events = POLLOUT };
>   					for (int inner = 0; inner < 1024; inner++)
>   						poll(&pfd, 1, 0);
> +				} else if (flags & SYNCOBJ) {
> +					struct local_syncobj_wait arg = {
> +						.handles = to_user_pointer(&syncobj.handle),
> +						.count_handles = 1,
> +					};
> +
> +					for (int inner = 0; inner < 1024; inner++)
> +						__syncobj_wait(fd, &arg);
>   				} else if (flags & SYNC) {
>   					struct pollfd pfd = { .fd = fence, .events = POLLOUT };
>   					for (int inner = 0; inner < 1024; inner++)
> @@ -275,7 +344,7 @@ int main(int argc, char **argv)
>   	int ncpus = 1;
>   	int c;
>   
> -	while ((c = getopt (argc, argv, "e:r:dfswWI")) != -1) {
> +	while ((c = getopt (argc, argv, "e:r:dfsSwWI")) != -1) {
>   		switch (c) {
>   		case 'e':
>   			if (strcmp(optarg, "rcs") == 0)
> @@ -314,6 +383,10 @@ int main(int argc, char **argv)
>   			flags |= SYNC;
>   			break;
>   
> +		case 'S':
> +			flags |= SYNCOBJ;
> +			break;
> +
>   		case 'W':
>   			flags |= WRITE;
>   			break;
> 

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] 5+ messages in thread

* Re: [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait
  2017-10-12  9:53 ` [PATCH igt] " Tvrtko Ursulin
@ 2017-10-12 11:34   ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-12 11:34 UTC (permalink / raw)
  To: Tvrtko Ursulin, intel-gfx

Quoting Tvrtko Ursulin (2017-10-12 10:53:13)
> > @@ -150,6 +202,15 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
> >                       return 77;
> >       }
> >   
> > +     if (flags & SYNCOBJ) {
> > +             syncobj.handle = syncobj_create(fd);
> > +             syncobj.flags = LOCAL_EXEC_FENCE_SIGNAL;
> > +
> > +             execbuf.cliprects_ptr = (uintptr_t)&syncobj;
> 
> to_user_pointer if you want.

Smashed in and pushed. Thanks,
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-10-12 11:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-06 19:01 [PATCH igt] benchmark/gem_busy: Compare polling with syncobj_wait Chris Wilson
2017-10-06 19:24 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-07  4:36 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-12  9:53 ` [PATCH igt] " Tvrtko Ursulin
2017-10-12 11:34   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox