[PATCH v13 7/7] riscv: Add and use alignment-ignorant memcpy
Evan Green
evan@rivosinc.com
Mon Mar 4 19:35:29 GMT 2024
On Mon, Mar 4, 2024 at 10:30 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 02/03/24 07:33, Andreas Schwab wrote:
> > On Feb 27 2024, Evan Green wrote:
> >
> >> For CPU implementations that can perform unaligned accesses with little
> >> or no performance penalty, create a memcpy implementation that does not
> >> bother aligning buffers. It will use a block of integer registers, a
> >> single integer register, and fall back to bytewise copy for the
> >> remainder.
> >
> > How has that been tested? It causes memory corruption.
> >
>
> The memcpy optimization has multiple issues:
>
> 1. The implementation is wrong: the chunk size calculation is wrong
> leading to invalid memory access.
>
> 2. It adds ifunc supports as default, so --disable-multi-arch does
> not work as expected for riscv.
>
> 3. It mixes Linux files (memcpy ifunc selection which requires the
> vDSO/syscall mechanism) with generic support (the memcpy
> optimization itself).
>
> 4. There is no __libc_ifunc_impl_list, which makes testing only
> check the selected implementation instead of all supported
> by the system.
>
> The 2., 3., and 4. are not really a problem since they came most likely
> from code base inexperience. However, the 1. is *really* a red
> flag since it means that you did not run a 'make check' to certify
> no regressions were found.
This is my bad. My testing for this series involved boot testing, plus
some tests I had written specifically for this, as well as
build-many-glibcs. Make check was not on my radar, and clearly should
have been. Thanks for coming in with a quick fix. I'll take a look at
what you've done and holler if I see any issues.
-Evan
More information about the Libc-alpha
mailing list