From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: Hao Luo <haoluo@google.com>,
Network Development <netdev@vger.kernel.org>,
bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Clang-Built-Linux ML <clang-built-linux@googlegroups.com>,
Stanislav Fomichev <sdf@google.com>,
Shuah Khan <shuah@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andriin@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns.
Date: Wed, 1 Jul 2020 15:17:07 -0700 [thread overview]
Message-ID: <CAADnVQK5o1uhJOXLKAbf9Hp_Y0fVsowD3DwRWwBd_++KTTOJHw@mail.gmail.com> (raw)
In-Reply-To: <aab03e4b-2779-3b71-44ea-735a7b92a70f@fb.com>
On Wed, Jul 1, 2020 at 11:04 AM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 7/1/20 10:53 AM, Hao Luo wrote:
> > The test_vmlinux test uses hrtimer_nanosleep as hook to test tracing
> > programs. But in a kernel built by clang, which performs more aggresive
> > inlining, that function gets inlined into its caller SyS_nanosleep.
> > Therefore, even though fentry and kprobe do hook on the function,
> > they aren't triggered by the call to nanosleep in the test.
> >
> > A possible fix is switching to use a function that is less likely to
> > be inlined, such as hrtimer_range_start_ns. The EXPORT_SYMBOL functions
> > shouldn't be inlined based on the description of [1], therefore safe
> > to use for this test. Also the arguments of this function include the
> > duration of sleep, therefore suitable for test verification.
> >
> > [1] af3b56289be1 time: don't inline EXPORT_SYMBOL functions
> >
> > Tested:
> > In a clang build kernel, before this change, the test fails:
> >
> > test_vmlinux:PASS:skel_open 0 nsec
> > test_vmlinux:PASS:skel_attach 0 nsec
> > test_vmlinux:PASS:tp 0 nsec
> > test_vmlinux:PASS:raw_tp 0 nsec
> > test_vmlinux:PASS:tp_btf 0 nsec
> > test_vmlinux:FAIL:kprobe not called
> > test_vmlinux:FAIL:fentry not called
> >
> > After switching to hrtimer_range_start_ns, the test passes:
> >
> > test_vmlinux:PASS:skel_open 0 nsec
> > test_vmlinux:PASS:skel_attach 0 nsec
> > test_vmlinux:PASS:tp 0 nsec
> > test_vmlinux:PASS:raw_tp 0 nsec
> > test_vmlinux:PASS:tp_btf 0 nsec
> > test_vmlinux:PASS:kprobe 0 nsec
> > test_vmlinux:PASS:fentry 0 nsec
> >
> > Signed-off-by: Hao Luo <haoluo@google.com>
> > Acked-by: Andrii Nakryiko <andriin@fb.com>
>
> Thanks!
> Acked-by: Yonghong Song <yhs@fb.com>
Applied. Thanks
prev parent reply other threads:[~2020-07-01 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 17:53 [PATCH bpf-next v2] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns Hao Luo
2020-07-01 18:04 ` Yonghong Song
2020-07-01 22:17 ` Alexei Starovoitov [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=CAADnVQK5o1uhJOXLKAbf9Hp_Y0fVsowD3DwRWwBd_++KTTOJHw@mail.gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.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;
as well as URLs for NNTP newsgroup(s).