|
|
Subscribe / Log in / New account

Shared libraries can, and probably will, happen

Shared libraries can, and probably will, happen

Posted Apr 3, 2025 11:41 UTC (Thu) by excors (subscriber, #95769)
In reply to: Shared libraries can, and probably will, happen by anton
Parent article: Rust adopting Ferrocene Language Specification

It wasn't just "some glibc developer ... on some CPU", it was an Intel engineer (who I assume had access to expertise on how to make the most of Intel's hardware) making large improvements across multiple microarchitectures (not just from going backwards, but that was part of it):

> This patch includes optimized 64bit memcpy/memmove for Atom, Core 2 and Core i7. It improves memcpy by up to 3X on Atom, up to 4X on Core 2 and up to 1X on Core i7. It also improves memmove by up to 3X on Atom, up to 4X on Core 2 and up to 2X on Core i7.
(https://sourceware.org/git?p=glibc.git;a=commit;h=6fb8cbc...)

From the discussion on old bug reports, there's an explanation that backwards copying helped avoid false read-after-write dependencies on 2010-era Atom: the CPU only looks at the LSBs of the src/dest addresses, and may think they're overlapping (preventing reordering of accesses) when they really aren't. The code compares the low byte of the addresses to decide whether to go forwards or backwards, so the CPU can easily tell there's no overlap. (https://lists.freedesktop.org/archives/pixman/2010-August... - that was for Pixman but the glibc patch seems to do the same thing.)


to post comments

Shared libraries can, and probably will, happen

Posted Apr 13, 2025 17:35 UTC (Sun) by anton (subscriber, #25547) [Link]

Thanks, interesting. I spent too much time reading through the flame wars about the topic without coming across the information about the actual issue at hand; I dimly remember reading about doing the negative stride on Bobcat, but now that I think about it, the flame war was in 2010, and Bobcat was only launched in 2011.

So the stride direction was not only based on the actual hardware, but also on the specific bits in the addresses of source and target. This makes it even harder to find an overlap bug with testing.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds