[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQK5o1uhJOXLKAbf9Hp_Y0fVsowD3DwRWwBd_++KTTOJHw@mail.gmail.com>
Date: Wed, 1 Jul 2020 15:17:07 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yonghong Song <yhs@...com>
Cc: Hao Luo <haoluo@...gle.com>,
Network Development <netdev@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
Clang-Built-Linux ML <clang-built-linux@...glegroups.com>,
Stanislav Fomichev <sdf@...gle.com>,
Shuah Khan <shuah@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andriin@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns.
On Wed, Jul 1, 2020 at 11:04 AM Yonghong Song <yhs@...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@...gle.com>
> > Acked-by: Andrii Nakryiko <andriin@...com>
>
> Thanks!
> Acked-by: Yonghong Song <yhs@...com>
Applied. Thanks
Powered by blists - more mailing lists