-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libbpf: add bulk BTF type copying API #1874
Conversation
Master branch: 0693b27 |
Master branch: 32a16f6 |
5cf43d0
to
1d5d570
Compare
Instead of unconditionally performing push/pop on rax/rdx in case of division/modulo, we can save a few bytes in case of dest register being either BPF r0 (rax) or r3 (rdx) since the result is written in there anyway. Also, we do not need to copy src to r11 unless src is either rax, rdx or an immediate. For example, before the patch: 22: push %rax 23: push %rdx 24: mov %rsi,%r11 27: xor %edx,%edx 29: div %r11 2c: mov %rax,%r11 2f: pop %rdx 30: pop %rax 31: mov %r11,%rax 34: leaveq 35: retq After: 22: push %rdx 23: xor %edx,%edx 25: div %rsi 28: pop %rdx 29: leaveq 2a: retq Signed-off-by: Jie Meng <jmeng@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211002035626.2041910-1-jmeng@fb.com
Master branch: 0640c77 |
1d5d570
to
2647567
Compare
Master branch: ce30065 |
2647567
to
8d5e7e7
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=557535 expired. Closing PR. |
Add a bulk copying api, btf__add_btf(), that speeds up and simplifies appending entire contents of one BTF object to another one, taking care of copying BTF type data, adjusting resulting BTF type IDs according to their new locations in the destination BTF object, as well as copying and deduplicating all the referenced strings and updating all the string offsets in new BTF types as appropriate. This API is intended to be used from tools that are generating and otherwise manipulating BTFs generically, such as pahole. In pahole's case, this API is useful for speeding up parallelized BTF encoding, as it allows pahole to offload all the intricacies of BTF type copying to libbpf and handle the parallelization aspects of the process. Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Next patch will need to reuse BTF generation logic, which tests every supported BTF kind, for testing btf__add_btf() APIs. So restructure existing selftests and make it as a single subtest that uses bulk VALIDATE_RAW_BTF() macro for raw BTF dump checking. Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Add a test that validates that btf__add_btf() API is correctly copying all the types from the source BTF into destination BTF object and adjusts type IDs and string offsets properly. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Master branch: ce30065 |
8d5e7e7
to
0db3bd7
Compare
ce30065
to
57a610f
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=558301 irrelevant now. Closing PR. |
Pull request for series with
subject: libbpf: add bulk BTF type copying API
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=557535