[igt-dev] [PATCH i-g-t] i915/i915_suspend: run in subprocess to catch oom

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Feb 17 15:12:41 UTC 2023


Shrink subtest can end up with oom killing it. Create subprocess
and run it from there so it will at least get reported like:

dynamic child 0 pid:70254 died with signal 9, Killed
Subtest shrink: FAIL (23.906s)

dmesg reports:

[103335.337309] Out of memory: Killed process 70254 (i915_suspend)

Cc: Riana Tauro <riana.tauro at intel.com>
Cc: Anshuman Gupta <anshuman.gupta at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/i915_suspend.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index 815f1c8a..9798ba5c 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -176,15 +176,22 @@ test_shrink(int fd, unsigned int mode)
 	void *mem;
 
 	gem_quiescent_gpu(fd);
-	igt_purge_vm_caches(fd);
 
-	mem = igt_get_total_pinnable_mem(&size);
-	igt_assert(mem != MAP_FAILED);
+	igt_multi_fork(child, 1) {
+		fd = gem_reopen_driver(fd);
+		igt_purge_vm_caches(fd);
 
-	igt_purge_vm_caches(fd);
-	igt_system_suspend_autoresume(mode, SUSPEND_TEST_NONE);
+		mem = igt_get_total_pinnable_mem(&size);
+		igt_assert(mem != MAP_FAILED);
 
-	munmap(mem, size);
+		igt_purge_vm_caches(fd);
+		igt_system_suspend_autoresume(mode, SUSPEND_TEST_NONE);
+
+		munmap(mem, size);
+		close(fd);
+	}
+
+	igt_waitchildren();
 }
 
 static void
-- 
2.37.2



More information about the igt-dev mailing list