Re: [PATCH bpf-next] tools/bpf: turn on llvm alu32 attribute by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 21, 2019 at 7:32 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> llvm alu32 was introduced in llvm7:
>   https://reviews.llvm.org/rL325987
>   https://reviews.llvm.org/rL325989
> Experiments showed that in general performance
> is better with alu32 enabled:
>   https://lwn.net/Articles/775316/
>
> This patch turned on alu32 with no-flavor test_progs
> which is tested most often. The flavor test at
> no_alu32/test_progs can be used to test without
> alu32 enabled. The Makefile check for whether
> llvm supports '-mattr=+alu32 -mcpu=v3' is
> removed as llvm7 should be available for recent
> distributions and also latest llvm is preferred
> to run bpf selftests.
>
> Note that jmp32 is checked by -mcpu=probe and
> will be enabled if the host kernel supports it.
>
> Cc: Jiong Wang <jiong.wang@xxxxxxxxxxxxx>
> Cc: Andrii Nakryiko <andriin@xxxxxx>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---

Sounds good to me, see minor nit below.

Acked-by: Andrii Nakryiko <andriin@xxxxxx>

>  tools/testing/selftests/bpf/Makefile | 26 ++++++++------------------
>  1 file changed, 8 insertions(+), 18 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 4ff5f4aada08..5a0bca2802fe 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -32,15 +32,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
>         test_netcnt test_tcpnotify_user test_sock_fields test_sysctl test_hashmap \
>         test_cgroup_attach xdping
>
> -# Also test sub-register code-gen if LLVM has eBPF v3 processor support which
> -# contains both ALU32 and JMP32 instructions.
> -SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
> -                       $(CLANG) -target bpf -O2 -emit-llvm -S -x c - -o - | \
> -                       $(LLC) -mattr=+alu32 -mcpu=v3 2>&1 | \
> -                       grep 'if w')
> -ifneq ($(SUBREG_CODEGEN),)
> -TEST_GEN_PROGS += test_progs-alu32
> -endif
> +TEST_GEN_PROGS += test_progs-no_alu32

combine this with TEST_GEN_PROGS list above, it's not conditional anymore?

>
>  # Also test bpf-gcc, if present
>  ifneq ($(BPF_GCC),)
> @@ -179,7 +171,7 @@ endef
>  # $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
>  # Parameters:

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux