From: Pu Lehui <pulehui@huawei.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Martin Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
john fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Shuah Khan <shuah@kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix building error when using userspace pt_regs
Date: Fri, 17 Dec 2021 10:25:00 +0800 [thread overview]
Message-ID: <a83777e4-528f-8adb-33e4-a0fea8d544a0@huawei.com> (raw)
In-Reply-To: <CAEf4BzaQcHV3iY5XqEbt3ptw+KejVVEZ8gSmW7u46=xHnsTaPA@mail.gmail.com>
On 2021/12/16 12:06, Andrii Nakryiko wrote:
> On Tue, Dec 14, 2021 at 5:54 AM Pu Lehui <pulehui@huawei.com> wrote:
>>
>> When building bpf selftests on arm64, the following error will occur:
>>
>> progs/loop2.c:20:7: error: incomplete definition of type 'struct
>> user_pt_regs'
>>
>> Some archs, like arm64 and riscv, use userspace pt_regs in
>> bpf_tracing.h, which causes build failure when bpf prog use
>> macro in bpf_tracing.h. So let's use vmlinux.h directly.
>
> We could probably also extend bpf_tracing.h to work with
> kernel-defined pt_regs, just like we do for x86 (see __KERNEL__ and
> __VMLINUX_H__ checks). It's more work, but will benefit other end
> users, not just selftests.
>
It might change a lot. We can use header file directory generated by
"make headers_install" to fix it.
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -294,7 +294,8 @@ MENDIAN=$(if
$(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
BPF_CFLAGS = -g -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
-I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
- -I$(abspath $(OUTPUT)/../usr/include)
+ -I$(abspath $(OUTPUT)/../usr/include) \
+ -I../../../../usr/include
>>
>> Signed-off-by: Pu Lehui <pulehui@huawei.com>
>> ---
>> tools/testing/selftests/bpf/progs/loop1.c | 8 ++------
>> tools/testing/selftests/bpf/progs/loop2.c | 8 ++------
>> tools/testing/selftests/bpf/progs/loop3.c | 8 ++------
>> tools/testing/selftests/bpf/progs/loop6.c | 20 ++++++-------------
>> .../selftests/bpf/progs/test_overhead.c | 8 ++------
>> .../selftests/bpf/progs/test_probe_user.c | 6 +-----
>> 6 files changed, 15 insertions(+), 43 deletions(-)
>>
>
> [...]
> .
>
next prev parent reply other threads:[~2021-12-17 2:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 13:55 Pu Lehui
2021-12-14 20:01 ` Daniel Borkmann
2021-12-15 1:20 ` Pu Lehui
2021-12-17 2:19 ` Pu Lehui
2021-12-16 4:06 ` Andrii Nakryiko
2021-12-17 2:25 ` Pu Lehui [this message]
2021-12-17 16:45 ` Andrii Nakryiko
2021-12-20 14:02 ` Pu Lehui
2021-12-21 0:58 ` Pu Lehui
2021-12-21 23:52 ` Andrii Nakryiko
2021-12-22 1:33 ` Pu Lehui
2021-12-22 23:17 ` Andrii Nakryiko
2021-12-23 4:52 ` Pu Lehui
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=a83777e4-528f-8adb-33e4-a0fea8d544a0@huawei.com \
--to=pulehui@huawei.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=shuah@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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
all inboxes | Powered by JetHome®