lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 Nov 2016 17:43:31 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Martin KaFai Lau <kafai@...com>
Cc:     netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v2 net-next 6/6] bpf: Add tests for the LRU bpf_htab

On Fri, Nov 11, 2016 at 10:55:11AM -0800, Martin KaFai Lau wrote:
> This patch has some unit tests and a test_lru_dist.
> 
> The test_lru_dist reads in the numeric keys from a file.
> The files used here are generated by a modified fio-genzipf tool
> originated from the fio test suit.  The sample data file can be
> found here: https://github.com/iamkafai/bpf-lru
> 
> The zipf.* data files have 100k numeric keys and the key is also
> ranged from 1 to 100k.
> 
> The test_lru_dist outputs the number of unique keys (nr_unique).
> F.e. The following means, 61239 of them is unique out of 100k keys.
> nr_misses means it cannot be found in the LRU map, so nr_misses
> must be >= nr_unique. test_lru_dist also simulates a perfect LRU
> map as a comparison:
> 
> [root@...h-fb-vm1 ~]# ~/devshare/fb-kernel/linux/samples/bpf/test_lru_dist \
> /root/zipf.100k.a1_01.out 4000 1
> ...
> test_parallel_lru_dist (map_type:9 map_flags:0x0):
>     task:0 BPF LRU: nr_unique:23093(/100000) nr_misses:31603(/100000)
>     task:0 Perfect LRU: nr_unique:23093(/100000 nr_misses:34328(/100000)
> ....
> test_parallel_lru_dist (map_type:9 map_flags:0x2):
>     task:0 BPF LRU: nr_unique:23093(/100000) nr_misses:31710(/100000)
>     task:0 Perfect LRU: nr_unique:23093(/100000 nr_misses:34328(/100000)
> 
> [root@...h-fb-vm1 ~]# ~/devshare/fb-kernel/linux/samples/bpf/test_lru_dist \
> /root/zipf.100k.a0_01.out 40000 1
> ...
> test_parallel_lru_dist (map_type:9 map_flags:0x0):
>     task:0 BPF LRU: nr_unique:61239(/100000) nr_misses:67054(/100000)
>     task:0 Perfect LRU: nr_unique:61239(/100000 nr_misses:66993(/100000)
> ...
> test_parallel_lru_dist (map_type:9 map_flags:0x2):
>     task:0 BPF LRU: nr_unique:61239(/100000) nr_misses:67068(/100000)
>     task:0 Perfect LRU: nr_unique:61239(/100000 nr_misses:66993(/100000)
> 
> LRU map has also been added to map_perf_test:
> /* Global LRU */
> [root@...neltest003.31.prn1 ~]# for i in 1 4 8; do echo -n "$i cpus: "; \
> ./map_perf_test 16 $i | awk '{r += $3}END{print r " updates"}'; done
>  1 cpus: 2934082 updates
>  4 cpus: 7391434 updates
>  8 cpus: 6500576 updates
> 
> /* Percpu LRU */
> [root@...neltest003.31.prn1 ~]# for i in 1 4 8; do echo -n "$i cpus: "; \
> ./map_perf_test 32 $i | awk '{r += $3}END{print r " updates"}'; done
>   1 cpus: 2896553 updates
>   4 cpus: 9766395 updates
>   8 cpus: 17460553 updates
> 
> Signed-off-by: Martin KaFai Lau <kafai@...com>
> ---
>  samples/bpf/Makefile                       |   2 +
>  samples/bpf/map_perf_test_kern.c           |  39 ++
>  samples/bpf/map_perf_test_user.c           |  32 ++
>  samples/bpf/test_lru_dist.c                | 538 ++++++++++++++++++++++++++
>  tools/testing/selftests/bpf/Makefile       |   6 +-
>  tools/testing/selftests/bpf/test_lru_map.c | 583 +++++++++++++++++++++++++++++
>  6 files changed, 1197 insertions(+), 3 deletions(-)
>  create mode 100644 samples/bpf/test_lru_dist.c
>  create mode 100644 tools/testing/selftests/bpf/test_lru_map.c

I guess test_lru_dist stayed in samples/bpf because it needs external
file and the output also not suitable for simple pass/fail and
needs to be deciphered by humans.
Thanks for the other two tests.
In the future we need to consider moving map_perf_test into selftests.

Acked-by: Alexei Starovoitov <ast@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