From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai 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>, Daniel Xu <dxu@dxuuu.xyz>,
bpf <bpf@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix build of task_pt_regs tests for arm64
Date: Fri, 3 Sep 2021 14:33:57 +0200 [thread overview]
Message-ID: <YTIWNRqZ/HmHgcaE@larix> (raw)
In-Reply-To: <CAADnVQKwHXw7fLGpJBJBb_MW+d1Gzexo2wk9QwE2v3fy=kHDRA@mail.gmail.com>
On Thu, Sep 02, 2021 at 12:13:40PM -0700, Alexei Starovoitov wrote:
> On Thu, Sep 2, 2021 at 2:08 AM Jean-Philippe Brucker
> <jean-philippe@linaro.org> wrote:
> >
> > struct pt_regs is not exported to userspace on all archs. arm64 and s390
> > export "user_pt_regs" instead, which causes build failure at the moment:
> >
> > progs/test_task_pt_regs.c:8:16: error: variable has incomplete type 'struct pt_regs'
> > struct pt_regs current_regs = {};
>
> Right, which is 'bpf_user_pt_regs_t'.
> It's defined for all archs and arm64/s390/ppc/risv define it
> differently from pt_regs.
>
> >
> > Use the multi-arch macros defined by tools/lib/bpf/bpf_tracing.h to copy
> > the pt_regs into a locally-defined struct.
> >
> > Copying the user_pt_regs struct on arm64 wouldn't work because the
> > struct is too large and the compiler complains about using too much
> > stack.
>
> That's a different issue.
It does work when doing an implicit copy (current_regs = *regs) rather
than using __builtin_memcpy(). Don't know why but I'll take it.
> I think the cleaner fix would be to make the test use
> bpf_user_pt_regs_t instead.
Right, although that comes with another complication. We end up including
tools/include/uapi/asm/bpf_perf_event.h which requires the compiler
builtins "__aarch64__", "__s390__", etc. Those are not defined with
"clang -target bpf" so I have to add them to the command line.
I'll resend with your suggestion but this patch is simpler.
Thanks,
Jean
next prev parent reply other threads:[~2021-09-03 12:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 9:09 [PATCH bpf-next] selftests/bpf: Fix build of task_pt_regs tests for arm64 Jean-Philippe Brucker
2021-09-02 18:32 ` Daniel Xu
2021-09-02 19:13 ` Alexei Starovoitov
2021-09-03 12:33 ` Jean-Philippe Brucker [this message]
2021-09-03 16:51 ` Andrii Nakryiko
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=YTIWNRqZ/HmHgcaE@larix \
--to=jean-philippe@linaro.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).