RE: [PATCH bpf-next v7 2/2] selftests/bpf: Selftest for real time helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 
Sent: Wednesday, September 30, 2020 10:35 PM
To: Pujari, Bimmy <bimmy.pujari@xxxxxxxxx>
Cc: bpf@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; mchehab@xxxxxxxxxx; ast@xxxxxxxxxx; daniel@xxxxxxxxxxxxx; kafai@xxxxxx; maze@xxxxxxxxxx; Nikravesh, Ashkan <ashkan.nikravesh@xxxxxxxxx>; Alvarez, Daniel A <daniel.a.alvarez@xxxxxxxxx>
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@xxxxxxxxx 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.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux