All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 2/2] syscalls/clone3: New tests
Date: Fri, 20 Mar 2020 02:20:33 +0100	[thread overview]
Message-ID: <20200320012033.GC1430@yuki.lan> (raw)
In-Reply-To: <20200319161834.4hdz4q75yyk4cfy2@vireshk-i7>

Hi!
> What's happening is that parent is able to send the signal before the
> child calls pause() and so it hangs. If I simply remove pause() it all
> works fine for me, but is pidfd_send_signal() synchronous ? Does it
> wait until the time child signal is executed ? If yes, then we don't
> have a problem, else we may run into timing issue.
> 
> We can add a delay in parent before sending the signal, but that is
> still racy in worst cases.

In that case we can add a loop over a volatile varible changed from the
signal handler with a short usleep. Something as:

static volatile int wait_for_signal;

The do_child() would do:

	wait_for_signal = 1;

	TST_CHECKPOINT_WAKE(..);

	while (wait_for_signal)
		usleep(100);


And the handler would do:

	wait_for_signal = 0;

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2020-03-20  1:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 11:58 [LTP] [PATCH V2 0/2] syscalls/clone3: New tests Viresh Kumar
2020-03-19 11:58 ` [LTP] [PATCH V2 1/2] syscalls/pidfd_send_signal: Move pidfd_send_signal.h to include/lapi/ Viresh Kumar
2020-03-19 22:38   ` Cyril Hrubis
2020-03-19 11:58 ` [LTP] [PATCH V2 2/2] syscalls/clone3: New tests Viresh Kumar
2020-03-19 23:01   ` Cyril Hrubis
2020-03-19 15:19     ` Viresh Kumar
2020-03-19 15:31       ` Viresh Kumar
2020-03-19 23:24       ` Cyril Hrubis
2020-03-19 15:51         ` Viresh Kumar
2020-03-19 16:18         ` Viresh Kumar
2020-03-20  1:20           ` Cyril Hrubis [this message]

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=20200320012033.GC1430@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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.