[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BY5PR11MB4354F2C9189C169C0CE40A9B86300@BY5PR11MB4354.namprd11.prod.outlook.com>
Date: Thu, 1 Oct 2020 21:52:12 +0000
From: "Pujari, Bimmy" <bimmy.pujari@...el.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"mchehab@...nel.org" <mchehab@...nel.org>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"kafai@...com" <kafai@...com>, "maze@...gle.com" <maze@...gle.com>,
"Nikravesh, Ashkan" <ashkan.nikravesh@...el.com>,
"Alvarez, Daniel A" <daniel.a.alvarez@...el.com>
Subject: RE: [PATCH bpf-next v7 2/2] selftests/bpf: Selftest for real time
helper
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@...il.com>
Sent: Wednesday, September 30, 2020 10:35 PM
To: Pujari, Bimmy <bimmy.pujari@...el.com>
Cc: bpf@...r.kernel.org; netdev@...r.kernel.org; mchehab@...nel.org; ast@...nel.org; daniel@...earbox.net; kafai@...com; maze@...gle.com; Nikravesh, Ashkan <ashkan.nikravesh@...el.com>; Alvarez, Daniel A <daniel.a.alvarez@...el.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@...el.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.
Powered by blists - more mailing lists