* [PATCH i-g-t v2 0/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes
@ 2026-03-12 18:07 Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2026-03-12 18:07 UTC (permalink / raw)
To: igt-dev
Cc: intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka, Janusz Krzysztofik
When trying to exhaust system memory in order to exercise LMEM eviction
under OOM conditions, a gem_leak helper process may itself become a victim
of memory shortage. If our i915 TTM VM fault handler fails to allocate a
page and responds with a SIGBUS signal when the helper process is trying
to store data in a mmaped i915 GEM object with memset then the process
crashes. Unfortunately, such crash is not only reported on stdout, strerr
and dmesg as premature, additional result from the subtest while it is
still in progress, but also renders the final result as failed.
Since page allocation failures are unavoidable under OOM conditions, and
the SIGBUS signal response from our TTM fault handler is correct in such
cases, catch those signals and let the helper process continue.
While being at it, improve concurrency of smem-oom helpers and be more
clear about their supplementary role.
v2: Add 2 introductory patches that make the code more predictable and
clear,
- add a comment about no need to restore default SIGBUS handler (Kamil),
- fix missing initialization of sa.sa_mask with sigemptyset().
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Janusz Krzysztofik (3):
tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers.
tests/intel/gem_lmem_swapping: Be more clear about subprocesses role
tests/intel/gem_lmem_swapping: Expect gem leak helper crashes
tests/intel/gem_lmem_swapping.c | 60 +++++++++++++++++++++++++--------
1 file changed, 46 insertions(+), 14 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers.
2026-03-12 18:07 [PATCH i-g-t v2 0/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
@ 2026-03-12 18:07 ` Janusz Krzysztofik
2026-03-13 14:47 ` Kamil Konieczny
2026-03-19 7:06 ` Krzysztof Karas
2026-03-12 18:07 ` [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 3/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
2 siblings, 2 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2026-03-12 18:07 UTC (permalink / raw)
To: igt-dev
Cc: intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka, Janusz Krzysztofik
The smem-oom subtests re-spawns two different memory leak helpers. Any of
those two may either complete or be killed before the other and not
respawned until the other is also completed or killed. That imbalance may
actually affect the shape of OOM conditions, most probably intended to be
a compound result of those two memory exhaustion activities of different
nature.
Respawn each helper from its own loop.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
tests/intel/gem_lmem_swapping.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
index 77e18f1a3c..3a35318a74 100644
--- a/tests/intel/gem_lmem_swapping.c
+++ b/tests/intel/gem_lmem_swapping.c
@@ -707,7 +707,7 @@ static void test_smem_oom(int i915,
igt_get_total_swap_mb();
const unsigned int alloc = 256 * 1024 * 1024;
const unsigned int num_alloc = 1 + smem_size / (alloc >> 20);
- struct igt_helper_process smem_proc = {};
+ struct igt_helper_process smem_loop[2] = {};
unsigned int n;
int lmem_err;
@@ -734,8 +734,8 @@ static void test_smem_oom(int i915,
drm_close_driver(fd);
}
- /* smem memory hog process, respawn till the lmem process completes */
- igt_fork_helper(&smem_proc) {
+ /* smem memory hog processes, respawn till the lmem process completes */
+ igt_fork_helper(&smem_loop[0]) {
while (!READ_ONCE(*lmem_done)) {
igt_fork(child, 1) {
for (int pass = 0; pass < num_alloc; pass++) {
@@ -744,6 +744,16 @@ static void test_smem_oom(int i915,
leak(alloc);
}
}
+ /*
+ * Wait for grand-child process to finish or be
+ * killed by the oom killer, don't call
+ * igt_waitchildren because of the noise
+ */
+ wait(NULL);
+ }
+ }
+ igt_fork_helper(&smem_loop[1]) {
+ while (!READ_ONCE(*lmem_done)) {
igt_fork(child, 1) {
int fd = drm_reopen_driver(i915);
@@ -754,13 +764,7 @@ static void test_smem_oom(int i915,
}
drm_close_driver(fd);
}
- /*
- * Wait for grand-child processes to finish or be
- * killed by the oom killer, don't call
- * igt_waitchildren because of the noise
- */
- for (n = 0; n < 2; n++)
- wait(NULL);
+ wait(NULL);
}
}
@@ -772,7 +776,8 @@ static void test_smem_oom(int i915,
(*lmem_done)++;
munmap(lmem_done, sizeof(*lmem_done));
- igt_wait_helper(&smem_proc);
+ for (n = 0; n < 2; n++)
+ igt_wait_helper(&smem_loop[n]);
igt_assert_eq(lmem_err, 0);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role
2026-03-12 18:07 [PATCH i-g-t v2 0/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
@ 2026-03-12 18:07 ` Janusz Krzysztofik
2026-03-13 14:45 ` Kamil Konieczny
2026-03-19 7:20 ` Krzysztof Karas
2026-03-12 18:07 ` [PATCH i-g-t v2 3/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
2 siblings, 2 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2026-03-12 18:07 UTC (permalink / raw)
To: igt-dev
Cc: intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka, Janusz Krzysztofik
In the smem-oom subtest, helper processes are now spawn with igt_fork(),
not with igt_fork_helper() as one might expect. That unfortunate use
of igt_fork() may introduce uncertainty about the role of those
subprocesses, whether their failures should count or not.
Use igt_fork_helper() for clarity.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
tests/intel/gem_lmem_swapping.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
index 3a35318a74..f790dc66e9 100644
--- a/tests/intel/gem_lmem_swapping.c
+++ b/tests/intel/gem_lmem_swapping.c
@@ -737,7 +737,9 @@ static void test_smem_oom(int i915,
/* smem memory hog processes, respawn till the lmem process completes */
igt_fork_helper(&smem_loop[0]) {
while (!READ_ONCE(*lmem_done)) {
- igt_fork(child, 1) {
+ struct igt_helper_process smem_proc = {};
+
+ igt_fork_helper(&smem_proc) {
for (int pass = 0; pass < num_alloc; pass++) {
if (READ_ONCE(*lmem_done))
break;
@@ -749,12 +751,14 @@ static void test_smem_oom(int i915,
* killed by the oom killer, don't call
* igt_waitchildren because of the noise
*/
- wait(NULL);
+ igt_wait_helper(&smem_proc);
}
}
igt_fork_helper(&smem_loop[1]) {
while (!READ_ONCE(*lmem_done)) {
- igt_fork(child, 1) {
+ struct igt_helper_process smem_proc = {};
+
+ igt_fork_helper(&smem_proc) {
int fd = drm_reopen_driver(i915);
for (int pass = 0; pass < num_alloc; pass++) {
@@ -764,7 +768,7 @@ static void test_smem_oom(int i915,
}
drm_close_driver(fd);
}
- wait(NULL);
+ igt_wait_helper(&smem_proc);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH i-g-t v2 3/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes
2026-03-12 18:07 [PATCH i-g-t v2 0/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role Janusz Krzysztofik
@ 2026-03-12 18:07 ` Janusz Krzysztofik
2 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2026-03-12 18:07 UTC (permalink / raw)
To: igt-dev
Cc: intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka, Janusz Krzysztofik
When trying to exhaust system memory in order to exercise LMEM eviction
under OOM conditions, a gem_leak helper process may itself become a victim
of memory shortage. If our i915 TTM VM fault handler fails to allocate a
page and responds with a SIGBUS signal when the helper process is trying
to store data in a mmaped i915 GEM object with memset then the process
crashes. Unfortunately, such crash is not only reported on stdout, strerr
and dmesg as premature, additional result from the subtest while it is
still in progress, but also renders the final result as failed.
Starting subtest: smem-oom
Starting dynamic subtest: lmem0
Received signal SIGBUS.
Stack trace:
#0 [fatal_sig_handler+0x17b]
#1 [__sigaction+0x50]
#2 [__igt_unique____real_main808+0xdbc]
#3 [main+0x3f]
#4 [__libc_init_first+0x8a]
#5 [__libc_start_main+0x8b]
#6 [_start+0x25]
Dynamic subtest lmem0: CRASH (20.804s)
Subtest smem-oom: SUCCESS (20.807s)
Received signal SIGABRT.
Stack trace:
#0 [fatal_sig_handler+0x17b]
#1 [__sigaction+0x50]
#2 [pthread_kill+0x11c]
#3 [gsignal+0x1e]
#4 [abort+0xdf]
#5 [<unknown>+0xdf]
#6 [__assert_fail+0x47]
#7 [__igt_waitchildren+0x1c0]
#8 [igt_waitchildren_timeout+0x9d]
#9 [intel_allocator_multiprocess_stop+0xbb]
#10 [__igt_unique____real_main808+0x551]
#11 [main+0x3f]
#12 [__libc_init_first+0x8a]
#13 [__libc_start_main+0x8b]
#14 [_start+0x25]
(gem_lmem_swapping:2347) CRITICAL: Test assertion failure function test_smem_oom, file ../tests/intel/gem_lmem_swapping.c:777:
(gem_lmem_swapping:2347) CRITICAL: Failed assertion: lmem_err == 0
(gem_lmem_swapping:2347) CRITICAL: Last errno: 3, No such process
(gem_lmem_swapping:2347) CRITICAL: error: 137 != 0
Dynamic subtest lmem0 failed.
...
runner: Dynamic subtest lmem0 result when not inside a subtest. This is a test bug.
Subtest smem-oom: FAIL (22.672s)
Since page allocation failures are unavoidable under OOM conditions, and
the SIGBUS signal response from our TTM fault handler is correct in such
cases, catch those signals and let the helper process continue.
v2: Add a comment about no need to restore default SIGBUS handler (Kamil),
- fix missing initialization of sa.sa_mask with sigemptyset().
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5493
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
tests/intel/gem_lmem_swapping.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
index f790dc66e9..91a9ef6d2e 100644
--- a/tests/intel/gem_lmem_swapping.c
+++ b/tests/intel/gem_lmem_swapping.c
@@ -11,6 +11,8 @@
#include "igt_kmod.h"
#include "runnercomms.h"
#include <unistd.h>
+#include <setjmp.h>
+#include <signal.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
@@ -651,13 +653,21 @@ static void leak(uint64_t alloc)
}
}
+static sigjmp_buf sigbus_jmp;
+
+static void sigbus_handler(int sig, siginfo_t *si, void *ctx)
+{
+ siglongjmp(sigbus_jmp, 1);
+}
+
static void gem_leak(int fd, uint64_t alloc)
{
uint32_t handle = gem_create(fd, alloc);
void *buf;
buf = gem_mmap_offset__fixed(fd, handle, 0, PAGE_SIZE, PROT_WRITE);
- memset(buf, 0, PAGE_SIZE);
+ if (!igt_debug_on_f(sigsetjmp(sigbus_jmp, 1), "PID %d: SIGBUS caught\n", getpid()))
+ memset(buf, 0, PAGE_SIZE);
munmap(buf, PAGE_SIZE);
gem_madvise(fd, handle, I915_MADV_DONTNEED);
@@ -759,8 +769,21 @@ static void test_smem_oom(int i915,
struct igt_helper_process smem_proc = {};
igt_fork_helper(&smem_proc) {
+ struct sigaction sa = {
+ .sa_sigaction = sigbus_handler,
+ .sa_flags = SA_SIGINFO | SA_NODEFER,
+ };
int fd = drm_reopen_driver(i915);
+ sigemptyset(&sa.sa_mask);
+
+ /*
+ * This helper process is allowed to ignore
+ * SIGBUS signals and continue, no need to
+ * restore default SIGBUS handler ever.
+ */
+ sigaction(SIGBUS, &sa, NULL);
+
for (int pass = 0; pass < num_alloc; pass++) {
if (READ_ONCE(*lmem_done))
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role
2026-03-12 18:07 ` [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role Janusz Krzysztofik
@ 2026-03-13 14:45 ` Kamil Konieczny
2026-03-19 7:20 ` Krzysztof Karas
1 sibling, 0 replies; 9+ messages in thread
From: Kamil Konieczny @ 2026-03-13 14:45 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: igt-dev, intel-gfx, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka
Hi Janusz,
On 2026-03-12 at 19:07:34 +0100, Janusz Krzysztofik wrote:
> In the smem-oom subtest, helper processes are now spawn with igt_fork(),
> not with igt_fork_helper() as one might expect. That unfortunate use
> of igt_fork() may introduce uncertainty about the role of those
> subprocesses, whether their failures should count or not.
>
> Use igt_fork_helper() for clarity.
>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
LGTM
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Regards,
Kamil
> ---
> tests/intel/gem_lmem_swapping.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
> index 3a35318a74..f790dc66e9 100644
> --- a/tests/intel/gem_lmem_swapping.c
> +++ b/tests/intel/gem_lmem_swapping.c
> @@ -737,7 +737,9 @@ static void test_smem_oom(int i915,
> /* smem memory hog processes, respawn till the lmem process completes */
> igt_fork_helper(&smem_loop[0]) {
> while (!READ_ONCE(*lmem_done)) {
> - igt_fork(child, 1) {
> + struct igt_helper_process smem_proc = {};
> +
> + igt_fork_helper(&smem_proc) {
> for (int pass = 0; pass < num_alloc; pass++) {
> if (READ_ONCE(*lmem_done))
> break;
> @@ -749,12 +751,14 @@ static void test_smem_oom(int i915,
> * killed by the oom killer, don't call
> * igt_waitchildren because of the noise
> */
> - wait(NULL);
> + igt_wait_helper(&smem_proc);
> }
> }
> igt_fork_helper(&smem_loop[1]) {
> while (!READ_ONCE(*lmem_done)) {
> - igt_fork(child, 1) {
> + struct igt_helper_process smem_proc = {};
> +
> + igt_fork_helper(&smem_proc) {
> int fd = drm_reopen_driver(i915);
>
> for (int pass = 0; pass < num_alloc; pass++) {
> @@ -764,7 +768,7 @@ static void test_smem_oom(int i915,
> }
> drm_close_driver(fd);
> }
> - wait(NULL);
> + igt_wait_helper(&smem_proc);
> }
> }
>
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers.
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
@ 2026-03-13 14:47 ` Kamil Konieczny
2026-03-19 7:06 ` Krzysztof Karas
1 sibling, 0 replies; 9+ messages in thread
From: Kamil Konieczny @ 2026-03-13 14:47 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: igt-dev, intel-gfx, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Karas,
Krzysztof Niemiec, Sebastian Brzezinka
Hi Janusz,
On 2026-03-12 at 19:07:33 +0100, Janusz Krzysztofik wrote:
small nit about subject, imho it should have 'intel/' and dot
removed:
[PATCH i-g-t v2 1/3] tests/intel/gem_lmem_swapping: Improve concurrency of smem-oom helpers
With that fixed
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Regards,
Kamil
> The smem-oom subtests re-spawns two different memory leak helpers. Any of
> those two may either complete or be killed before the other and not
> respawned until the other is also completed or killed. That imbalance may
> actually affect the shape of OOM conditions, most probably intended to be
> a compound result of those two memory exhaustion activities of different
> nature.
>
> Respawn each helper from its own loop.
>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> ---
> tests/intel/gem_lmem_swapping.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
> index 77e18f1a3c..3a35318a74 100644
> --- a/tests/intel/gem_lmem_swapping.c
> +++ b/tests/intel/gem_lmem_swapping.c
> @@ -707,7 +707,7 @@ static void test_smem_oom(int i915,
> igt_get_total_swap_mb();
> const unsigned int alloc = 256 * 1024 * 1024;
> const unsigned int num_alloc = 1 + smem_size / (alloc >> 20);
> - struct igt_helper_process smem_proc = {};
> + struct igt_helper_process smem_loop[2] = {};
> unsigned int n;
> int lmem_err;
>
> @@ -734,8 +734,8 @@ static void test_smem_oom(int i915,
> drm_close_driver(fd);
> }
>
> - /* smem memory hog process, respawn till the lmem process completes */
> - igt_fork_helper(&smem_proc) {
> + /* smem memory hog processes, respawn till the lmem process completes */
> + igt_fork_helper(&smem_loop[0]) {
> while (!READ_ONCE(*lmem_done)) {
> igt_fork(child, 1) {
> for (int pass = 0; pass < num_alloc; pass++) {
> @@ -744,6 +744,16 @@ static void test_smem_oom(int i915,
> leak(alloc);
> }
> }
> + /*
> + * Wait for grand-child process to finish or be
> + * killed by the oom killer, don't call
> + * igt_waitchildren because of the noise
> + */
> + wait(NULL);
> + }
> + }
> + igt_fork_helper(&smem_loop[1]) {
> + while (!READ_ONCE(*lmem_done)) {
> igt_fork(child, 1) {
> int fd = drm_reopen_driver(i915);
>
> @@ -754,13 +764,7 @@ static void test_smem_oom(int i915,
> }
> drm_close_driver(fd);
> }
> - /*
> - * Wait for grand-child processes to finish or be
> - * killed by the oom killer, don't call
> - * igt_waitchildren because of the noise
> - */
> - for (n = 0; n < 2; n++)
> - wait(NULL);
> + wait(NULL);
> }
> }
>
> @@ -772,7 +776,8 @@ static void test_smem_oom(int i915,
> (*lmem_done)++;
> munmap(lmem_done, sizeof(*lmem_done));
>
> - igt_wait_helper(&smem_proc);
> + for (n = 0; n < 2; n++)
> + igt_wait_helper(&smem_loop[n]);
>
> igt_assert_eq(lmem_err, 0);
> }
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers.
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
2026-03-13 14:47 ` Kamil Konieczny
@ 2026-03-19 7:06 ` Krzysztof Karas
1 sibling, 0 replies; 9+ messages in thread
From: Krzysztof Karas @ 2026-03-19 7:06 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: igt-dev, intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Niemiec,
Sebastian Brzezinka
Hi Janusz,
On 2026-03-12 at 19:07:33 +0100, Janusz Krzysztofik wrote:
> The smem-oom subtests re-spawns two different memory leak helpers. Any of
> those two may either complete or be killed before the other and not
> respawned until the other is also completed or killed. That imbalance may
> actually affect the shape of OOM conditions, most probably intended to be
> a compound result of those two memory exhaustion activities of different
> nature.
>
> Respawn each helper from its own loop.
>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> ---
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Just one question out of curiosity: did you ever run into the
test looping unable to cause oom condition yourself?
--
Best Regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role
2026-03-12 18:07 ` [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role Janusz Krzysztofik
2026-03-13 14:45 ` Kamil Konieczny
@ 2026-03-19 7:20 ` Krzysztof Karas
2026-03-19 9:28 ` Janusz Krzysztofik
1 sibling, 1 reply; 9+ messages in thread
From: Krzysztof Karas @ 2026-03-19 7:20 UTC (permalink / raw)
To: Janusz Krzysztofik
Cc: igt-dev, intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Niemiec,
Sebastian Brzezinka
Hi Janusz,
> In the smem-oom subtest, helper processes are now spawn with igt_fork(),
> not with igt_fork_helper() as one might expect. That unfortunate use
> of igt_fork() may introduce uncertainty about the role of those
> subprocesses, whether their failures should count or not.
>
> Use igt_fork_helper() for clarity.
>
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> ---
> tests/intel/gem_lmem_swapping.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
> index 3a35318a74..f790dc66e9 100644
> --- a/tests/intel/gem_lmem_swapping.c
> +++ b/tests/intel/gem_lmem_swapping.c
> @@ -737,7 +737,9 @@ static void test_smem_oom(int i915,
> /* smem memory hog processes, respawn till the lmem process completes */
> igt_fork_helper(&smem_loop[0]) {
> while (!READ_ONCE(*lmem_done)) {
> - igt_fork(child, 1) {
> + struct igt_helper_process smem_proc = {};
> +
> + igt_fork_helper(&smem_proc) {
> for (int pass = 0; pass < num_alloc; pass++) {
> if (READ_ONCE(*lmem_done))
> break;
> @@ -749,12 +751,14 @@ static void test_smem_oom(int i915,
> * killed by the oom killer, don't call
> * igt_waitchildren because of the noise
> */
This comment is no longer applicable, you should remove it.
igt_waitchildren() is supposed to be for igt_fork-ed processes,
so as you change the background fork to igt_helper_process type,
this may be confusing if left in the code.
After that change, feel free to add:
Revieved-by: Krzysztof Karas <krzysztof.karas@intel.com>
> - wait(NULL);
> + igt_wait_helper(&smem_proc);
> }
> }
> igt_fork_helper(&smem_loop[1]) {
> while (!READ_ONCE(*lmem_done)) {
> - igt_fork(child, 1) {
> + struct igt_helper_process smem_proc = {};
> +
> + igt_fork_helper(&smem_proc) {
> int fd = drm_reopen_driver(i915);
>
> for (int pass = 0; pass < num_alloc; pass++) {
> @@ -764,7 +768,7 @@ static void test_smem_oom(int i915,
> }
> drm_close_driver(fd);
> }
> - wait(NULL);
> + igt_wait_helper(&smem_proc);
> }
> }
>
> --
> 2.53.0
>
--
Best Regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role
2026-03-19 7:20 ` Krzysztof Karas
@ 2026-03-19 9:28 ` Janusz Krzysztofik
0 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2026-03-19 9:28 UTC (permalink / raw)
To: Krzysztof Karas
Cc: igt-dev, intel-gfx, Kamil Konieczny, Zbigniew Kempczyński,
Thomas Hellström, Andi Shyti, Krzysztof Niemiec,
Sebastian Brzezinka
Hi Krzysztof,
Thanks for looking into this.
On Thu, 2026-03-19 at 07:20 +0000, Krzysztof Karas wrote:
> Hi Janusz,
>
> > In the smem-oom subtest, helper processes are now spawn with igt_fork(),
> > not with igt_fork_helper() as one might expect. That unfortunate use
> > of igt_fork() may introduce uncertainty about the role of those
> > subprocesses, whether their failures should count or not.
> >
> > Use igt_fork_helper() for clarity.
> >
> > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> > ---
> > tests/intel/gem_lmem_swapping.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/tests/intel/gem_lmem_swapping.c b/tests/intel/gem_lmem_swapping.c
> > index 3a35318a74..f790dc66e9 100644
> > --- a/tests/intel/gem_lmem_swapping.c
> > +++ b/tests/intel/gem_lmem_swapping.c
> > @@ -737,7 +737,9 @@ static void test_smem_oom(int i915,
> > /* smem memory hog processes, respawn till the lmem process completes */
> > igt_fork_helper(&smem_loop[0]) {
> > while (!READ_ONCE(*lmem_done)) {
> > - igt_fork(child, 1) {
> > + struct igt_helper_process smem_proc = {};
> > +
> > + igt_fork_helper(&smem_proc) {
> > for (int pass = 0; pass < num_alloc; pass++) {
> > if (READ_ONCE(*lmem_done))
> > break;
> > @@ -749,12 +751,14 @@ static void test_smem_oom(int i915,
> > * killed by the oom killer, don't call
> > * igt_waitchildren because of the noise
> > */
> This comment is no longer applicable, you should remove it.
> igt_waitchildren() is supposed to be for igt_fork-ed processes,
> so as you change the background fork to igt_helper_process type,
> this may be confusing if left in the code.
You are right, and my intention was like that but I missed it.
Unfortunately, the patch has been already applied to upstream. But
that's not a problem, I'll prepare a follow-up patch with that fixed.
Thanks,
Janusz
>
> After that change, feel free to add:
> Revieved-by: Krzysztof Karas <krzysztof.karas@intel.com>
>
> > - wait(NULL);
> > + igt_wait_helper(&smem_proc);
> > }
> > }
> > igt_fork_helper(&smem_loop[1]) {
> > while (!READ_ONCE(*lmem_done)) {
> > - igt_fork(child, 1) {
> > + struct igt_helper_process smem_proc = {};
> > +
> > + igt_fork_helper(&smem_proc) {
> > int fd = drm_reopen_driver(i915);
> >
> > for (int pass = 0; pass < num_alloc; pass++) {
> > @@ -764,7 +768,7 @@ static void test_smem_oom(int i915,
> > }
> > drm_close_driver(fd);
> > }
> > - wait(NULL);
> > + igt_wait_helper(&smem_proc);
> > }
> > }
> >
> > --
> > 2.53.0
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-03-19 9:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 18:07 [PATCH i-g-t v2 0/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 1/3] tests/gem_lmem_swapping: Improve concurrency of smem-oom helpers Janusz Krzysztofik
2026-03-13 14:47 ` Kamil Konieczny
2026-03-19 7:06 ` Krzysztof Karas
2026-03-12 18:07 ` [PATCH i-g-t v2 2/3] tests/intel/gem_lmem_swapping: Be more clear about subprocesses role Janusz Krzysztofik
2026-03-13 14:45 ` Kamil Konieczny
2026-03-19 7:20 ` Krzysztof Karas
2026-03-19 9:28 ` Janusz Krzysztofik
2026-03-12 18:07 ` [PATCH i-g-t v2 3/3] tests/intel/gem_lmem_swapping: Expect gem leak helper crashes Janusz Krzysztofik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox