All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Argenziano <antonio.argenziano@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] igt/gem_measure_ring_size_inflight: Measure smallest inflight ring size
Date: Mon, 26 Feb 2018 14:41:27 -0800	[thread overview]
Message-ID: <20180226224127.36610-1-antonio.argenziano@intel.com> (raw)

Some tests measure the render's ring size but are actually meant to
measure the smallest across all engines. This patch adds measuring the
smallest size in gem_measure_ring_size_inflight() given the appropriate
parameter.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/i915/gem_ring.c      | 51 ++++++++++++++++++++++++++++++++++--------------
 lib/i915/gem_ring.h      |  3 +++
 tests/gem_busy.c         |  2 +-
 tests/gem_exec_await.c   |  2 +-
 tests/gem_exec_fence.c   |  2 +-
 tests/gem_exec_latency.c |  2 +-
 tests/gem_ringfill.c     |  2 +-
 7 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index 7326673a..df379f1a 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -30,27 +30,14 @@
 #include "drmtest.h"
 #include "ioctl_wrappers.h"
 #include "igt_dummyload.h"
+#include "igt_gt.h"
 
 static void alarm_handler(int sig)
 {
 }
 
-/**
- * gem_measure_ring_inflight:
- * @fd: open i915 drm file descriptor
- * @engine: execbuf engine flag
- * @flags: flags to affect measurement:
- *		- MEASURE_RING_NEW_CTX: use a new context to account for the space
- *		  used by the lrc init.
- *
- * This function calculates the maximum number of batches that can be inserted
- * at the same time in the ring on the selected engine.
- *
- * Returns:
- * Number of batches that fit in the ring
- */
 unsigned int
-gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags)
+__gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags)
 {
 	struct sigaction old_sa, sa = { .sa_handler = alarm_handler };
 	struct drm_i915_gem_exec_object2 obj[2];
@@ -115,3 +102,37 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f
 
 	return count;
 }
+
+/**
+ * gem_measure_ring_inflight:
+ * @fd: open i915 drm file descriptor
+ * @engine: execbuf engine flag. Use '~0u' to get the minimum size across
+ *		    all physical engines.
+ * @flags: flags to affect measurement:
+ *		- MEASURE_RING_NEW_CTX: use a new context to account for the space
+ *		  used by the lrc init.
+ *
+ * This function calculates the maximum number of batches that can be inserted
+ * at the same time in the ring on the selected engine.
+ *
+ * Returns:
+ * Number of batches that fit in the ring
+ */
+unsigned int
+gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags)
+{
+	if (engine == ~0u) { /* Find minimum ring size across all engines */
+		unsigned int global_min = ~0u;
+
+		for_each_physical_engine(fd, engine) {
+			unsigned int engine_min = __gem_measure_ring_inflight(fd, engine, flags);
+
+			if (engine_min < global_min)
+				global_min = engine_min;
+		}
+
+		return global_min;
+	}
+
+	return __gem_measure_ring_inflight(fd, engine, flags);
+}
diff --git a/lib/i915/gem_ring.h b/lib/i915/gem_ring.h
index c69adce0..9fbce59e 100644
--- a/lib/i915/gem_ring.h
+++ b/lib/i915/gem_ring.h
@@ -30,6 +30,9 @@ enum measure_ring_flags {
 	MEASURE_RING_NEW_CTX = 1
 };
 
+unsigned int
+__gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags);
+
 unsigned int
 gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags);
 
diff --git a/tests/gem_busy.c b/tests/gem_busy.c
index fcff51a2..0460877e 100644
--- a/tests/gem_busy.c
+++ b/tests/gem_busy.c
@@ -301,7 +301,7 @@ static void xchg_u32(void *array, unsigned i, unsigned j)
 static void close_race(int fd)
 {
 	const unsigned int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
-	const unsigned int nhandles = gem_measure_ring_inflight(fd, 0, 0) / 2;
+	const unsigned int nhandles = gem_measure_ring_inflight(fd, ~0u, 0) / 2;
 	unsigned int engines[16], nengine;
 	unsigned long *control;
 	uint32_t *handles;
diff --git a/tests/gem_exec_await.c b/tests/gem_exec_await.c
index 2ff180b0..255e0400 100644
--- a/tests/gem_exec_await.c
+++ b/tests/gem_exec_await.c
@@ -234,7 +234,7 @@ igt_main
 		igt_require_gem(device);
 		gem_submission_print_method(device);
 
-		ring_size = gem_measure_ring_inflight(device, 0, 0) - 10;
+		ring_size = gem_measure_ring_inflight(device, ~0u, 0) - 10;
 		if (!gem_has_execlists(device))
 			ring_size /= 2;
 		igt_info("Ring size: %d batches\n", ring_size);
diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
index 93ed3b9b..45c9eb83 100644
--- a/tests/gem_exec_fence.c
+++ b/tests/gem_exec_fence.c
@@ -1537,7 +1537,7 @@ igt_main
 		long ring_size = 0;
 
 		igt_fixture {
-			ring_size = gem_measure_ring_inflight(i915, 0, 0) - 1;
+			ring_size = gem_measure_ring_inflight(i915, ~0u, 0) - 1;
 			igt_info("Ring size: %ld batches\n", ring_size);
 			igt_require(ring_size);
 
diff --git a/tests/gem_exec_latency.c b/tests/gem_exec_latency.c
index f0e13419..e6bbeb9e 100644
--- a/tests/gem_exec_latency.c
+++ b/tests/gem_exec_latency.c
@@ -363,7 +363,7 @@ igt_main
 
 		gem_submission_print_method(device);
 
-		ring_size = gem_measure_ring_inflight(device, 0, 0);
+		ring_size = gem_measure_ring_inflight(device, ~0u, 0);
 		igt_info("Ring size: %d batches\n", ring_size);
 		igt_require(ring_size > 8);
 		ring_size -= 8; /* leave some spare */
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index eea1d403..cd9ae6c8 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -272,7 +272,7 @@ igt_main
 			master = true;
 		}
 
-		ring_size = gem_measure_ring_inflight(fd, 0, 0);
+		ring_size = gem_measure_ring_inflight(fd, ~0u, 0);
 		igt_info("Ring size: %d batches\n", ring_size);
 		igt_require(ring_size);
 	}
-- 
2.14.2

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

             reply	other threads:[~2018-02-26 22:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 22:41 Antonio Argenziano [this message]
2018-02-26 22:56 ` [igt-dev] [PATCH i-g-t] igt/gem_measure_ring_size_inflight: Measure smallest inflight ring size Chris Wilson
2018-02-27 18:07   ` Antonio Argenziano
2018-02-26 23:07 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-02-27  1:45 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-02-28 23:21 ` [igt-dev] [PATCH i-g-t v2] " Antonio Argenziano
2018-03-01  7:56   ` Chris Wilson
2018-03-06 21:51     ` Antonio Argenziano
2018-02-28 23:48 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/gem_measure_ring_size_inflight: Measure smallest inflight ring size (rev2) Patchwork
2018-03-01  4:36 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180226224127.36610-1-antonio.argenziano@intel.com \
    --to=antonio.argenziano@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.