public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Indu Bhagat <indu.bhagat@oracle.com>
Cc: Fangrui Song <maskray@sourceware.org>,
	Binutils <binutils@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>, Michael Matz <matz@suse.de>,
	Matthias Klose <doko@debian.org>,
	Sterling Augustine <saugustine@google.com>,
	Pavel Labath <labath@google.com>, Sam James <sam@gentoo.org>,
	amonakov@ispras.ru
Subject: Re: GNU Tools Cauldron SFrame talk notes
Date: Fri, 10 Oct 2025 10:06:25 -0400	[thread overview]
Message-ID: <20251010100625.486e7044@gandalf.local.home> (raw)
In-Reply-To: <27f8361c-bef3-4657-a0eb-91a716abd345@oracle.com>

On Fri, 10 Oct 2025 01:09:00 -0700
Indu Bhagat <indu.bhagat@oracle.com> wrote:

> 
> Hi Fangrui,
> 
> Kernel relocatable files is not the sole reason of the design choice of 
> having an index.  Without an index, stacktracers will have a run-time 
> hit of parsing the section to create an index or resorting to linear 
> scan; neither of these is acceptable for performance reasons.
> 
> > The fundamental design issue lies in making linker merging mandatory.
> > For optimal portability, unwinders should support multiple-element
> > structures within a .sframe section. When a linker builds an index for
> > .sframe, it should be viewed as an optimization that relieves the
> > unwinder from constructing its own index at runtime. This index
> > construction should remain optional rather than required. While the
> > SFRAME_F_FDE_SORTED flag can be cleared to permit unsorted FDEs,
> > current unwinder implementations do not seem to support multiple
> > elements in a single section.
> >   
> 
> Constructing index at runtime will hurt.  Kernel's stacktracing of 
> userspace stacks will be done on the return to user path, and cannot 
> take that sort of performance hit.

Question:

Each object being linked would have a sorted sframe table, correct?

It's just that if the linker doesn't know what an sframe is, it would just
concatenate all the sections placing several sorted sections together but
the whole is not sorted?

> 
> Its not just the kernel, building the index at run-time will hurt _all_ 
> other profiling and debugging use-cases where fast stack traces are 
> desirable.
> 

Is it possible to have the sframe header denote this? That is, if the
linker knows about sframes, it would sort the entire section and set a flag
in the sframe header that it is sorted. If not, then the kernel and other
profilers could implement a slow path. Where at first read, it would create
a secondary table of each sorted section, and sort that. This table would
likely need to be allocated per task. We could possibly attach it to the
inode of the executable so that if there's more than one instance of it
running, they would all use the same table.

Then for searching the FDE via the instruction pointer, it would first look
at the created outer table (which would be in sorted format such that it
still can do a binary search) and then do a binary search of the inner table.

Yes, this may be more work on the reader of the sframe sections, but if
this will simplify the linker side, it could be worth it.

-- Steve

  reply	other threads:[~2025-10-10 14:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 23:14 Indu Bhagat
2025-10-09  6:20 ` Fangrui Song
2025-10-10  8:09   ` Indu Bhagat
2025-10-10 14:06     ` Steven Rostedt [this message]
2025-10-12 19:25       ` Indu Bhagat
2025-10-10 16:50     ` Fangrui Song
2025-10-12 19:42       ` Indu Bhagat
2025-10-12 20:25         ` Fangrui Song
2025-10-15 19:39           ` Indu Bhagat
2025-10-15 20:03             ` Sterling Augustine
2025-10-16  8:03             ` Fangrui Song
2025-10-16  8:13               ` Florian Weimer
2025-10-18 17:34                 ` Fangrui Song
2025-10-23 21:40                   ` Indu Bhagat
2025-10-24  7:35                     ` Fangrui Song
2025-11-04 11:41                       ` Florian Weimer
2025-10-20 19:57               ` Indu Bhagat
2025-10-21  6:31                 ` Fangrui Song
2025-10-21 12:15                   ` Jose E. Marchesi
2025-10-22 13:45                   ` Tatsuyuki Ishi
2025-10-23 21:47                   ` Indu Bhagat
2025-10-24  6:19                     ` Fangrui Song
2025-10-24 15:10 ` Tatsuyuki Ishi
2025-10-25 12:46   ` Jose E. Marchesi
2025-10-29  8:33     ` Indu Bhagat
2025-10-29  5:37   ` Indu Bhagat

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=20251010100625.486e7044@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=amonakov@ispras.ru \
    --cc=binutils@sourceware.org \
    --cc=doko@debian.org \
    --cc=fweimer@redhat.com \
    --cc=indu.bhagat@oracle.com \
    --cc=labath@google.com \
    --cc=maskray@sourceware.org \
    --cc=matz@suse.de \
    --cc=sam@gentoo.org \
    --cc=saugustine@google.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 read-only IMAP folder(s) and NNTP newsgroup(s).