public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: Fangrui Song <i@maskray.me>
Cc: binutils@sourceware.org
Subject: Re: [PATCH,V1 00/14] Definition and support for SFrame unwind format
Date: Fri, 30 Sep 2022 17:15:15 -0700	[thread overview]
Message-ID: <cace1a4a-e134-6474-9e78-3a009d54e9ad@oracle.com> (raw)
In-Reply-To: <20220930082414.2irpxfedprm6xdsj@gmail.com>

On 9/30/22 01:24, Fangrui Song wrote:
> On 2022-09-29, Indu Bhagat via Binutils wrote:
>> What is SFrame format and why do we need it
>> -------------------------------------------
>> SFrame format is the Simple Frame format.  It can be used to represent 
>> the
>> minimal necessary information for backtracing.  As such, it only 
>> encodes how to
>> recover the CFA (based on SP/FP) and the return address (RA) for all
>> instructions of a program.
>>
>> The format is supported on AMD64 and AARCH64 ABIs only.  The 
>> information stored
>> in the .sframe section is a subset of what .eh_frame can convey: 
>> .eh_frame can
>> convey how to resurrect all callee-saved registers, if need be; but 
>> .sframe
>> does not.
>>
>> SFrame format is intended for usecases where fast virtual stack unwind is
>> needed, along with a need for a small simple unwinder. So, those 
>> applications
>> which struggle with the following two complaints will want to consider 
>> SFrame
>> format:
>>  - EH Frame based unwinders are complex and slow to manage with
>>  - EH Frame based unwinders are large as they need to deal with DWARF
>>  opcodes via a stack machine implementation
>>
>> More details about the format are available in include/sframe.h, 
>> please see
>> commit "sframe.h: Add SFrame format definition".
>>
>> Our not-so-exhaustive experiments (basically binutils programs built with
>> -Wa,--gsframe) show that SFrame/EH Frame section ratio to be an 
>> average of 0.8x
>> for x86_64 and 0.7x for aarch64.
> 
> For an executable with 1000KiB .eh_frame, .sframe takes 800KiB?
> Does SFrame has something similar to .eh_frame_hdr and what is the size
> comparison? The saving isn't apealing in my view.
> 

Small correction - For an executable with 1000KiB of 
.eh_frame+.eh_frame_hdr sections, .sframe takes 800KiB.

Yes, SFrame has something similar to .eh_frame_hdr.  The SFrame FDE 
(Function Descriptor Entries) are sorted on start PC by the linker 
before writing out the .sframe section.

Re: size comparison of the index in SFrame vs .eh_frame_hdr - The size 
numbers I quote is the ratio of .sframe/(.eh_frame + .eh_frame_hdr) size 
for binutils programs. As SFrame FDEs contain more information than the 
individual entry in the .eh_frame_hdr, I don't know if this comparison 
will fetch us much insight.

Re : space saving appeal - SFrame's "reason for existence" is to allow 
fast unwinding while using a simple unwinder. The stack offsets, for 
example, are encoded directly rather than being calculated at the time 
of backtracing.  Such a representation will need more space when 
compared to the opcode-based encoding in EH Frame format in isolation. 
That said, there might be some more optimization opportunities to 
explore for reducing the size of SFrame further.

> Have you tried removing callee-saved register information from
> .eh_frame?
> 

I haven't tried this yet. BTW, other folks also were curious about this 
at Cauldron.

This keeps getting pushed lower on my task list, however, because the 
outcome of the experiment does not change the fact that there are 
applications where fast, plain vanilla backtracing is needed using a 
simple backtracer. Such a comparison can be informative though, I see that.

> Has SFrame be compared with macOS compact unwind descriptors, Windows
> ARM64 exception handling, MIPS compact exception tables (their .eh_frame
> counterpart, not the .gcc_except_table counterpart)?

I havent looked at them closely enough to offer a meaningful comparison 
at this time. I will take a second look.

