[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201001053501.mp6uqtan2bkhdgck@ast-mbp.dhcp.thefacebook.com>
Date: Wed, 30 Sep 2020 22:35:01 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: 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, ashkan.nikravesh@...el.com,
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