public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH igt] lib: Report the error from __gem_create()
@ 2017-10-03 11:50 Chris Wilson
  2017-10-03 12:28 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-03 11:50 UTC (permalink / raw)
  To: intel-gfx

We have two style of ioctl wrappers. The principle interface does error
checking on behalf of the caller (to avoid having lots of repetitious
code in each test), and for the few cases where the error is important
for the test, we also expose a double underscore version. Fix up
__gem_create() to follow this pattern and report the negative error code
returned by the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 lib/ioctl_wrappers.c      | 32 +++++++++++++-------------------
 lib/ioctl_wrappers.h      |  2 +-
 tests/gem_create.c        |  5 ++---
 tests/gem_fd_exhaustion.c |  3 +--
 4 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 51b6b7b6..1b483706 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -551,22 +551,20 @@ uint32_t gem_create_stolen(int fd, uint64_t size)
 	return create.handle;
 }
 
-
-uint32_t __gem_create(int fd, int size)
+int __gem_create(int fd, int size, uint32_t *handle)
 {
-	struct drm_i915_gem_create create;
-	int ret;
-
-	memset(&create, 0, sizeof(create));
-	create.handle = 0;
-	create.size = size;
-	ret = igt_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
+	struct drm_i915_gem_create create = {
+		.size = size,
+	};
+	int err = 0;
 
-	if (ret < 0)
-		return 0;
+	if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0)
+		*handle = create.handle;
+	else
+		err = -errno;
 
 	errno = 0;
