public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915: Use O_NONBLOCK for faster ringsize probing
@ 2019-10-11  8:06 Chris Wilson
  2019-10-11  8:25 ` [igt-dev] [Intel-gfx] " Tvrtko Ursulin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2019-10-11  8:06 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

When the kernel supports O_NONBLOCK reporting of a full execbuf queue,
take advantage of that to immediately report when the output would block
due to the ring being full.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/i915/gem_ring.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index 9f099edff..5ca2a728b 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -21,6 +21,7 @@
  * IN THE SOFTWARE.
  */
 
+#include <fcntl.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
@@ -89,11 +90,16 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
 
 	count = 0;
 	do {
-		if (__execbuf(fd, &execbuf) == 0) {
+		int err = __execbuf(fd, &execbuf);
+
+		if (err == 0) {
 			count++;
 			continue;
 		}
 
+		if (err == -EWOULDBLOCK)
+			break;
+
 		if (last[1] == count)
 			break;
 
@@ -102,8 +108,6 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
 		last[1] = last[0];
 		last[0] = count;
 	} while (1);
-
-	igt_assert_eq(__execbuf(fd, &execbuf), -EINTR);
 	igt_assert(count > 2);
 
 	memset(&itv, 0, sizeof(itv));
@@ -145,6 +149,9 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f
 
 	fd = gem_reopen_driver(fd);
 
+	/* When available, disable execbuf throttling */
+	fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_NONBLOCK);
+
 	if (engine == ALL_ENGINES) {
 		for_each_physical_engine(fd, engine) {
 			unsigned int count =
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-10-11 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-11  8:06 [igt-dev] [PATCH i-g-t] i915: Use O_NONBLOCK for faster ringsize probing Chris Wilson
2019-10-11  8:25 ` [igt-dev] [Intel-gfx] " Tvrtko Ursulin
2019-10-11  8:50 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-10-11 15:51 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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