Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
selftests: vDSO: build tests with O2 optimization
Browse files Browse the repository at this point in the history
Without -O2, the generated code for testing chacha function is awful.
GCC even implements rol32() as a function of 20 instructions instead of
just using the rotlwi instruction.

	~# 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 approximately 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 <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
  • Loading branch information
chleroy authored and zx2c4 committed Sep 13, 2024
1 parent 18efd0b commit ecb8bd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/vDSO/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
endif

CFLAGS := -std=gnu99
CFLAGS := -std=gnu99 -O2

ifeq ($(CONFIG_X86_32),y)
LDLIBS += -lgcc_s
Expand Down

0 comments on commit ecb8bd7

Please sign in to comment.