bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: "Pujari, Bimmy" <bimmy.pujari@intel.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	mchehab@kernel.org, "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Martin Lau" <kafai@fb.com>,
	"Maciej Żenczykowski" <maze@google.com>,
	"Nikravesh, Ashkan" <ashkan.nikravesh@intel.com>
Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: Verifying real time helper function
Date: Thu, 24 Sep 2020 13:22:02 -0700	[thread overview]
Message-ID: <CAEf4BzZ7Srd2k5a_t6JKW9_=cUQVqvxXhd+4rvbpMHKRJAQbiw@mail.gmail.com> (raw)
In-Reply-To: <20200924022557.16561-2-bimmy.pujari@intel.com>

On Wed, Sep 23, 2020 at 7:26 PM <bimmy.pujari@intel.com> wrote:
>
> From: Bimmy Pujari <bimmy.pujari@intel.com>
>
> Test xdping measures RTT from xdp using monotonic time helper.
> Extending xdping test to use real time helper function in order
> to verify this helper function.
>
> Signed-off-by: Bimmy Pujari <bimmy.pujari@intel.com>
> ---

This is exactly the use of REALTIME clock that I was arguing against,
and yet you are actually creating an example of how to use it for such
case. CLOCK_REALTIME should not be used to measuring time elapsed (not
within the same machine, at least), there are strictly better
alternatives.

So if you want to write a test for a new helper (assuming everyone
else thinks it's a good idea), then do just that - write a separate
minimal test that tests just your new functionality. Don't couple it
with a massive XDP program. And also don't create unnecessarily almost
400 lines of code churn.

>  .../testing/selftests/bpf/progs/xdping_kern.c | 183 +----------------
>  .../testing/selftests/bpf/progs/xdping_kern.h | 193 ++++++++++++++++++
>  .../bpf/progs/xdping_realtime_kern.c          |   4 +
>  tools/testing/selftests/bpf/test_xdping.sh    |  44 +++-
>  4 files changed, 235 insertions(+), 189 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/xdping_kern.h
>  create mode 100644 tools/testing/selftests/bpf/progs/xdping_realtime_kern.c
>

[...]

  parent reply	other threads:[~2020-09-24 20:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  2:25 [PATCH bpf-next v3 1/2] bpf: Add bpf_ktime_get_real_ns bimmy.pujari
2020-09-24  2:25 ` [PATCH bpf-next v3 2/2] selftests/bpf: Verifying real time helper function bimmy.pujari
2020-09-24 15:34   ` Daniel Borkmann
2020-09-24 20:22   ` Andrii Nakryiko [this message]
2020-09-25  0:22     ` Pujari, Bimmy
2020-09-24  2:41 ` [PATCH bpf-next v3 1/2] bpf: Add bpf_ktime_get_real_ns Maciej Żenczykowski
2020-09-24 15:31 ` Daniel Borkmann

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='CAEf4BzZ7Srd2k5a_t6JKW9_=cUQVqvxXhd+4rvbpMHKRJAQbiw@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=ashkan.nikravesh@intel.com \
    --cc=ast@kernel.org \
    --cc=bimmy.pujari@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=maze@google.com \
    --cc=mchehab@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).