This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: aux-syscalls change


On Thu, 2007-09-27 at 14:21 -0400, Frank Ch. Eigler wrote:
> Hi -
> 
> I am a bit surprised by the subject patch (commit fd6324c).  Amongst
> its effects is to always include these lookup tables in a generated
> object code, if any other part of aux_syscalls is being called.

Yes, but they are small. And they save space overall.

> Algorithmically, it replaces a linear sequence of script if/thens with
> a C linear search.

Which saves some space.  

> What aspect of the previous code did you deem unacceptable?  Why not
> just use ordinary script-level lookup tables instead of yet more C
> code?

My intent was not to create more embedded C, it was to replace a bunch
of different embedded C with 2 well-tested functions.  The patch
replaces 3 embedded C functions and 4 script functions with the 2 new
functions and some lookup tables.  When compiling sys.stp from the
testsuite, this saved 12Kbytes in code size for the module.

Why use embedded C instead of scripts?  Because the values we need to
lookup are sometimes architecture or OS version dependent. And sometimes
we need to do these lookups from other embedded C functions. For
example, look at the old sources for get_mmap_args in aux_syscalls.
Ignoring the fact that the struct is incorrect and gives the wrong
results, and the sprintf() is almost certain to overflow, you can see
that the prot and mmap flags had to be decoded, despite there already
being functions that did the same thing.

I'm certainly open to suggestions on how to improve this.  Ultimately
I'd like to see most of the syscall tapset go away.  Why can't something
like $argstr be generated automatically? If there is an arg "struct
timeval __user *tvp" and a script tries to print $tvp, could it not
automatically be copied from userspace and decoded?  Decoding flags and
special values could not be automatically done, unless we somehow tag
them in specific functions. But if we rename and clean up a bit, it
should be easy for users to do something like print(fork_flags($flags))
if they want.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]