public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Tesarik <ptesarik@suse.cz>
To: linux-ia64@vger.kernel.org
Subject: Re: ptrace problem with 2.6.25 on Itanium
Date: Mon, 28 Apr 2008 10:01:35 +0000	[thread overview]
Message-ID: <1209376895.4027.29.camel@elijah.suse.cz> (raw)
In-Reply-To: <7c86c4470804240339p77639b4ejee73baec305d74c5@mail.gmail.com>

On Sun, 2008-04-27 at 19:30 -0700, Roland McGrath wrote:
> Sorry to complicate your life, but this one is officially Your Problem.
> There is no kernel bug here.  The semantics have not changed, only the
> timing.  (You are not the first to assume some ordering constraint was
> provided in the ptrace interface that in fact has never been guaranteed
> at all.)

I was just wondering why the timing was changed in such a way that the
signals *consistently* arrive in wrong order, and why only on IA64. I
think I know the answer:

do_fork() calls ptrace_notify() from the parent before the parent
process is rescheduled. This usually happens before the child process is
scheduled - BTW it happens always if both processes run on the same CPU
and the kernel is not preemptive.

Now, what happens after applying the RSE patch is that sending the
notification from the parent involves synchronizing the parent's RSE to
user space. Because this takes some time (and may sleep), the child
process is selected by the scheduler and runs first (note that the
notification is sent _after_ waking the child).

On other architectures, the overhead with enqueueing the notification
signal is much smaller, so the parent usually finishes sending the
signal before the child even gets to sending its own notification. But
this is racy, as pointed out by Roland, and any program which relies on
it will fail one day. In a way, we should be glad that ia64 now tends to
send the signals in a non-deterministic order, as more people will hit
the race and (hopefully) fix their programs. ;)

Kind regards,
Petr Tesarik

  parent reply	other threads:[~2008-04-28 10:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24 10:39 ptrace problem with 2.6.25 on Itanium stephane eranian
2008-04-24 12:04 ` Petr Tesarik
2008-04-24 12:14 ` stephane eranian
2008-04-24 12:27 ` Petr Tesarik
2008-04-28  2:30 ` Roland McGrath
2008-04-28 10:01 ` Petr Tesarik [this message]
2008-04-30 19:32 ` stephane eranian

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=1209376895.4027.29.camel@elijah.suse.cz \
    --to=ptesarik@suse.cz \
    --cc=linux-ia64@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox