Skip to content
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

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 71ed6c2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 71ed6c2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6f130e4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f4aba34
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 1b0215a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6c8d759
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a87f34e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ecec188
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c12603e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e944fc8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: fbe3e84
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f088cab
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 46253c4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 3f8fde3
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 531876c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=854162
version: 2

Pu Lehui added 3 commits May 31, 2024 20:38
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
@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=819042 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
0 participants