From: Hou Tao <houtao1@xxxxxxxxxx> Hi, This patch set fixes several issues for LPM trie. These issues were found during adding new test cases or were reported by syzbot. The patch set is structured as follows: Patch #1~#2 are clean-ups for lpm_trie_update_elem(). Patch #3 handles BPF_EXIST and BPF_NOEXIST correctly for LPM trie. Patch #4 fixes the accounting of n_entries when doing in-place update. Patch #5 fixes the exact match condition in trie_get_next_key() and it may skip keys when the passed key is not found in the map. Patch #6~7 switch from kmalloc() to bpf memory allocator for LPM trie to fix several lock order warnings reported by syzbot. Patch #8 enables raw_spinlock_t for LPM trie again after switching to bpf memory allocator. Patch #9: move test_lpm_map to map_tests to make it run regularly. Patch #10: add more basic test cases for LPM trie. Please see individual patches for more details. Comments are always welcome. Hou Tao (10): bpf: Remove unnecessary check when updating LPM trie bpf: Remove unnecessary kfree(im_node) in lpm_trie_update_elem bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie bpf: Handle in-place update for full LPM trie correctly bpf: Fix exact match conditions in trie_get_next_key() bpf: Add bpf_mem_cache_is_mergeable() helper bpf: Switch to bpf mem allocator for LPM trie bpf: Use raw_spinlock_t for LPM trie selftests/bpf: Move test_lpm_map.c to map_tests selftests/bpf: Add more test cases for LPM trie include/linux/bpf_mem_alloc.h | 1 + kernel/bpf/lpm_trie.c | 158 +++++-- kernel/bpf/memalloc.c | 12 + tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 2 +- .../lpm_trie_map_basic_ops.c} | 401 +++++++++++++++++- 6 files changed, 523 insertions(+), 52 deletions(-) rename tools/testing/selftests/bpf/{test_lpm_map.c => map_tests/lpm_trie_map_basic_ops.c} (64%) -- 2.29.2