All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] syncobj: add test for handle->fd + close twice.
@ 2017-12-21  2:59 Dave Airlie
  2017-12-21  8:33 ` Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dave Airlie @ 2017-12-21  2:59 UTC (permalink / raw)
  To: intel-gfx

From: Dave Airlie <airlied@redhat.com>

This demos a bug found in the vulkan CTS that causes
VFS: Close: file count is 0
in dmesg, and ls /proc/self/fd to oops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 tests/syncobj_basic.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index acc4a641..42fc99f8 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -177,6 +177,22 @@ test_valid_cycle(int fd)
 	syncobj_destroy(fd, second_handle);
 }
 
+static void
+test_create_close_twice(int fd)
+{
+	uint32_t handle;
+	int syncobj_fd;
+
+	handle = syncobj_create(fd, 0);
+	syncobj_fd = syncobj_handle_to_fd(fd, handle, 0);
+	close(syncobj_fd);
+
+	syncobj_fd = syncobj_handle_to_fd(fd, handle, 0);
+	close(syncobj_fd);
+
+	syncobj_destroy(fd, handle);
+}
+
 static bool has_syncobj(int fd)
 {
 	uint64_t value;
@@ -231,4 +247,7 @@ igt_main
 	igt_subtest("test-valid-cycle")
 		test_valid_cycle(fd);
 
+	igt_subtest("test-create-close-twice")
+		test_create_close_twice(fd);
+
 }
-- 
2.14.3

_______________________________________________
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

* Re: [PATCH i-g-t] syncobj: add test for handle->fd + close twice.
  2017-12-21  2:59 [PATCH i-g-t] syncobj: add test for handle->fd + close twice Dave Airlie
@ 2017-12-21  8:33 ` Chris Wilson
  2017-12-21  9:04 ` [PATCH igt] igt/syncobj: Stress handle->fd/close Chris Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-12-21  8:33 UTC (permalink / raw)
  To: Dave Airlie, intel-gfx

Quoting Dave Airlie (2017-12-21 02:59:37)
> From: Dave Airlie <airlied@redhat.com>
> 
> This demos a bug found in the vulkan CTS that causes
> VFS: Close: file count is 0
> in dmesg, and ls /proc/self/fd to oops.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Aye catches the issue you found.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-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

* [PATCH igt] igt/syncobj: Stress handle->fd/close
  2017-12-21  2:59 [PATCH i-g-t] syncobj: add test for handle->fd + close twice Dave Airlie
  2017-12-21  8:33 ` Chris Wilson
@ 2017-12-21  9:04 ` Chris Wilson
  2017-12-21 10:54 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-12-21 13:11 ` ✗ Fi.CI.IGT: failure " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-12-21  9:04 UTC (permalink / raw)
  To: intel-gfx; +Cc: Dave Airlie

Dave found a bug where creating and closing an fd twice from the syncobj
would lead to a crash. In addition to explicitly testing for a previous
bug, include a stress test that covers a few more permutations of the
create/close pattern to see if can uncover a race in future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
---
 tests/syncobj_basic.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index acc4a6418..0a155a3e2 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -177,6 +177,43 @@ test_valid_cycle(int fd)
 	syncobj_destroy(fd, second_handle);
 }
 
+static void
+stress_close_race(int fd, int timeout_ms)
+{
+	const unsigned int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
+	uint32_t handle;
+	int *done;
+
+	handle = syncobj_create(fd, 0);
+	done = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+
+	igt_fork(child, 2*ncpus + 1) {
+		const unsigned int sz = 5*child + 1;
+		int syncobj[sz];
+
+		for (unsigned int i = 0; i < sz; i++)
+			syncobj[i] = syncobj_handle_to_fd(fd, handle, 0);
+
+		do {
+			igt_permute_array(syncobj, sz, igt_exchange_int);
+			for (unsigned int i = 0; i < sz; i++) {
+				close(syncobj[i]);
+				syncobj[i] =
+					syncobj_handle_to_fd(fd, handle, 0);
+			}
+		} while (!*done);
+
+		for (unsigned int i = 0; i < sz; i++)
+			close(syncobj[i]);
+	}
+	usleep(timeout_ms * 1000);
+	*done = 1;
+	igt_waitchildren();
+
+	munmap(done, 4096);
+	syncobj_destroy(fd, handle);
+}
+
 static bool has_syncobj(int fd)
 {
 	uint64_t value;
@@ -231,4 +268,6 @@ igt_main
 	igt_subtest("test-valid-cycle")
 		test_valid_cycle(fd);
 
+	igt_subtest("stress-close-race")
+		stress_close_race(fd, 1000);
 }
