-
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
Use bpf_prog_pack for RV64 bpf trampoline #7062
Conversation
Upstream branch: 71ed6c2 |
Upstream branch: 71ed6c2 |
6f4f1b2
to
82d95c1
Compare
c7673c1
to
0b7406d
Compare
Upstream branch: 6f130e4 |
82d95c1
to
0e7b940
Compare
0b7406d
to
b62b6e4
Compare
Upstream branch: f4aba34 |
0e7b940
to
0667550
Compare
b62b6e4
to
9ab0d84
Compare
Upstream branch: 1b0215a |
0667550
to
43546ae
Compare
9ab0d84
to
fb42b3d
Compare
Upstream branch: 6c8d759 |
43546ae
to
a2c3b9a
Compare
fb42b3d
to
169fa82
Compare
Upstream branch: a87f34e |
a2c3b9a
to
50cc2c2
Compare
169fa82
to
14f768c
Compare
Upstream branch: ecec188 |
50cc2c2
to
fc44e03
Compare
14f768c
to
8cca82b
Compare
Upstream branch: c12603e |
fc44e03
to
85ce4f7
Compare
8cca82b
to
20219f9
Compare
Upstream branch: e944fc8 |
d728df7
to
a0331be
Compare
Upstream branch: fbe3e84 |
8e8d805
to
c08aaaa
Compare
a0331be
to
35bd8d8
Compare
Upstream branch: f088cab |
c08aaaa
to
2efa889
Compare
35bd8d8
to
6380a82
Compare
Upstream branch: 46253c4 |
2efa889
to
619db4e
Compare
6380a82
to
214f651
Compare
Upstream branch: 3f8fde3 |
619db4e
to
cec78dc
Compare
214f651
to
c939103
Compare
Upstream branch: 531876c |
For trampoline using bpf_prog_pack, we need to generate a rw_image buffer with size of (image_end - image). For regular trampoline, we use the precise image size generated by arch_bpf_trampoline_size to allocate rw_image. But for struct_ops trampoline, we allocate rw_image directly using close to PAGE_SIZE size. We do not need to allocate for that much, as the patch size is usually much smaller than PAGE_SIZE. Let's use precise image size for it too. Signed-off-by: Pu Lehui <pulehui@huawei.com> Acked-by: Song Liu <song@kernel.org> Tested-by: Björn Töpel <bjorn@rivosinc.com> #riscv
We get the size of the trampoline image during the dry run phase and allocate memory based on that size. The allocated image will then be populated with instructions during the real patch phase. But after commit 26ef208 ("bpf: Use arch_bpf_trampoline_size"), the `im` argument is inconsistent in the dry run and real patch phase. This may cause emit_imm in RV64 to generate a different number of instructions when generating the 'im' address, potentially causing out-of-bounds issues. Let's emit the maximum number of instructions for the "im" address during dry run to fix this problem. Fixes: 26ef208 ("bpf: Use arch_bpf_trampoline_size") Signed-off-by: Pu Lehui <pulehui@huawei.com>
We used bpf_prog_pack to aggregate bpf programs into huge page to relieve the iTLB pressure on the system. We can apply it to bpf trampoline, as Song had been implemented it in core and x86 [0]. This patch is going to use bpf_prog_pack to RV64 bpf trampoline. Since Song and Puranjay have done a lot of work for bpf_prog_pack on RV64, implementing this function will be easy. Link: https://lore.kernel.org/all/20231206224054.492250-1-song@kernel.org [0] Signed-off-by: Pu Lehui <pulehui@huawei.com> Tested-by: Björn Töpel <bjorn@rivosinc.com> #riscv
cec78dc
to
ecd2bfa
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=819042 expired. Closing PR. |
Pull request for series with
subject: Use bpf_prog_pack for RV64 bpf trampoline
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162