Hi Janusz,
[...]
> +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);
> @@ -745,8 +755,14 @@ static void test_smem_oom(int i915,
> }
> }
> igt_fork(child, 1) {
> + struct sigaction sa = {
> + .sa_sigaction = sigbus_handler,
> + .sa_flags = SA_SIGINFO | SA_NODEFER,
> + };
> int fd = drm_reopen_driver(i915);
>
> + sigaction(SIGBUS, &sa, NULL);
> +
> for (int pass = 0; pass < num_alloc; pass++) {
> if (READ_ONCE(*lmem_done))
> break;
I think this is a neat idea.
Reviewed-by: Krzysztof Karas <[email protected]>
--
Best Regards,
Krzysztof