[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc895e8c-5dd5-4207-bb35-58e6b923b7bc@csgroup.eu>
Date: Tue, 17 Jun 2025 11:13:26 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Eric Biggers <ebiggers@...nel.org>
Cc: Ian Rogers <irogers@...gle.com>, Yuzhuo Jing <yuzhuo@...gle.com>,
Andy Lutomirski <luto@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Arnaldo Carvalho de Melo <acme@...hat.com>, Al Viro
<viro@...iv.linux.org.uk>, "Jason A. Donenfeld" <Jason@...c4.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v1 1/3] vdso: Switch get/put unaligned from packed struct
to memcpy
+linuxppc list
Le 17/06/2025 à 08:32, Eric Biggers a écrit :
> On Tue, Jun 17, 2025 at 07:22:57AM +0200, Christophe Leroy wrote:
>>
>>
>> Le 17/06/2025 à 02:57, Ian Rogers a écrit :
>>> Type punning is necessary for get/put unaligned but the use of a
>>> packed struct violates strict aliasing rules, requiring
>>> -fno-strict-aliasing to be passed to the C compiler. Switch to using
>>> memcpy so that -fno-strict-aliasing isn't necessary.
>>
>> VDSO build fails with this patch:
>>
>> VDSO32L arch/powerpc/kernel/vdso/vdso32.so.dbg
>> arch/powerpc/kernel/vdso/vdso32.so.dbg: dynamic relocations are not
>> supported
>> make[2]: *** [arch/powerpc/kernel/vdso/Makefile:79:
>> arch/powerpc/kernel/vdso/vdso32.so.dbg] Error 1
>>
>> Behind the relocation issue, calling memcpy() for a single 4-bytes word
>> kills performance.
>
> memcpy() does normally do the right thing for unaligned accesses of 1, 2, 4, or
> 8-byte values. The snag here seems to be that the VDSO is built with
> -fno-builtin (and -ffreestanding which implies -fno-builtin). That causes the
> compiler to no longer optimize out the calls to memcpy(). If __builtin_memcpy()
> is used instead of memcpy(), it does work and generates the same code as before.
Yes right, changing memcpy() to __builtin_memcpy() seems to work, the
exact same code is generated.
Christophe
Powered by blists - more mailing lists