Skip to content

Support trampoline for LoongArch #5483

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

Open
wants to merge 4 commits into
base: bpf-next_base
Choose a base branch
from

Conversation

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

Pull request for series with
subject: Support trampoline for LoongArch
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=973377

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

Chenghao Duan added 4 commits June 20, 2025 11:37
Add branch jump function:
larch_insn_gen_beq
larch_insn_gen_bne

Add instruction copy function: larch_insn_text_copy

Co-developed-by: George Guo <[email protected]>
Signed-off-by: George Guo <[email protected]>
Co-developed-by: Youling Tang <[email protected]>
Signed-off-by: Youling Tang <[email protected]>
Signed-off-by: Chenghao Duan <[email protected]>
Implement the bpf_arch_text_poke function for the LoongArch
architecture. On LoongArch, since symbol addresses in the direct mapping
region cannot be reached via relative jump instructions from the paged
mapping region, we use the move_imm+jirl instruction pair as absolute
jump instructions. These require 2-5 instructions, so we reserve 5 NOP
instructions in the program as placeholders for function jumps.

Co-developed-by: George Guo <[email protected]>
Signed-off-by: George Guo <[email protected]>
Signed-off-by: Chenghao Duan <[email protected]>
BPF trampoline is the critical infrastructure of the BPF subsystem, acting
as a mediator between kernel functions and BPF programs. Numerous important
features, such as using BPF program for zero overhead kernel introspection,
rely on this key component.

The related tests have passed, Including the following technical points:
1. fentry
2. fmod_ret
3. fexit

Co-developed-by: George Guo <[email protected]>
Signed-off-by: George Guo <[email protected]>
Signed-off-by: Chenghao Duan <[email protected]>
Update the code to rename validate_code to validate_ctx.
validate_code is used to check the validity of code.
validate_ctx is used to check both code validity and table entry
correctness.

Co-developed-by: George Guo <[email protected]>
Signed-off-by: George Guo <[email protected]>
Signed-off-by: Chenghao Duan <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 99fe8af
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=973377
version: 2

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

Successfully merging this pull request may close these issues.

0 participants