From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: Song Liu <songliubraving@fb.com>,
bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
daniel@iogearbox.net, kernel-team@fb.com
Subject: Re: [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS
Date: Tue, 28 Apr 2020 17:43:40 -0700 [thread overview]
Message-ID: <20200429004340.5y2c3rkr64u43sfg@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <290a94fb-f3ee-227c-ffa0-66629ce8327a@fb.com>
On Tue, Apr 28, 2020 at 05:33:54PM -0700, Yonghong Song wrote:
>
>
> On 4/28/20 5:29 PM, Song Liu wrote:
> > Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats.
> >
> > ~/selftests/bpf# ./test_progs -t enable_stats -v
> > test_enable_stats:PASS:skel_open_and_load 0 nsec
> > test_enable_stats:PASS:get_stats_fd 0 nsec
> > test_enable_stats:PASS:attach_raw_tp 0 nsec
> > test_enable_stats:PASS:get_prog_info 0 nsec
> > test_enable_stats:PASS:check_stats_enabled 0 nsec
> > Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
...
> > +static int val = 1;
> > +
> > +SEC("raw_tracepoint/sys_enter")
> > +int test_enable_stats(void *ctx)
> > +{
> > + __u32 key = 0;
> > + __u64 *val;
>
> The above two declarations (key/val) are not needed,
> esp. "val" is shadowing.
> Maybe the maintainer can fix it up before merging
> if there is no other changes for this patch set.
>
> > +
> > + val += 1;
I think 'PASSED' above is quite misleading.
How it can pass when it wasn't incremented?
The user space test_enable_stats() doesn't check this val.
Please fix.
usleep(1000); needs an explanation as well.
Why 1000 ? It should work with any syscall. like getpid ?
and with value 1 ?
Since there is bpf_obj_get_info_by_fd() that usleep()
is unnecessary. What am I missing?
next prev parent reply other threads:[~2020-04-29 0:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 0:29 [PATCH v6 bpf-next 0/3] bpf: sharing bpf runtime stats with Song Liu
2020-04-29 0:29 ` [PATCH v6 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS Song Liu
2020-04-29 0:29 ` [PATCH v6 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS Song Liu
2020-04-29 0:29 ` [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS Song Liu
2020-04-29 0:33 ` Yonghong Song
2020-04-29 0:43 ` Alexei Starovoitov [this message]
2020-04-29 2:06 ` Song Liu
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=20200429004340.5y2c3rkr64u43sfg@ast-mbp.dhcp.thefacebook.com \
--to=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.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).