Thanks

  reply	other threads:[~2022-10-01  0:15 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  8:04 [PATCH,V6 00/10] Definition and Implementation of CTF Frame format Indu Bhagat
2022-08-02  8:04 ` [PATCH,V6 01/10] ctf-frame.h: Add CTF Frame format definition Indu Bhagat
2022-08-15 12:04   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 02/10] gas: add new command line option --gctf-frame Indu Bhagat
2022-08-15 12:07   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 03/10] gas: generate .ctf_frame Indu Bhagat
2022-08-15 12:22   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 04/10] libctfframe: add the CTF Frame library Indu Bhagat
2022-08-15 12:46   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 05/10] libctfframe: add GNU poke pickles for CTF Frame Indu Bhagat
2022-08-15 12:50   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 06/10] bfd: linker: merge .ctf_frame sections Indu Bhagat
2022-08-15 13:02   ` Nick Clifton
2022-08-18  2:11     ` Indu Bhagat
2022-08-02  8:04 ` [PATCH,V6 07/10] readelf/objdump: support for CTF Frame section Indu Bhagat
2022-08-15 13:11   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 08/10] unwinder: generate backtrace using CTF Frame format Indu Bhagat
2022-08-15 13:16   ` Nick Clifton
2022-08-02  8:04 ` [PATCH,V6 09/10] unwinder: Add CTF Frame unwinder tests Indu Bhagat
2022-08-15 13:27   ` Nick Clifton
2022-08-02  8:04 ` [PATCH, V6 10/10] gdb: sim: buildsystem changes to accommodate libctfframe Indu Bhagat
2022-08-05 14:43   ` Tom Tromey
2022-08-15 12:18 ` [PATCH,V6 00/10] Definition and Implementation of CTF Frame format Nick Clifton
2022-08-18  1:38   ` Indu Bhagat
2022-08-15 14:25 ` Nick Clifton
2022-09-30  0:04   ` [PATCH,V1 00/14] Definition and support for SFrame unwind format Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 01/14] sframe.h: Add SFrame format definition Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 02/14] gas: add new command line option --gsframe Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 03/14] gas: generate .sframe from CFI directives Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 04/14] gas: testsuite: add new tests for SFrame unwind info Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 05/14] libsframe: add the SFrame library Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 06/14] bfd: linker: merge .sframe sections Indu Bhagat
2022-09-30 10:51       ` Nick Clifton
2022-09-30  0:04     ` [PATCH,V1 07/14] readelf/objdump: support for SFrame section Indu Bhagat
2022-09-30 11:08       ` Nick Clifton
2022-09-30  0:04     ` [PATCH,V1 08/14] unwinder: generate backtrace using SFrame format Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 09/14] unwinder: Add SFrame unwinder tests Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 10/14] gdb: sim: buildsystem changes to accommodate libsframe Indu Bhagat
2022-10-11 16:08       ` [PATCH, V1 " Tom Tromey
2022-09-30  0:04     ` [PATCH,V1 11/14] libctf: add libsframe to LDFLAGS and LIBS Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 12/14] src-release.sh: Add libsframe Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 13/14] binutils/NEWS: add text for SFrame support Indu Bhagat
2022-09-30  0:04     ` [PATCH,V1 14/14] gas/NEWS: add text about new command line option and " Indu Bhagat
2022-09-30  8:09     ` [PATCH,V1 00/14] Definition and support for SFrame unwind format Jan Beulich
2022-10-04  5:16       ` Indu Bhagat
2022-10-04  6:53         ` Jan Beulich
2022-09-30  8:24     ` Fangrui Song
2022-10-01  0:15       ` Indu Bhagat [this message]
2022-09-30  9:12     ` Nick Clifton
2022-10-01  0:29       ` Indu Bhagat
2022-10-01  9:51       ` Jose E. Marchesi

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=cace1a4a-e134-6474-9e78-3a009d54e9ad@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    /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).