bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/5] Support trampoline for LoongArch
@ 2025-07-30 13:12 Chenghao Duan
  2025-07-30 13:12 ` [PATCH v5 1/5] LoongArch: Add larch_insn_gen_{beq,bne} helpers Chenghao Duan
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Chenghao Duan @ 2025-07-30 13:12 UTC (permalink / raw)
  To: ast, daniel, andrii, yangtiezhu, hengqi.chen, chenhuacai
  Cc: martin.lau, eddyz87, song, yonghong.song, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, kernel, linux-kernel, loongarch, bpf,
	guodongtai, duanchenghao, youling.tang, jianghaoran,
	vincent.mc.li, geliang

v5:
1. Modify the internal implementation of larch_insn_text_copy by
   removing the while loop processing. There is a while loop inside
   copy_to_kernel_nofault that handles and copies all data.

2. text_mutex has been added to all usage contexts of
larch_insn_text_copy, and the relevant tests have passed.

-----------------------------------------------------------------------
Historical Version:
v4:
1. Delete the #3 patch of version V3.

2. Add 5 NOP instructions in build_prologue().
   Reserve space for the move_imm + jirl instruction.

3. Differentiate between direct jumps and ftrace jumps of trampoline:
   direct jumps skip 5 instructions.
   ftrace jumps skip 2 instructions.

4. Remove the generation of BL jump instructions in emit_jump_and_link().
   After the trampoline ends, it will jump to the specified register.
   The BL instruction writes PC+4 to r1 instead of allowing the
   specification of rd.

URL for version v4:
https://lore.kernel.org/all/20250724141929.691853-1-duanchenghao@kylinos.cn/
---------
v3:
1. Patch 0003 adds EXECMEM_BPF memory type to the execmem subsystem.

2. Align the size calculated by arch_bpf_trampoline_size to page
boundaries.

3. Add the flush icache operation to larch_insn_text_copy.

4. Unify the implementation of bpf_arch_xxx into the patch
"0004-LoongArch-BPF-Add-bpf_arch_xxxxx-support-for-Loong.patch".

5. Change the patch order. Move the patch
"0002-LoongArch-BPF-Update-the-code-to-rename-validate_.patch" before
"0005-LoongArch-BPF-Add-bpf-trampoline-support-for-Loon.patch".

URL for version v3:
https://lore.kernel.org/all/20250709055029.723243-1-duanchenghao@kylinos.cn/
---------
v2:
1. Change the fixmap in the instruction copy function to set_memory_xxx.

2. Change the implementation method of the following code.
	- arch_alloc_bpf_trampoline
	- arch_free_bpf_trampoline
	Use the BPF core's allocation and free functions.

	- bpf_arch_text_invalidate
	Operate with the function larch_insn_text_copy that carries
	memory attribute modifications.

3. Correct the incorrect code formatting.

URL for version v2:
https://lore.kernel.org/all/20250618105048.1510560-1-duanchenghao@kylinos.cn/
---------
v1:
Support trampoline for LoongArch. The following feature tests have been
completed:
	1. fentry
	2. fexit
	3. fmod_ret

TODO: The support for the struct_ops feature will be provided in
subsequent patches.

URL for version v1:
https://lore.kernel.org/all/20250611035952.111182-1-duanchenghao@kylinos.cn/
-----------------------------------------------------------------------

Chenghao Duan (4):
  LoongArch: Add larch_insn_gen_{beq,bne} helpers
  LoongArch: BPF: Update the code to rename validate_code to
    validate_ctx
  LoongArch: BPF: Implement dynamic code modification support
  LoongArch: BPF: Add bpf trampoline support for Loongarch

Tiezhu Yang (1):
  LoongArch: BPF: Add struct ops support for trampoline

 arch/loongarch/include/asm/inst.h |   3 +
 arch/loongarch/kernel/inst.c      |  54 +++
 arch/loongarch/net/bpf_jit.c      | 527 +++++++++++++++++++++++++++++-
 arch/loongarch/net/bpf_jit.h      |   6 +
 4 files changed, 589 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-08-07 10:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 13:12 [PATCH v5 0/5] Support trampoline for LoongArch Chenghao Duan
2025-07-30 13:12 ` [PATCH v5 1/5] LoongArch: Add larch_insn_gen_{beq,bne} helpers Chenghao Duan
2025-07-31  1:41   ` Hengqi Chen
2025-07-30 13:12 ` [PATCH v5 2/5] LoongArch: BPF: Update the code to rename validate_code to validate_ctx Chenghao Duan
2025-07-31  1:44   ` Hengqi Chen
2025-07-30 13:12 ` [PATCH v5 3/5] LoongArch: BPF: Implement dynamic code modification support Chenghao Duan
2025-08-04  2:02   ` Hengqi Chen
2025-08-05  4:10     ` Huacai Chen
2025-08-05  6:30       ` Chenghao Duan
2025-08-05 11:13         ` Huacai Chen
2025-08-05 13:42           ` Vincent Li
2025-08-07 10:26           ` Chenghao Duan
2025-08-04  2:24   ` Hengqi Chen
2025-07-30 13:12 ` [PATCH v5 4/5] LoongArch: BPF: Add bpf trampoline support for Loongarch Chenghao Duan
2025-07-31  2:17   ` Chenghao Duan
2025-08-01  8:04     ` Huacai Chen
2025-08-03 14:17   ` Huacai Chen
2025-07-30 13:12 ` [PATCH v5 5/5] LoongArch: BPF: Add struct ops support for trampoline Chenghao Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).