linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ian Munsie <imunsie@au1.ibm.com>,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <michael@ellerman.id.au>,
	Ingo Molnar <mingo@elte.hu>, Lai Jiangshan <laijs@cn.fujitsu.com>,
	Masami Hiramatsu <mhiramat@redhat.com>
Subject: Re: [PATCH 08/40] tracing: remove syscall bitmaps in preparation for compat support
Date: Wed, 23 Jun 2010 15:34:56 -0400	[thread overview]
Message-ID: <20100623193455.GE2680@redhat.com> (raw)
In-Reply-To: <20100623191454.GC2680@redhat.com>

On Wed, Jun 23, 2010 at 03:14:54PM -0400, Jason Baron wrote:
> On Wed, Jun 23, 2010 at 11:16:44AM -0400, Steven Rostedt wrote:
> > On Wed, 2010-06-23 at 20:02 +1000, Ian Munsie wrote:
> > > From: Jason Baron <jbaron@redhat.com>
> > > 
> > > In preparation for compat syscall tracing support, let's store the enabled
> > > syscalls, with the struct syscall_metadata itself. That way we don't duplicate
> > > enabled information when the compat table points to an entry in the regular
> > > syscall table. Also, allows us to remove the bitmap data structures completely.
> > > 
> > > Signed-off-by: Jason Baron <jbaron@redhat.com>
> > > Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> > > ---
> > >  include/linux/syscalls.h      |    8 +++++++
> > >  include/trace/syscall.h       |    4 +++
> > >  kernel/trace/trace_syscalls.c |   42 +++++++++++++++++++---------------------
> > >  3 files changed, 32 insertions(+), 22 deletions(-)
> > > 
> > > diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> > > index 86f082b..755d05b 100644
> > > --- a/include/linux/syscalls.h
> > > +++ b/include/linux/syscalls.h
> > > @@ -163,6 +163,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
> > >  		.nb_args 	= nb,				\
> > >  		.types		= types_##sname,		\
> > >  		.args		= args_##sname,			\
> > > +		.ftrace_enter	= 0,				\
> > > +		.ftrace_exit	= 0,				\
> > > +		.perf_enter	= 0,				\
> > > +		.perf_exit	= 0,				\
> > 
> > I really hate this change!
> > 
> > You just removed a nice compressed bitmap (1 bit per syscall) to add 4
> > bytes per syscall. On my box I have 308 syscalls being traced. That was
> > 308 bits per bitmask = 39 bytes * 2 = 78 * 2 (perf and ftrace) = 156.
> > 
> > Now we have 8 bytes per syscall (enter and exit), which is 1232 bytes.
> > 
> > Thus this change added 1076 bytes.
> > 
> > This may not seem as much, but the change is not worth 1K. Can't we just
> > add another bitmask or something for the compat case?
> > 
> > I also hate the moving of ftrace and perf internal data to an external
> > interface.
> > 
> > -- Steve
> > 
> 
> I made this change (I also wrote the original bitmap), b/c compat
> syscalls can share "regular" syscalls. That is the compat syscall table
> points to syscalls from non-compat mode. (looking at ia32 on x86 it
> looks like at least half).
> 
> Thus, if we continue along the bitmap path, we would have to introduce
> another 4 bitmaps for compat. 2 for enter and exit and 2 for perf and
> ftrace. Thus, using your math above: 39 bytes * 8 = 312 bytes. So
> approximately 1 byte per system call.
> 
> Instead, if we store this data in the syscall metadata, we actually only
> need 4 bits per syscall. Now, the above implementation uses 4 chars,
> where we really only need 1 char (or really 4 bits, which we could
> eventually store in the last last bit of the four existing pointer
> assuming they are 2 byte aligned for no increased storage space at all).
> But even assuming we use 1 byte per system call we are going to have in
> the worse case the above 312 bytes + (1 byte * # of non-shared compat
> syscalls). So, yes we might need a little more storage in this scheme.
> Another consideration too, is obviously the alignment of
> syscall_metadata, since the extra 1 byte, might be more...
> 
> However, we don't have to compute the location of the bits in the
> compat syscall map each time a tracing syscall is enable/disable. This
> would be more expensive, especially if we don't store the compat syscall
> number with each syscall meta data structure (which you have proposed
> dropping). So with compat syscalls, we are setting two bit locations
> with each enable/disable instead of 1 with this new scheme.
> 
> Also, I think the more important reason to store these bits in the
> syscall meta data structure is simplicity. Not all arches start their tables
> counting from 0 (requiring a constant shift factor), and obviously we
> waste bits for non-implemented syscalls. I don't want to have to deal
> with these arch specific implementation issues, if I don't need to.
> 
> thanks,
> 
> -Jason
> 

