public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/5154] aux_syscalls lookup tables needlessly included
       [not found] <bug-5154-6586@http.sourceware.org/bugzilla/>
@ 2014-02-13 15:02 ` dsmith at redhat dot com
  2014-03-20 17:48 ` dsmith at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2014-02-13 15:02 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=5154

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsmith at redhat dot com
         Resolution|---                         |FIXED

--- Comment #1 from David Smith <dsmith at redhat dot com> ---
From looking at tapset/linux/aux_syscalls.stp, it looks like this work has been
done, so I'm closing this one.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/5154] aux_syscalls lookup tables needlessly included
       [not found] <bug-5154-6586@http.sourceware.org/bugzilla/>
  2014-02-13 15:02 ` [Bug runtime/5154] aux_syscalls lookup tables needlessly included dsmith at redhat dot com
@ 2014-03-20 17:48 ` dsmith at redhat dot com
  2014-03-20 17:59 ` jistone at redhat dot com
  2014-03-20 18:10 ` dsmith at redhat dot com
  3 siblings, 0 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2014-03-20 17:48 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=5154

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #2 from David Smith <dsmith at redhat dot com> ---
From looking at pass 3 output, the lookup tables are still being needlessly
included. The *functions* are marked as pure (and get elided when not used),
but the lookup tables themselves are always included.

Here's what the code looks like:

====
# ...

%{
static const _stp_val_array const _stp_XXXX_list[] = {
    V(XXX_1),
    V(XXX_2),
    {0, NULL}
};
%}

function _XXXX_str:string(val:long)
%{ /* pure */
    _stp_lookup_str(_stp_XXXX_list, STAP_ARG_val, STAP_RETVALUE,
            MAXSTRINGLEN);
%}
====

Here the translator can know that _XXXX_str() isn't used and elide it. However,
it can't really know that that embedded-C block above it is used or unused, so
it always includes it.

One possible solution here would be to move the lookup table inside the
function, but still static. The lookup table would need to be static so it
wouldn't be put on the limited kernel stack. In this scenario, if the
translator elides the function, it would automatically elide the lookup table.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/5154] aux_syscalls lookup tables needlessly included
       [not found] <bug-5154-6586@http.sourceware.org/bugzilla/>
  2014-02-13 15:02 ` [Bug runtime/5154] aux_syscalls lookup tables needlessly included dsmith at redhat dot com
  2014-03-20 17:48 ` dsmith at redhat dot com
@ 2014-03-20 17:59 ` jistone at redhat dot com
  2014-03-20 18:10 ` dsmith at redhat dot com
  3 siblings, 0 replies; 4+ messages in thread
From: jistone at redhat dot com @ 2014-03-20 17:59 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=5154

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jistone at redhat dot com

--- Comment #3 from Josh Stone <jistone at redhat dot com> ---
When not used, do the tables actually survive through compilation?  For
unreferenced static const data, I'd expect gcc would just drop them.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/5154] aux_syscalls lookup tables needlessly included
       [not found] <bug-5154-6586@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-03-20 17:59 ` jistone at redhat dot com
@ 2014-03-20 18:10 ` dsmith at redhat dot com
  3 siblings, 0 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2014-03-20 18:10 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=5154

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from David Smith <dsmith at redhat dot com> ---
(In reply to Josh Stone from comment #3)
> When not used, do the tables actually survive through compilation?  For
> unreferenced static const data, I'd expect gcc would just drop them.

Good question. It looks like you are correct, gcc is discarding that data. See
the following:

====
# stap -p3 -e 'probe begin { println(_mmap_flags(0)); exit() }' | egrep
_stp_.+_list
static const _stp_val_array const _stp_sockopt_level_list[] = {
static const _stp_val_array const _stp_signal_list[] = {
    const _stp_val_array * const array = _stp_signal_list;
static const _stp_val_array const _stp_semctl_list[] = {
static const _stp_val_array const _stp_fork_list[] = {
static const _stp_val_array const _stp_atflag_list[] = {
static const _stp_val_array const _stp_shmat_list[] = {
static const _stp_val_array const _stp_mprotect_list[] = {
static const _stp_val_array const _stp_mmap_list[] = {
  static const _stp_val_array const _stp_sa_handler_list[] = {
  static const _stp_val_array const _stp_sa_flags_list[] = {
  _stp_lookup_str(_stp_sa_handler_list, (long)act->sa_handler,
      _stp_lookup_or_str(_stp_sa_flags_list, act->sa_flags, ptr, len);
static const _stp_val_array const _stp_irq_list[] = {
    _stp_lookup_or_str(_stp_mmap_list, STAP_ARG_flags, STAP_RETVALUE,
MAXSTRINGLEN);
#  stap -m test -p4 -e 'probe begin { println(_mmap_flags(0)); exit() }'
test.ko
# nm test.ko | egrep _stp_.+_list
0000000000000100 r _stp_mmap_list
====

From the above output, the source (-p3 output) contained ~15 lookup tables. But
the final module only contained the one actually used.

I'll reclose this one.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-20 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-5154-6586@http.sourceware.org/bugzilla/>
2014-02-13 15:02 ` [Bug runtime/5154] aux_syscalls lookup tables needlessly included dsmith at redhat dot com
2014-03-20 17:48 ` dsmith at redhat dot com
2014-03-20 17:59 ` jistone at redhat dot com
2014-03-20 18:10 ` dsmith at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).