-- 
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] 5+ messages in thread

* ✓ Fi.CI.BAT: success for igt/syncobj: Stress handle->fd/close
  2017-12-21  2:59 [PATCH i-g-t] syncobj: add test for handle->fd + close twice Dave Airlie
  2017-12-21  8:33 ` Chris Wilson
  2017-12-21  9:04 ` [PATCH igt] igt/syncobj: Stress handle->fd/close Chris Wilson
@ 2017-12-21 10:54 ` Patchwork
  2017-12-21 13:11 ` ✗ Fi.CI.IGT: failure " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-12-21 10:54 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: igt/syncobj: Stress handle->fd/close
URL   : https://patchwork.freedesktop.org/series/35653/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
beb26d89ff5c5621c1e6b6ac2a45439507af86b7 meson: Install .testlist files and README from tests/intel-ci

with latest DRM-Tip kernel build CI_DRM_3563
c21bf92fbe84 drm-tip: 2017y-12m-21d-09h-56m-40s UTC integration manifest

Testlist changes:
+igt@syncobj_basic@stress-close-race

Test gem_exec_suspend:
        Subgroup basic-s3:
                dmesg-warn -> PASS       (fi-elk-e7500) fdo#103989
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#101144

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

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:441s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:442s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:389s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:497s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:276s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:498s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:498s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:485s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:472s
fi-elk-e7500     total:224  pass:164  dwarn:14  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:267s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:528s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:406s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:413s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:426s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:481s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:427s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:486s
fi-kbl-7560u     total:288  pass:268  dwarn:1   dfail:0   fail:0   skip:19  time:522s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:460s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:541s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:584s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:537s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:557s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:508s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:513s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:444s
fi-snb-2520m     total:245  pass:211  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:413s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:595s
fi-cnl-y         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:619s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_717/issues.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

* ✗ Fi.CI.IGT: failure for igt/syncobj: Stress handle->fd/close
  2017-12-21  2:59 [PATCH i-g-t] syncobj: add test for handle->fd + close twice Dave Airlie
                   ` (2 preceding siblings ...)
  2017-12-21 10:54 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-12-21 13:11 ` Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-12-21 13:11 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: igt/syncobj: Stress handle->fd/close
URL   : https://patchwork.freedesktop.org/series/35653/
State : failure

== Summary ==

Test gem_eio:
        Subgroup in-flight-contexts:
                dmesg-warn -> PASS       (shard-snb) fdo#104058
Test kms_flip:
        Subgroup vblank-vs-suspend:
                incomplete -> PASS       (shard-snb) fdo#103375
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                fail       -> PASS       (shard-snb) fdo#101623
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb) fdo#104218 +1
Test prime_self_import:
        Subgroup basic-with_fd_dup:
                pass       -> INCOMPLETE (shard-hsw)
Test kms_cursor_legacy:
        Subgroup cursor-vs-flip-atomic-transitions-varying-size:
                skip       -> PASS       (shard-hsw) fdo#103172
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912

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

shard-hsw        total:2590 pass:1465 dwarn:2   dfail:0   fail:9   skip:1112 time:8944s
shard-snb        total:2663 pass:1283 dwarn:1   dfail:0   fail:10  skip:1368 time:7886s
Blacklisted hosts:
shard-apl        total:2641 pass:1630 dwarn:1   dfail:0   fail:22  skip:986 time:13054s
shard-kbl        total:2663 pass:1771 dwarn:1   dfail:0   fail:24  skip:866 time:10833s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_717/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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21  2:59 [PATCH i-g-t] syncobj: add test for handle->fd + close twice Dave Airlie
2017-12-21  8:33 ` Chris Wilson
2017-12-21  9:04 ` [PATCH igt] igt/syncobj: Stress handle->fd/close Chris Wilson
2017-12-21 10:54 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-12-21 13:11 ` ✗ Fi.CI.IGT: failure " 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.