All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pujari, Bimmy" <bimmy.pujari@intel.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"kafai@fb.com" <kafai@fb.com>,
	"maze@google.com" <maze@google.com>,
	"Nikravesh, Ashkan" <ashkan.nikravesh@intel.com>,
	"Alvarez, Daniel A" <daniel.a.alvarez@intel.com>
Subject: RE: [PATCH bpf-next v7 2/2] selftests/bpf: Selftest for real time helper
Date: Thu, 1 Oct 2020 21:52:12 +0000	[thread overview]
Message-ID: <BY5PR11MB4354F2C9189C169C0CE40A9B86300@BY5PR11MB4354.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201001053501.mp6uqtan2bkhdgck@ast-mbp.dhcp.thefacebook.com>

Thanks everyone for putting your valuable time to review these patches. Can any one from you suggest the best way to test this function in selftest?

Regards
Bimmy

-----Original Message-----
From: Alexei Starovoitov <alexei.starovoitov@gmail.com> 
Sent: Wednesday, September 30, 2020 10:35 PM
To: Pujari, Bimmy <bimmy.pujari@intel.com>
Cc: bpf@vger.kernel.org; netdev@vger.kernel.org; mchehab@kernel.org; ast@kernel.org; daniel@iogearbox.net; kafai@fb.com; maze@google.com; Nikravesh, Ashkan <ashkan.nikravesh@intel.com>; Alvarez, Daniel A <daniel.a.alvarez@intel.com>
Subject: Re: [PATCH bpf-next v7 2/2] selftests/bpf: Selftest for real time helper

On Wed, Sep 30, 2020 at 07:05:04PM -0700, bimmy.pujari@intel.com wrote:
> +SEC("realtime_helper")
> +int realtime_helper_test(struct __sk_buff *skb) {
> +	unsigned long long *lasttime;
> +	unsigned long long curtime;
> +	int key = 0;
> +	int err = 0;
> +
> +	lasttime = bpf_map_lookup_elem(&time_map, &key);
> +	if (!lasttime)
> +		goto err;
> +
> +	curtime = bpf_ktime_get_real_ns();
> +	if (curtime <= *lasttime) {
> +		err = 1;
> +		goto err;
> +	}
> +	*lasttime = curtime;

so the test is doing exactly what comment in patch 1 is saying not to do.
I'm sorry but Andrii's comments are correct. If the authors of the patch cannot make it right we should not add this helper to general audience.
Just because POSIX allows it it doesn't mean that it did the good choice.

  reply	other threads:[~2020-10-01 21:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  2:05 [PATCH bpf-next v7 1/2] bpf: Add bpf_ktime_get_real_ns bimmy.pujari
2020-10-01  2:05 ` [PATCH bpf-next v7 2/2] selftests/bpf: Selftest for real time helper bimmy.pujari
2020-10-01  5:35   ` Alexei Starovoitov
2020-10-01 21:52     ` Pujari, Bimmy [this message]
2020-10-01 22:50       ` Alexei Starovoitov
2020-10-05 17:36         ` Maciej Żenczykowski
2020-10-07 16:33           ` David Ahern

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=BY5PR11MB4354F2C9189C169C0CE40A9B86300@BY5PR11MB4354.namprd11.prod.outlook.com \
    --to=bimmy.pujari@intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ashkan.nikravesh@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel.a.alvarez@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.