From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: ast@kernel.org, linux-kernel@vger.kernel.org,
Daniel Borkmann <daniel@iogearbox.net>,
Li Zefan <lizefan@huawei.com>,
pi3orama@163.com
Subject: Re: [PATCH 1/2] perf test: Add libbpf relocation checker
Date: Fri, 22 Jan 2016 12:40:50 -0300 [thread overview]
Message-ID: <20160122154050.GH4034@kernel.org> (raw)
In-Reply-To: <1453454841-232334-2-git-send-email-wangnan0@huawei.com>
Em Fri, Jan 22, 2016 at 09:27:20AM +0000, Wang Nan escreveu:
> There's a bug in LLVM that it can generate unneeded relocation
> information. See [1] and [2]. Libbpf should check the target section
> of a relocation symbol.
>
> This patch adds a testcase which reference a global variable (BPF
> doesn't support global variable). Before fixing libbpf, the new test
> case can be loaded into kernel, the global variable acts like the first
> map. It is incorrect.
>
> Result:
> # ~/perf test BPF
> 37: Test BPF filter :
> 37.1: Test basic BPF filtering : Ok
> 37.2: Test BPF prologue generation : Ok
> 37.3: Test BPF relocation checker : FAILED!
So I just got a new notebook, a t450s (heya, will be able to test Intel
PT, etc) and installed fedora 23 on it, cool, there is clang/llvm in it!
And furthermore:
[root@jouet ~]# clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
[root@jouet ~]#
Seems to be the one we need!
But...
[root@jouet ~]# perf test bpf
37: Test BPF filter :
37.1: Test basic BPF filtering : Skip
37.2: Test BPF prologue generation : Skip
[root@jouet ~]#
oh well...
>From 'perf test -v bpf':
' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
error: unable to create target: 'No available targets are compatible with this triple, see -version for the available targets.'
----
And after googling 'list clang supported target'
[root@jouet ~]# llc --version
LLVM (http://llvm.org/):
LLVM version 3.7.0
Optimized build.
Built Dec 4 2015 (15:49:18).
Default target: x86_64-redhat-linux-gnu
Host CPU: broadwell
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_be - AArch64 (big endian)
amdgcn - AMD GCN GPUs
arm - ARM
arm64 - ARM64 (little endian)
armeb - ARM (big endian)
cpp - C++ backend
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
ppc32 - PowerPC 32
ppc64 - PowerPC 64
ppc64le - PowerPC 64 LE
r600 - AMD GPUs HD2XXX-HD6XXX
systemz - SystemZ
thumb - Thumb
thumbeb - Thumb (big endian)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
[root@jouet ~]#
Oops, no bpf, so the good thing is that if we uninstall clang and try that test again:
[root@jouet ~]# dnf remove clang llvm
Dependencies resolved.
==============================================================
Package Arch Version Repository Size
==============================================================
Removing:
clang x86_64 3.7.0-3.fc23 @updates 45 M
clang-libs x86_64 3.7.0-3.fc23 @updates 14 M
gcc-c++ x86_64 5.3.1-2.fc23 @updates 24 M
libstdc++-devel x86_64 5.3.1-2.fc23 @updates 9.5 M
llvm x86_64 3.7.0-3.fc23 @updates 4.9 M
Transaction Summary
==============================================================
Remove 5 Packages
When I try it again I get nice instructions on how to install it!
[root@jouet ~]# perf test bpf
37: Test BPF filter :
37.1: Test basic BPF filtering : Skip
37.2: Test BPF prologue generation : Skip
[root@jouet ~]# perf test -v bpf
37: Test BPF filter :
37.1: Test basic BPF filtering :
--- start ---
test child forked, pid 30062
ERROR: unable to find clang.
Hint: Try to install latest clang/llvm to support BPF. Check your $PATH
and 'clang-path' option in [llvm] section of ~/.perfconfig.
LLVM 3.7 or newer is required. Which can be found from http://llvm.org
You may want to try git trunk:
git clone http://llvm.org/git/llvm.git
and
git clone http://llvm.org/git/clang.git
Or fetch the latest clang/llvm 3.7 from pre-built llvm packages for
debian/ubuntu:
http://llvm.org/apt
If you are using old version of clang, change 'clang-bpf-cmd-template'
option in [llvm] section of ~/.perfconfig to:
"$CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS \
-working-directory $WORKING_DIR -c $CLANG_SOURCE \
-emit-llvm -o - | /path/to/llc -march=bpf -filetype=obj -o -"
(Replace /path/to/llc with path to your llc)
Failed to compile test case: 'Basic BPF llvm compiling test'
Unable to get BPF object, fix 'perf test LLVM' first
test child finished with -2
---- end ----
Test BPF filter subtest 0: Skip
37.2: Test BPF prologue generation :
--- force skipped ---
Test BPF filter subtest 1: Skip
[root@jouet ~]#
Lets try it...
- Arnaldo
next prev parent reply other threads:[~2016-01-22 15:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-22 9:27 [PATCH 0/2] perf bpf: Fix relocation error Wang Nan
2016-01-22 9:27 ` [PATCH 1/2] perf test: Add libbpf relocation checker Wang Nan
2016-01-22 15:40 ` Arnaldo Carvalho de Melo [this message]
2016-01-22 17:07 ` Alexei Starovoitov
2016-01-22 17:22 ` clang --target=bpf missing on f23 was: " Arnaldo Carvalho de Melo
2016-01-22 17:35 ` Adam Jackson
2016-01-22 17:42 ` Alexei Starovoitov
2016-01-22 21:09 ` David Airlie
2016-01-22 17:56 ` Daniel Borkmann
2016-01-22 19:09 ` Arnaldo Carvalho de Melo
2016-01-22 9:27 ` [PATCH 2/2] perf bpf: Check relocation target section Wang Nan
2016-01-22 17:11 ` Alexei Starovoitov
2016-01-25 1:56 ` Wangnan (F)
2016-01-25 2:04 ` Wangnan (F)
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=20160122154050.GH4034@kernel.org \
--to=acme@kernel.org \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
--cc=wangnan0@huawei.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).