[igt-dev] [PATCH i-g-t 3/3] i915/gem_concurrent_all: fix swap subtest group

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Mar 31 16:34:30 UTC 2022


In error path in fixture add unlocking memory. In run_modes
there is already another subtest group which will guard against
igt_asserts or igt_requires, so do unpinning unconditionally
without fixture.

There are still some problems with the code, while we run swap
subtest we will race between other programs using memory so we
may still experience oom-kill during test. Second problem will be
on test machines configured with no swap turned on or with swap
size much smaller than RAM size.

The problem was discovered by Zbigniew with running
./gem_concurrent_blit --run '16M*' on machine with no swap.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/gem_concurrent_all.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/i915/gem_concurrent_all.c b/tests/i915/gem_concurrent_all.c
index 22c5d6ef..2b1788e1 100644
--- a/tests/i915/gem_concurrent_all.c
+++ b/tests/i915/gem_concurrent_all.c
@@ -1995,6 +1995,7 @@ igt_main
 						if (posix_memalign(&pinned, 4096, pin_sz) ||
 						    mlock(pinned, pin_sz) ||
 						    madvise(pinned, pin_sz, MADV_DONTFORK)) {
+							munlock(pinned, pin_sz);
 							free(pinned);
 							pinned = NULL;
 						}
@@ -2006,12 +2007,10 @@ igt_main
 				}
 				run_modes(name, c, modes, s, count);
 
-				igt_fixture {
-					if (pinned) {
-						munlock(pinned, pin_sz);
-						free(pinned);
-						pinned = NULL;
-					}
+				if (pinned) {
+					munlock(pinned, pin_sz);
+					free(pinned);
+					pinned = NULL;
 				}
 			}
 		}
-- 
2.32.0



More information about the igt-dev mailing list