linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Indan Zupancic <indan@nul.nu>
Cc: Takuo Koguchi <takuo.koguchi.sw@hitachi.com>,
	linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com,
	rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com,
	jbaron@redhat.com, yrl.pp-manager.tt@hitachi.com,
	mcgrathr@google.com
Subject: Re: [PATCH] ARM: Wire up HAVE_SYSCALL_TRACEPOINTS
Date: Fri, 3 Feb 2012 00:32:20 +0000	[thread overview]
Message-ID: <20120203003220.GC14129@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5afe2282e055f172906087538bdb1f3d.squirrel@webmail.greenhost.nl>

On Fri, Feb 03, 2012 at 12:38:58AM +0100, Indan Zupancic wrote:
> On Thu, February 2, 2012 12:10, Russell King - ARM Linux wrote:
> > On Thu, Feb 02, 2012 at 12:00:30PM +0100, Indan Zupancic wrote:
> >> On Thu, February 2, 2012 10:21, Takuo Koguchi wrote:
> >> > Right.  As Russel King suggested, this patch depends on those configs
> >> > until very large NR_syscalls is properly handled by ftrace.
> >>
> >> It has nothing to do with large NR_syscalls. Supporting OABI is hard,
> >
> > That's rubbish if you're doing things correctly, where correctly is
> > defined as 'not assuming that the syscall number is in r7, but reading
> > it from the thread_info->syscall member.
> 
> It was my impression that thread_info->syscall is only set in the ptrace
> path.

Well, as ptrace is the only syscall tracing we have at the moment in
the kernel, then that's how its done.

What we don't have there for ptrace is a method to read that, so
tools such as strace have had to fiddle about to discover the syscall
number.  That's something I have had a patch for some time to 'fix'
(a PTRACE_GET_SYSCALL to complement PTRACE_SET_SYSCALL) but haven't
had the motivation to try to fix that.

> Of course this can be changed, but it's tricky to do without adding
> instructions to the syscall entry path. One way would be to have a
> flag somewhere saying whether r7 or thread_info->syscall should be
> used, and also set thread_info->syscall for OABI calls. That at least
> won't slow down the EABI path.

Why would you need to change the entry path?  We already have a hook
out of the syscall path for doing tracing (via syscall_trace()) but
the fact that it sits in ptrace.c isn't an argument to create something
new.

> > Notice how the EABI case is a lot more complicated by the alignment
> > rules than the OABI - not only do you need something like the above
> 
> Only when you go through the args sequentially like that.

If you don't go through the args sequentially, then your only way of
deciding EABI args is via a table which describes the location of each
argument in the register set.

> If only EABI is supported everything is simple, because everyone knows
> what to expect. If OABI is also supported then more changes are needed:
> The above, but also some way to tell ptrace and other users if it was
> an EABI or OABI system call. And currently with ptrace there is no race
> free way of figuring out the OABI system call number from user space.

Absolute tosh, that really is.  Of course there's a way of figuring it
out.  Tools such as strace have been doing it for _years_ and have been
doing it extremely well.

Sure, some other thread may stamp over the syscall after you've entered
the kernel, but that's a bug in any case - if programs are doing that
then they're racy, and can't predict what system call they're going to
invoke.  So really that kind of race is not one to be concerned about.

And, in any case, using what's already there in syscall_trace() already
gives you a way to store and manipulate the syscall number.  So really
there's no argument over obtaining the syscall number from OABI at all.

  parent reply	other threads:[~2012-02-03  0:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 11:01 [PATCH] ARM: Wire up HAVE_SYSCALL_TRACEPOINTS takuo.koguchi.sw
2012-02-01  1:47 ` Indan Zupancic
2012-02-01  2:09   ` Steven Rostedt
2012-02-02  9:21   ` Takuo Koguchi
2012-02-02 11:00     ` Indan Zupancic
2012-02-02 11:10       ` Russell King - ARM Linux
2012-02-02 23:38         ` Indan Zupancic
2012-02-02 23:41           ` Roland McGrath
2012-02-03  0:32           ` Russell King - ARM Linux [this message]
2012-02-03  1:58             ` Indan Zupancic
2012-02-01  9:46 ` Russell King - ARM Linux

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=20120203003220.GC14129@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=fweisbec@gmail.com \
    --cc=indan@nul.nu \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mcgrathr@google.com \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=takuo.koguchi.sw@hitachi.com \
    --cc=yrl.pp-manager.tt@hitachi.com \
    /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;
as well as URLs for NNTP newsgroup(s).