-	return create.handle;
+	return err;
 }
 
 /**
@@ -581,15 +579,11 @@ uint32_t __gem_create(int fd, int size)
  */
 uint32_t gem_create(int fd, uint64_t size)
 {
-	struct drm_i915_gem_create create;
+	uint32_t handle;
 
-	memset(&create, 0, sizeof(create));
-	create.handle = 0;
-	create.size = size;
-	do_ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
-	igt_assert(create.handle);
+	igt_assert_eq(__gem_create(fd, size, &handle), 0);
 
-	return create.handle;
+	return handle;
 }
 
 /**
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 090c1251..6ed65fad 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -73,7 +73,7 @@ void gem_sync(int fd, uint32_t handle);
 bool gem_create__has_stolen_support(int fd);
 uint32_t __gem_create_stolen(int fd, uint64_t size);
 uint32_t gem_create_stolen(int fd, uint64_t size);
-uint32_t __gem_create(int fd, int size);
+int __gem_create(int fd, int size, uint32_t *handle);
 uint32_t gem_create(int fd, uint64_t size);
 void gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
 int __gem_execbuf_wr(int fd, struct drm_i915_gem_execbuffer2 *execbuf);
diff --git a/tests/gem_create.c b/tests/gem_create.c
index de7b8209..25c5e808 100644
--- a/tests/gem_create.c
+++ b/tests/gem_create.c
@@ -95,10 +95,9 @@ static void invalid_flag_test(int fd)
 
 static void invalid_size_test(int fd)
 {
-	int handle;
+	uint32_t handle;
 
-	handle = __gem_create(fd, 0);
-	igt_assert(!handle);
+	igt_assert_eq(__gem_create(fd, 0, &handle), -EINVAL);
 }
 
 /*
diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index 57f2c711..250fe850 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -78,8 +78,7 @@ igt_simple_main
 			if (tmp_fd >= 0 && i < FD_ARR_SZ)
 				fd_arr[i] = tmp_fd;
 
-			handle = __gem_create(fd, 4096);
-			if (handle)
+			if (__gem_create(fd, 4096, &handle) == 0)
 				gem_close(fd, handle);
 
 
-- 
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 lib: Report the error from __gem_create()
  2017-10-03 11:50 [PATCH igt] lib: Report the error from __gem_create() Chris Wilson
@ 2017-10-03 12:28 ` Patchwork
  2017-10-03 12:37 ` [PATCH igt] " Joonas Lahtinen
  2017-10-03 13:47 ` ✗ Fi.CI.IGT: failure for " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-03 12:28 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: lib: Report the error from __gem_create()
URL   : https://patchwork.freedesktop.org/series/31317/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
08a2f887b26c89cfb1e1b5715a23d561b75e0dab lib: Reduce dependency on glib

with latest DRM-Tip kernel build CI_DRM_3166
79f82050a245 drm-tip: 2017y-10m-03d-11h-31m-30s UTC integration manifest

No testlist changes.

Test gem_exec_suspend:
        Subgroup basic-s3:
                dmesg-warn -> PASS       (fi-cfl-s) fdo#103026

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

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:463s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:477s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:391s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:579s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:290s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:544s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:539s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:551s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:541s
fi-cfl-s         total:289  pass:257  dwarn:0   dfail:0   fail:0   skip:32  time:572s
fi-cnl-y         total:289  pass:261  dwarn:1   dfail:0   fail:0   skip:27  time:640s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:439s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:600s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:441s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:423s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:464s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:502s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:478s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:510s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:580s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:493s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:591s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:660s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:539s
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:479s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:585s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:436s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_287/
_______________________________________________
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] lib: Report the error from __gem_create()
  2017-10-03 11:50 [PATCH igt] lib: Report the error from __gem_create() Chris Wilson
  2017-10-03 12:28 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-03 12:37 ` Joonas Lahtinen
  2017-10-03 13:47 ` ✗ Fi.CI.IGT: failure for " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Joonas Lahtinen @ 2017-10-03 12:37 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Tue, 2017-10-03 at 12:50 +0100, Chris Wilson wrote:
> We have two style of ioctl wrappers. The principle interface does error
> checking on behalf of the caller (to avoid having lots of repetitious
> code in each test), and for the few cases where the error is important
> for the test, we also expose a double underscore version. Fix up
> __gem_create() to follow this pattern and report the negative error code
> returned by the kernel.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Oh, there were that few users...

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
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: failure for lib: Report the error from __gem_create()
  2017-10-03 11:50 [PATCH igt] lib: Report the error from __gem_create() Chris Wilson
  2017-10-03 12:28 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-10-03 12:37 ` [PATCH igt] " Joonas Lahtinen
@ 2017-10-03 13:47 ` Patchwork
  2017-10-03 13:52   ` Chris Wilson
  2 siblings, 1 reply; 5+ messages in thread
From: Patchwork @ 2017-10-03 13:47 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: lib: Report the error from __gem_create()
URL   : https://patchwork.freedesktop.org/series/31317/
State : failure

== Summary ==

Test gem_pwrite:
        Subgroup big-gtt-backwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-gtt-forwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-cpu-forwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-gtt-random:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-gtt-forwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-cpu-backwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-cpu-random:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-gtt-backwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-cpu-fbr:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-cpu-forwards:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-cpu-random:
                pass       -> FAIL       (shard-hsw)
        Subgroup huge-gtt-fbr:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-cpu-fbr:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-gtt-fbr:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-gtt-random:
                pass       -> FAIL       (shard-hsw)
        Subgroup big-cpu-backwards:
                pass       -> FAIL       (shard-hsw)
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_vblank:
        Subgroup accuracy-idle:
                pass       -> FAIL       (shard-hsw) fdo#102583
Test kms_flip:
        Subgroup plain-flip-ts-check-interruptible:
                fail       -> PASS       (shard-hsw)
Test prime_self_import:
        Subgroup export-vs-gem_close-race:
                pass       -> FAIL       (shard-hsw)
Test gem_eio:
        Subgroup execbuf:
                dmesg-warn -> PASS       (shard-hsw) fdo#102886

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#102886 https://bugs.freedesktop.org/show_bug.cgi?id=102886

shard-hsw        total:2429 pass:1315 dwarn:6   dfail:0   fail:25  skip:1083 time:10012s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_287/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: ✗ Fi.CI.IGT: failure for lib: Report the error from __gem_create()
  2017-10-03 13:47 ` ✗ Fi.CI.IGT: failure for " Patchwork
@ 2017-10-03 13:52   ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-03 13:52 UTC (permalink / raw)
  To: Patchwork; +Cc: intel-gfx

Quoting Patchwork (2017-10-03 14:47:30)
> == Series Details ==
> 
> Series: lib: Report the error from __gem_create()
> URL   : https://patchwork.freedesktop.org/series/31317/
> State : failure
> 
> == Summary ==
> 
> Test gem_pwrite:
>         Subgroup big-gtt-backwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-gtt-forwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-cpu-forwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-gtt-random:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-gtt-forwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-cpu-backwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-cpu-random:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-gtt-backwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-cpu-fbr:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-cpu-forwards:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-cpu-random:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup huge-gtt-fbr:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-cpu-fbr:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-gtt-fbr:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-gtt-random:
>                 pass       -> FAIL       (shard-hsw)
>         Subgroup big-cpu-backwards:
>                 pass       -> FAIL       (shard-hsw)

D'oh, I actually thought it wasn't going to run because of the earlier
warning. Pre-existing bug in __gem_create() that I didn't spot.

diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 1b483706..87511fc6 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -551,7 +551,7 @@ uint32_t gem_create_stolen(int fd, uint64_t size)
        return create.handle;
	 }
	  
	  -int __gem_create(int fd, int size, uint32_t *handle)
	  +int __gem_create(int fd, uint64_t size, uint32_t *handle)
	   {
	           struct drm_i915_gem_create create = {
			   .size = size,
_______________________________________________
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

end of thread, other threads:[~2017-10-03 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03 11:50 [PATCH igt] lib: Report the error from __gem_create() Chris Wilson
2017-10-03 12:28 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-03 12:37 ` [PATCH igt] " Joonas Lahtinen
2017-10-03 13:47 ` ✗ Fi.CI.IGT: failure for " Patchwork
2017-10-03 13:52   ` Chris Wilson

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