bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@fb.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>,
	"Jiong Wang" <jiong.wang@netronome.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: Re: [PATCH bpf-next] tools/bpf: turn on llvm alu32 attribute by default
Date: Tue, 22 Oct 2019 03:49:04 +0000	[thread overview]
Message-ID: <dbf529f1-3ded-1a8c-9282-97f52d2309f4@fb.com> (raw)
In-Reply-To: <CAEf4BzaugaCBgUFnavTtAzezY-Tz55bbfPcQFHOv9Z5VbMh-TQ@mail.gmail.com>



On 10/21/19 8:01 PM, Andrii Nakryiko wrote:
> On Mon, Oct 21, 2019 at 7:32 PM Yonghong Song <yhs@fb.com> wrote:
>>
>> llvm alu32 was introduced in llvm7:
>>    https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_rL325987&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=NHAn2DX4M75upJno8E_Vhg5Wx0cj_CtKLDdMYJJHgVA&s=zlXKgOdNDd7V6cQk3lYECzrp8MYswrOnc-ApTPJ6Q5o&e=
>>    https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_rL325989&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=NHAn2DX4M75upJno8E_Vhg5Wx0cj_CtKLDdMYJJHgVA&s=NSHiry5gsEeL5ThRWj-kc0yfD0YpZCt-OhAsBIvwNZQ&e=
>> Experiments showed that in general performance
>> is better with alu32 enabled:
>>    https://urldefense.proofpoint.com/v2/url?u=https-3A__lwn.net_Articles_775316_&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=NHAn2DX4M75upJno8E_Vhg5Wx0cj_CtKLDdMYJJHgVA&s=FaOOW0RJNF7B2U4JUKG2dPlKk0c1oQtnq06-eFx8mBg&e=
>>
>> 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@netronome.com>
>> Cc: Andrii Nakryiko <andriin@fb.com>
>> Signed-off-by: Yonghong Song <yhs@fb.com>
>> ---
> 
> Sounds good to me, see minor nit below.
> 
> Acked-by: Andrii Nakryiko <andriin@fb.com>
> 
>>   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?

Ya, make sense. Will respin.

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

      reply	other threads:[~2019-10-22  3:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  2:32 [PATCH bpf-next] tools/bpf: turn on llvm alu32 attribute by default Yonghong Song
2019-10-22  3:01 ` Andrii Nakryiko
2019-10-22  3:49   ` Yonghong Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbf529f1-3ded-1a8c-9282-97f52d2309f4@fb.com \
    --to=yhs@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jiong.wang@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).