netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Yonghong Song <yhs@fb.com>, bpf <bpf@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS
Date: Wed, 29 Apr 2020 02:06:15 +0000	[thread overview]
Message-ID: <78ED2E6A-BA51-4A1A-80C9-865215A25760@fb.com> (raw)
In-Reply-To: <20200429004340.5y2c3rkr64u43sfg@ast-mbp.dhcp.thefacebook.com>



> On Apr 28, 2020, at 5:43 PM, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> 
> 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?

This test currently doesn't test the value. It simply checks
run_time_ns is none zero. I guess it is good to actually 
test the value. Let me add that.

Thanks,
Son


      reply	other threads:[~2020-04-29  2:06 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
2020-04-29  2:06       ` Song Liu [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=78ED2E6A-BA51-4A1A-80C9-865215A25760@fb.com \
    --to=songliubraving@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --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).