Re: [PATCH v2] gcov: use atomic counter updates to fix concurrent access crashes

From: Konstantin Khorenko

Date: Mon May 11 2026 - 05:43:24 EST


On 5/9/26 17:14, Arnd Bergmann wrote:
On Sat, May 9, 2026, at 13:50, Konstantin Khorenko wrote:
On 5/7/26 15:31, Peter Oberparleiter wrote:
On 28.04.2026 22:56, Arnd Bergmann wrote:

So this might actually be a GCC-16 regression in codegen rather than
an inherent architecture limitation.
....
could you please share the two .config files that triggered the link
failures (the x86_64 one with __atomic_fetch_add_8 and the aarch64 one
with __aarch64_ldadd8_relax)?
That could make my life a bit easier. :)

I've attached two configs each now, see what you find.

I just realized that these tests were still using a prerelease
compiler, so it's even possible that the gcc-16.1 release is
clean. I should build the next set of cross-compilers soon,
and will be able to retest then.

Hi Arnd,

thank you for sending those configs.

All 4 previously failing configs were successfully built with the new patch applied
(on top of 5d6919055dec (tag: v7.1-rc3, origin/master, origin/HEAD) Linux 7.1-rc3):

* 0x5AB716A4 - arm64, UP (no SMP), GCOV_PROFILE_URING + GCOV_PROFILE_RDS: build OK
(make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-)
* 0xD01A6C73 - x86_32 (i386), SMP, GCOV_PROFILE_URING + GCOV_PROFILE_RDS: build OK
(make ARCH=i386)
* 0xD21DABF - arm64, UP (no SMP), GCOV_PROFILE_URING: build OK
* 0xFE5738DD - x86_32 (i386), UP (no SMP), GCOV_PROFILE_URING + GCOV_PROFILE_FTRACE: build OK

Previously these configs failed at link stage with undefined references to __aarch64_ldadd8_relax (arm64) and __atomic_fetch_add_8 (x86_32), caused by 64-bit atomic operations inserted by GCOV instrumentation. The new patch resolves all of these.

Note: the original failures were reported with gcc-16.0.1.2-nolibc cross toolchain;
my test builds used gcc-12.1.1 (aarch64-linux-gnu) and gcc-11.4.1 (x86),
but i really think this does not matter here:
i've checked in all 4 cases -fprofile-update=prefer-atomic was not used - try-run fence worked fine.

And when i've built the 0xD01A6C73-config switched to x86_64 (# CONFIG_X86_32 is not set, CONFIG_X86_64=y and CONFIG_64BIT=y), the build passed and -fprofile-update=prefer-atomic was used.

--
Thank you,
Konstantin