From ef18e59c374472e961a3a145724e7381eb4800aa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 24 May 2022 12:01:41 +0200 Subject: lib/igt_aux: fix kselftest module unload Most of the time, i915 module unload happens inside a subtest. So, using igt_fork() is OK. However, on i915_selftest, this is called earlier, at igt_kselftest_begin. This causes an error on IGT: forking is only allowed in subtests or igt_simple_main please refer to lib/igt_core documentation As igt_fork() can only be used inside subtests. So, use igt_fork_helper() instead. Reviewed-by: Petri Latvala Signed-off-by: Mauro Carvalho Chehab --- lib/igt_aux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 751c8a29..9431960f 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -1465,11 +1465,12 @@ igt_lsof(const char *dpath) static void pulseaudio_unload_module(proc_t *proc_info) { + struct igt_helper_process pa_proc = {}; char xdg_dir[PATH_MAX]; const char *homedir; struct passwd *pw; - igt_fork(child, 1) { + igt_fork_helper(&pa_proc) { pw = getpwuid(proc_info->euid); homedir = pw->pw_dir; snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid); @@ -1484,11 +1485,12 @@ static void pulseaudio_unload_module(proc_t *proc_info) system("for i in $(pacmd list-sources|grep module:|cut -d : -f 2); do pactl unload-module $i; done"); } - igt_waitchildren(); + igt_wait_helper(&pa_proc); } static int pipewire_pulse_pid = 0; static int pipewire_pw_reserve_pid = 0; +static struct igt_helper_process pw_reserve_proc = {}; static void pipewire_reserve_wait(void) { @@ -1498,7 +1500,7 @@ static void pipewire_reserve_wait(void) proc_t *proc_info; PROCTAB *proc; - igt_fork(child, 1) { + igt_fork_helper(&pw_reserve_proc) { igt_info("Preventing pipewire-pulse to use the audio drivers\n"); proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG); @@ -1592,7 +1594,7 @@ void pipewire_pulse_stop_reserve(void) if (!pipewire_pulse_pid) return; - igt_kill_children(SIGTERM); + igt_stop_helper(&pw_reserve_proc); } /** -- cgit v1.2.3