Re: [IGT PATCH 1/2] aux: Suspend signal helper for shell commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Imre Deak (2017-10-12 14:22:06)
> The clone() system call with a larger executable (like /bin/sh) may have
> difficulty to make progress on some platforms if interrupted frequently.
> So suspend the signal helper process for the duration of the syscall.
> This is needed to solve an actual problem by the next patch.
> 
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx>
> ---
>  lib/igt_aux.c  | 38 ++++++++++++++++++++++++++++++++++++++
>  lib/igt_aux.h  |  2 ++
>  lib/igt_core.c |  9 +++++++++
>  3 files changed, 49 insertions(+)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index fa6594c3..36dfab43 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -350,6 +350,44 @@ void igt_stop_signal_helper(void)
>         sig_stat = 0;
>  }
>  
> +/**
> + * igt_suspend_signal_helper:
> + *
> + * Suspends the child process spawned with igt_fork_signal_helper().
> + *
> + * This should be called before code that has difficulty to make progress if
> + * interrupted frequently, like the clone() syscall spawning a large
> + * executable.

 * igt_resume_signal_helper() must be called after the critical section
 * to restart interruptions for the test.


> + */
> +void igt_suspend_signal_helper(void)
> +{
> +       int status;
> +
> +       if (!signal_helper.running)
> +               return;
> +
> +       kill(signal_helper.pid, SIGSTOP);
> +       while (waitpid(signal_helper.pid, &status, WUNTRACED) == -1 &&
> +              errno == EINTR)
> +               ;
> +}
> +
> +/**
> + * igt_suspend_signal_helper:

igt_resume_signal_helper

> + *
> + * Resumes the child process spawned with igt_fork_signal_helper().
> + *
> + * This should be paired with igt_suspend_signal_helper() and called after the
> + * problematic code sensitive to signals.
> + */
> +void igt_resume_signal_helper(void)
> +{
> +       if (!signal_helper.running)
> +               return;
> +
> +       kill(signal_helper.pid, SIGCONT);
> +}

Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux