* [PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation
@ 2024-09-01 17:24 Christophe Leroy
2024-09-01 18:11 ` Jason A. Donenfeld
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2024-09-01 17:24 UTC (permalink / raw)
To: Shuah Khan, Jason A . Donenfeld
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, linux-kselftest
Without -O2, the generated code for testing chacha function is awful.
GCC even implements rol32() as a function instead of just using the
rotlwi instruction, that function is 20 instructions long.
~# time ./vdso_test_chacha
TAP version 13
1..1
ok 1 chacha: PASS
real 0m 37.16s
user 0m 36.89s
sys 0m 0.26s
Several other selftests directory add -O2, and the kernel is also
always built with optimisation active. Do the same for vDSO selftests.
With this patch the time is reduced by approx 15%.
~# time ./vdso_test_chacha
TAP version 13
1..1
ok 1 chacha: PASS
real 0m 32.09s
user 0m 31.86s
sys 0m 0.22s
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
tools/testing/selftests/vDSO/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index cfb7c281b22c..96f25aa2f84e 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -13,7 +13,7 @@ TEST_GEN_PROGS += vdso_test_correctness
TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
-CFLAGS := -std=gnu99
+CFLAGS := -std=gnu99 -O2
ifeq ($(CONFIG_X86_32),y)
LDLIBS += -lgcc_s
--
2.44.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation
2024-09-01 17:24 [PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation Christophe Leroy
@ 2024-09-01 18:11 ` Jason A. Donenfeld
0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2024-09-01 18:11 UTC (permalink / raw)
To: Christophe Leroy; +Cc: Shuah Khan, linux-kernel, linuxppc-dev, linux-kselftest
On Sun, Sep 01, 2024 at 07:24:03PM +0200, Christophe Leroy wrote:
> Without -O2, the generated code for testing chacha function is awful.
> GCC even implements rol32() as a function instead of just using the
> rotlwi instruction, that function is 20 instructions long.
>
> ~# time ./vdso_test_chacha
> TAP version 13
> 1..1
> ok 1 chacha: PASS
> real 0m 37.16s
> user 0m 36.89s
> sys 0m 0.26s
>
> Several other selftests directory add -O2, and the kernel is also
> always built with optimisation active. Do the same for vDSO selftests.
>
> With this patch the time is reduced by approx 15%.
>
> ~# time ./vdso_test_chacha
> TAP version 13
> 1..1
> ok 1 chacha: PASS
> real 0m 32.09s
> user 0m 31.86s
> sys 0m 0.22s
>
Seems reasonable. I'll queue it up.
Thanks.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-01 18:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-01 17:24 [PATCH] selftests: vDSO: Build vDSO tests with O2 optimisation Christophe Leroy
2024-09-01 18:11 ` Jason A. Donenfeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox