From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt] core/sighelper: Interrupt everyone in the process group
Date: Mon, 11 Jan 2016 08:57:33 +0100 [thread overview]
Message-ID: <20160111075733.GI8076@phenom.ffwll.local> (raw)
In-Reply-To: <1452242669-20869-1-git-send-email-chris@chris-wilson.co.uk>
On Fri, Jan 08, 2016 at 08:44:29AM +0000, Chris Wilson wrote:
> Some stress tests create both the signal helper and a lot of competing
> processes. In these tests, the parent is just waiting upon the children,
> and the intention is not to keep waking up the waiting parent, but to
> keep interrupting the children (as we hope to trigger races in our
> kernel code). kill(-pid) sends the signal to all members of the process
> group, not just the target pid.
I don't really have any clue about unix pgroups, but the -pid disappeared
compared to the previous version.
>
> We also switch from using SIGUSR1 to SIGCONT to paper over a race
> condition when forking children that saw the default signal action being
> run (and thus killing the child).
I thought I fixed that race by first installing the new signal handler,
then forking. Ok, rechecked and it's the SYS_getpid stuff, so another
race. Still I thought signal handlers would survive a fork?
-Daniel
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_aux.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 4d08d68..f6b5792 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -79,7 +79,7 @@ static void __attribute__((noreturn)) signal_helper_process(pid_t pid)
> /* Interrupt the parent process at 500Hz, just to be annoying */
> while (1) {
> usleep(1000 * 1000 / 500);
> - if (kill(pid, SIGUSR1)) /* Parent has died, so must we. */
> + if (kill(pid, SIGCONT)) /* Parent has died, so must we. */
> exit(0);
> }
> }
> @@ -93,7 +93,7 @@ static void sig_handler(int i)
> * igt_fork_signal_helper:
> *
> * Fork a child process using #igt_fork_helper to interrupt the parent process
> - * with a SIGUSR1 signal at regular quick intervals. The corresponding dummy
> + * with a SIGCONT signal at regular quick intervals. The corresponding dummy
> * signal handler is installed in the parent process.
> *
> * This is useful to exercise ioctl error paths, at least where those can be
> @@ -108,10 +108,12 @@ void igt_fork_signal_helper(void)
> if (igt_only_list_subtests())
> return;
>
> - signal(SIGUSR1, sig_handler);
> + signal(SIGCONT, sig_handler);
> + setpgrp(); /* define a new process group for ourselves */
>
> igt_fork_helper(&signal_helper) {
> - signal_helper_process(getppid());
> + signal(SIGCONT, SIG_IGN);
> + signal_helper_process(-getppid());
> }
> }
>
> --
> 2.7.0.rc3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-01-11 7:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 8:44 [PATCH igt] core/sighelper: Interrupt everyone in the process group Chris Wilson
2016-01-11 7:57 ` Daniel Vetter [this message]
2016-01-11 8:54 ` Chris Wilson
2016-01-11 9:06 ` Daniel Vetter
2016-01-11 12:25 ` Dave Gordon
2016-01-11 12:34 ` Chris Wilson
2016-01-11 13:29 ` Dave Gordon
2016-01-11 13:41 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160111075733.GI8076@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.