mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Linux API <linux-api@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	open list <linux-kernel@vger.kernel.org>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Subject: Re: [PATCH 1/2] tracing/syscalls: allow multiple syscall numbers per syscall
Date: Tue, 30 Aug 2016 18:30:30 -0400	[thread overview]
Message-ID: <20160830183030.3e9f67f0@gandalf.local.home> (raw)
In-Reply-To: <CALCETrWjpcKqFHvxS35Csd3An1QNMXW8yiHChuWfuWTvVu8_ig@mail.gmail.com>

On Tue, 30 Aug 2016 15:08:19 -0700
Andy Lutomirski <luto@amacapital.net> wrote:

> On Tue, Aug 30, 2016 at 3:03 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Tue, 30 Aug 2016 14:45:05 -0700
> > Andy Lutomirski <luto@amacapital.net> wrote:
> >  
> >> I wonder: could more of it be dynamically allocated?  I.e. statically
> >> generate metadata with args and name and whatever but without any nr.
> >> Then dynamically allocate the map from nr to metadata?  
> >
> > Any ideas on how to do that?  
> 
> This might be as simple as dropping the syscall_nr field from
> syscall_metadata.  I admit I'm not familiar with this code at all, but
> I'm not really sure why that field is needed.  init_ftrace_syscalls is
> already dynamically allocating an array that maps nr to metadata, and
> I don't see what in the code actually needs that mapping to be
> one-to-one or needs the reverse mapping.

The issue is that the syscall trace points are called by a single
location, that passes in the syscall_nr, and we need a way to map that
syscall_nr to the metadata.

System calls are really a meta tracepoint. They share a single real
tracepoint called raw_syscalls:sys_enter and raw_syscalls:sys_exit.
When you enable a system call like sys_enter_read, what really happens
is that the sys_enter tracepoint is attached with a function called
ftrace_syscall_enter().

This calls trace_get_syscall_nr(current, regs), to extract the actual
syscall_nr that was called. This is used to find the "file" that is
mapped to the system call (the tracefs file that enabled the system
call).

	trace_file = tr->enter_syscall_files[syscall_nr];

And the meta data (what is used to tell us what to save) is found with
the syscall_nr_to_meta() function.

Now the metadata is used to extract the arguments of the system call:

 syscall_get_arguments(current, regs, 0, sys_data->nb_args,
	etnry->args);

As well as the size needed.

There's no need to map syscall meta to nr, we need a way to map the nr
to the syscall metadata, and when there's more than a one to one
mapping, we need a way to differentiate that in the raw syscall
tracepoints.

-- Steve

  reply	other threads:[~2016-08-30 22:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  9:30 Marcin Nowakowski
2016-08-29  9:30 ` [PATCH 2/2] MIPS: set NR_syscall_tables appropriately Marcin Nowakowski
2016-09-27 12:04   ` Ralf Baechle
2016-09-28  6:58     ` Marcin Nowakowski
2016-08-29 23:55 ` [PATCH 1/2] tracing/syscalls: allow multiple syscall numbers per syscall Andy Lutomirski
2016-08-30  8:14   ` Marcin Nowakowski
2016-08-30 18:52     ` Andy Lutomirski
2016-08-30 19:29       ` Steven Rostedt
2016-08-30 19:53         ` Andy Lutomirski
2016-08-30 20:58           ` Steven Rostedt
2016-08-30 21:45             ` Andy Lutomirski
2016-08-30 22:03               ` Steven Rostedt
2016-08-30 22:08                 ` Andy Lutomirski
2016-08-30 22:30                   ` Steven Rostedt [this message]
2016-08-30 23:09                     ` Andy Lutomirski
2016-08-30 23:28                       ` Steven Rostedt
2016-08-31  0:01                         ` Andy Lutomirski
2016-08-31 14:08                           ` Marcin Nowakowski
2016-08-31  7:00                         ` Marcin Nowakowski
2016-08-31  8:24           ` Arnd Bergmann
2016-09-01 15:24             ` Steven Rostedt

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=20160830183030.3e9f67f0@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=luto@amacapital.net \
    --cc=marcin.nowakowski@imgtec.com \
    --cc=mingo@redhat.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

all inboxes | Powered by JetHome®