Re: Unaligned access trade-offs for SFrame FRE layout

Segher Boessenkool <[email protected]> Mon, 15 Sep 2025 12:22:11 -0500
Newsgroups org.kernel.vger.linux-toolchains
Message-ID <aMhLQ8EgRba8B_XY@gate>
On Mon, Sep 15, 2025 at 12:07:42PM -0400, Steven Rostedt wrote:
> On Sun, 14 Sep 2025 22:42:46 -0700
> Indu Bhagat <[email protected]> wrote:
> 
> > In such cases, the routines reading the SFrame data under consideration 
> > here (SFrame FRE start addr, and SFrame FRE stack offsets) from memory 
> > will need to use a memcpy to copy out the data to an aligned location.
> > 
> > In GNU Binutils libsframe (used by ld), we do the above. Such a "SFrame 
> > FRE decoding" routine could be provided in a arch-specific manner in 
> > SFrame stack tracers.
> 
> I'm perfectly fine with making it a requirement for the reader of the
> SFrame section having to use memcpy into an aligned structure for reading
> if the architecture requires it. Let only the architectures that have
> issues with unaligned access take the performance hit.

Constructing the bigger value from a whole bunch of byte reads should be
pretty optimal, too.  Just don't force misaligned bigger reads, not even
on platforms where that *does* work (not all!), it might well be really,
really slow.


Segher