Skip to content

btf_dedup algorithm and test fixes

Andrii Nakryiko bpf netdev 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyApplied
  2. v15 patches 20 repliesSuperseded

Changes in v2 from the cover letter

- remove "Fixes" from formatting change patch
- extract roundup_pow2_max func for dedup table size
- btf_equal_struct -> btf_shallow_equal_struct
- explain in comment why we can't rely on just btf_dedup_is_equiv

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5selftests/bpf: fix btf_dedup testing codetools/testing/selftests/bpf/.gitignore tools/testing/selftests/bpf/test_btf.c+3 -20 replies
2/5libbpf: fix formatting for btf_ext__get_raw_datatools/lib/bpf/btf.h+1 -10 replies
3/5btf: allow to customize dedup hash table sizetools/lib/bpf/btf.c tools/lib/bpf/btf.h+37 -170 replies
4/5btf: fix bug with resolving STRUCT/UNION into corresponding FWDtools/lib/bpf/btf.c+17 -30 replies
5/5selftests/bpf: add btf_dedup test of FWD/STRUCT resolutiontools/testing/selftests/bpf/test_btf.c+45 -00 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchSong LiuYonghong Song
1/5A-b A-b
2/5A-b
3/5A-b
4/5A-b A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/5] btf_dedup algorithm and test fixes

This patchset fixes a bug in btf_dedup() algorithm, which under specific hash collision causes infinite loop. It also exposes ability to tune BTF deduplication table size, with double purpose of allowing applications to adjust size according to the size of BTF data, as well as allowing a simple way to force hash collisions by setting table size to 1.

- Patch #1 fixes bug in btf_dedup testing code that's checking strings
- Patch #2 fixes pointer arg formatting in btf.h
- Patch #3 adds option to specify custom dedup table size
- Patch #4 fixes aforementioned bug in btf_dedup
- Patch #5 adds test that validates the fix

v1->v2:
- remove "Fixes" from formatting change patch
- extract roundup_pow2_max func for dedup table size
- btf_equal_struct -> btf_shallow_equal_struct
- explain in comment why we can't rely on just btf_dedup_is_equiv

Andrii Nakryiko (5):
selftests/bpf: fix btf_dedup testing code
libbpf: fix formatting for btf_ext__get_raw_data
btf: allow to customize dedup hash table size
btf: fix bug with resolving STRUCT/UNION into corresponding FWD selftests/bpf: add btf_dedup test of FWD/STRUCT resolution

 tools/lib/bpf/btf.c                    | 73 +++++++++++++++++++-------
 tools/lib/bpf/btf.h                    |  3 +-
 tools/testing/selftests/bpf/.gitignore |  1 +
 tools/testing/selftests/bpf/test_btf.c | 49 ++++++++++++++++-
 4 files changed, 103 insertions(+), 23 deletions(-)
Signature · 1 line
2.17.1