diff mbox series

[i-g-t,v2,2/2] tests/gem_mmap_offset: Fix OOM hits

Message ID 20241128111822.836089-6-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New
Headers show
Series tests/gem_mmap_offset: Fix OOM hits | expand

Commit Message

Janusz Krzysztofik Nov. 28, 2024, 11:16 a.m. UTC
The 'clear' subtest exercises correctness of object memory clearing on
passing a batch with the object to GPU for processing.  The exercise is
executed in several parallel threads, one per CPU.  Each thread repeats
the exercise in a time only limited loop, with no delay between
consecutive iterations.  In case of system memory objects, that happens
to exhaust all available physical memory, which is neither the goal nor
requirement of the exercise.

Make sure sufficient amount of physical memory is available before calling
another execbuf.

v2: Limit the scope of the fix to SMEM exercise.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11738
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 tests/intel/gem_mmap_offset.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andi Shyti Nov. 28, 2024, 11:56 a.m. UTC | #1
Hi Janusz,

On Thu, Nov 28, 2024 at 12:16:36PM +0100, Janusz Krzysztofik wrote:
> The 'clear' subtest exercises correctness of object memory clearing on
> passing a batch with the object to GPU for processing.  The exercise is
> executed in several parallel threads, one per CPU.  Each thread repeats
> the exercise in a time only limited loop, with no delay between
> consecutive iterations.  In case of system memory objects, that happens
> to exhaust all available physical memory, which is neither the goal nor
> requirement of the exercise.
> 
> Make sure sufficient amount of physical memory is available before calling
> another execbuf.
> 
> v2: Limit the scope of the fix to SMEM exercise.
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11738
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
diff mbox series

Patch

diff --git a/tests/intel/gem_mmap_offset.c b/tests/intel/gem_mmap_offset.c
index 20dca17378..8ce10d6144 100644
--- a/tests/intel/gem_mmap_offset.c
+++ b/tests/intel/gem_mmap_offset.c
@@ -745,6 +745,9 @@  static void *thread_clear(void *data)
 		npages = get_npages(&arg->max, npages);
 		size = npages << 12;
 
+		/* Execbuf requires sufficient amount of free physical memory */
+		if (arg->flags & CLEAR_IN_EXECBUF && arg->region.memory_class == I915_MEMORY_CLASS_SYSTEM)
+			igt_require_memory(1, size, CHECK_RAM);
 		igt_assert_eq(__gem_create_in_memory_region_list(i915, &handle, &size, 0, &arg->region, 1), 0);
 		/* Zero-init bo in execbuf or pagefault handler path as requested */
 		if (arg->flags & CLEAR_IN_EXECBUF)