Actually, looking at this further, what we probably want to do change
the "int nb_args" field, which is already in syscall_metadata into a bit
field. nb_args I think can be at most 6, or 3 bits, and we only need 4
bits for storing the enabled/disabled data, so we could even make it a
char. Thus, actually saving space with this patch :) (at least as far as
the syscall_metadata field is concerned).

thanks,

-Jason

  reply	other threads:[~2010-06-23 19:35 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 10:02 ftrace syscalls, PowerPC: Various fixes, Compat Syscall support and PowerPC implementation, V2 Ian Munsie
2010-06-23 10:02 ` [PATCH 01/40] ftrace syscalls: don't add events for unmapped syscalls Ian Munsie
2010-06-23 15:02   ` Steven Rostedt
2010-06-29  1:18     ` Ian Munsie
2010-06-23 10:02 ` [PATCH 02/40] ftrace syscalls: Make arch_syscall_addr weak Ian Munsie
2010-06-23 10:02 ` [PATCH 03/40] ftrace syscalls: Allow arch specific syscall symbol matching Ian Munsie
2010-06-23 10:02 ` [PATCH 04/40] trace, powerpc: Implement raw syscall tracepoints on PowerPC Ian Munsie
2010-06-23 10:02 ` [PATCH 05/40] x86: add NR_syscalls_compat, make ia32 syscall table visible Ian Munsie
2010-06-23 10:02 ` [PATCH 06/40] x86: add arch_compat_syscall_addr() Ian Munsie
2010-06-23 10:02 ` [PATCH 08/40] tracing: remove syscall bitmaps in preparation for compat support Ian Munsie
2010-06-23 15:16   ` Steven Rostedt
2010-06-23 19:14     ` Jason Baron
2010-06-23 19:34       ` Jason Baron [this message]
2010-06-23 19:45         ` Steven Rostedt
2010-06-23 10:02 ` [PATCH 09/40] tracing: move __start_ftrace_events and __stop_ftrace_events to header file Ian Munsie
2010-06-23 10:02 ` [PATCH 10/40] tracing: add tracing support for compat syscalls Ian Munsie
2010-06-23 15:26   ` Steven Rostedt
2010-06-23 16:02     ` Frederic Weisbecker
2010-06-23 10:02 ` [PATCH 11/40] syscalls: add ARCH_COMPAT_SYSCALL_DEFINE() Ian Munsie
2010-06-23 10:02 ` [PATCH 12/40] x86, compat: convert ia32 layer to use Ian Munsie
2010-06-23 10:14   ` Christoph Hellwig
2010-06-23 10:36     ` Frederic Weisbecker
2010-06-23 10:46       ` Christoph Hellwig
2010-06-23 11:41         ` Frederic Weisbecker
2010-06-23 19:23           ` H. Peter Anvin
2010-06-24 14:37             ` Christoph Hellwig
2010-06-23 10:02 ` [PATCH 13/40] syscalls: add new COMPAT_SYSCALL_DEFINE#N() macro Ian Munsie
2010-06-23 10:02 ` [PATCH 14/40] compat: convert to use COMPAT_SYSCALL_DEFINE#N() Ian Munsie
2010-06-23 10:02 ` [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Ian Munsie
2010-06-23 10:02 ` [PATCH 16/40] tags: recognize compat syscalls Ian Munsie
2010-06-24 12:02   ` Michal Marek
2010-06-23 10:02 ` [PATCH 17/40] tracing: make a "compat_syscalls" tracing subsys Ian Munsie
2010-06-23 10:02 ` [PATCH 18/40] compat_syscalls: introduce CONFIG_COMPAT_FTRACE_SYSCALLS Ian Munsie
2010-06-23 10:03 ` [PATCH 19/40] trace syscalls: Remove redundant syscall_nr checks Ian Munsie
2010-06-23 10:03 ` [PATCH 20/40] trace syscalls: Considder compat_syscall_nr when verifying syscall_nr Ian Munsie
2010-06-23 10:03 ` [PATCH 21/40] trace syscalls, PPC: Add ftrace compat syscall support for PPC64 Ian Munsie
2010-06-23 10:03 ` [PATCH 22/40] trace syscalls, PPC: Convert syscalls to SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 23/40] trace syscalls, PPC: Convert ppc32 compat syscalls to COMPAT_SYSCALL Ian Munsie
2010-06-23 10:03 ` [PATCH 24/40] trace syscalls, PPC: Convert more " Ian Munsie
2010-06-23 10:03 ` [PATCH 25/40] trace syscalls: Refactor syscall metadata creation Ian Munsie
2010-06-23 10:03 ` [PATCH 26/40] trace syscalls, PPC: Add PPC_REGS_SYSCALL_DEFINE macros Ian Munsie
2010-06-23 10:03 ` [PATCH 27/40] trace syscalls: Add COMPAT_SYSCALL_DEFINE0 macro Ian Munsie
2010-06-23 10:03 ` [PATCH 28/40] trace syscalls, PPC: Convert syscalls using regs to REGS_SYSCALL_DEFINE macros Ian Munsie
2010-06-23 10:03 ` [PATCH 29/40] trace syscalls, PPC: Convert ppc32_ syscalls to ARCH_COMPAT_SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 30/40] trace syscalls: Convert remaining kernel/compat.c syscalls to COMPAT_SYSCALL_DEFINE Ian Munsie
2010-06-23 10:03 ` [PATCH 33/40] trace syscalls: Infrastructure for syscalls different return types Ian Munsie
2010-06-23 10:03 ` [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type Ian Munsie
2010-06-23 10:03 ` [PATCH 35/40] trace syscalls, PPC: Convert PPC syscalls without long return types Ian Munsie
2010-06-23 10:03 ` [PATCH 36/40] trace syscalls: Early terminate search for sys_ni_syscall Ian Munsie
2010-06-23 10:03 ` [PATCH 37/40] trace syscalls: Print out unmapped syscalls at boot Ian Munsie
2010-06-23 10:03 ` [PATCH 38/40] trace syscalls: Remove redundant test for unmapped compat syscalls Ian Munsie
2010-06-23 10:03 ` [PATCH 39/40] trace syscalls: Clean confusing {s,r,}name and fix ABI breakage Ian Munsie
2010-06-23 18:03   ` Jason Baron
2010-06-29  1:02     ` Ian Munsie
2010-06-23 10:03 ` [PATCH 40/40] trace syscalls, PPC: Convert morphing native/compat syscalls Ian Munsie
     [not found] ` <1277287401-28571-32-git-send-email-imunsie@au1.ibm.com>
     [not found]   ` <4C21DFBA.2070202@linux.intel.com>
     [not found]     ` <20100623102931.GB5242@nowhere>
     [not found]       ` <4C21E3F8.9000405@linux.intel.com>
2010-06-24 12:05         ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Michal Marek

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=20100623193455.GE2680@redhat.com \
    --to=jbaron@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=fweisbec@gmail.com \
    --cc=imunsie@au1.ibm.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mhiramat@redhat.com \
    --cc=michael@ellerman.id.au \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).