[PATCH i-g-t 2/7] tests/i915/gem_exec_capture: Reduce run-time and avoid OOM

Thomas Hellström thomas.hellstrom at linux.intel.com
Tue Oct 19 06:39:04 UTC 2021


From: Thomas Hellström <thomas.hellstrom at intel.com>

Reduce run-time to something sensible by putting an upper limit on the
amount of memory used for capture buffers.
Also remove the many-256M-incremental subtest since it takes around
40 minutes to run and typically ends in an OOM condition.

Signed-off-by: Thomas Hellström <thomas.hellstrom at intel.com>
---
 tests/i915/gem_exec_capture.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index d5f16d93..705d1875 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -33,6 +33,12 @@
 
 IGT_TEST_DESCRIPTION("Check that we capture the user specified objects on a hang");
 
+/*
+ * Limit on max memory used for capture buffers. This is to avoid
+ * excessive run-time in the "many" test only.
+ */
+#define MAX_MEMORY_USED ((512 << 20) / 4)
+
 static void check_error_state(int dir, struct drm_i915_gem_exec_object2 *obj)
 {
 	char *error, *str;
@@ -448,7 +454,7 @@ static void many(int fd, int dir, const intel_ctx_t *ctx, uint64_t size,
 		 unsigned int flags)
 {
 	uint64_t ram, gtt, ahnd;
-	unsigned long count, blobs;
+	unsigned long count, blobs, lcount;
 	struct offset *offsets;
 	char *error, *str;
 
@@ -459,6 +465,9 @@ static void many(int fd, int dir, const intel_ctx_t *ctx, uint64_t size,
 
 	count = min(gtt, ram) / 4;
 	igt_require(count > 1);
+	lcount = MAX_MEMORY_USED / size;
+	if (lcount > 1)
+		count = min(count, lcount);
 
 	intel_require_memory(count, size, CHECK_RAM);
 	ahnd = get_reloc_ahnd(fd, ctx->id);
@@ -708,11 +717,6 @@ igt_main
 		many(fd, dir, ctx, 2<<20, INCREMENTAL);
 	}
 
-	igt_subtest_f("many-256M-incremental") {
-		igt_require(gem_can_store_dword(fd, 0));
-		many(fd, dir, ctx, 256<<20, INCREMENTAL);
-	}
-
 	/* And check we can read from different types of objects */
 
 	igt_subtest_f("userptr") {
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list