[RFC PATCH 0/3] enable bpf_prog_pack allocator for powerpc

Christophe Leroy christophe.leroy at csgroup.eu
Fri Nov 11 22:25:35 AEDT 2022


Le 10/11/2022 à 19:43, Hari Bathini a écrit :
> Most BPF programs are small, but they consume a page each. For systems
> with busy traffic and many BPF programs, this may also add significant
> pressure on instruction TLB. High iTLB pressure usually slows down the
> whole system causing visible performance degradation for production
> workloads.
> 
> bpf_prog_pack, a customized allocator that packs multiple bpf programs
> into preallocated memory chunks, was proposed [1] to address it. This
> series extends this support on powerpc.
> 
> Patches 1 & 2 add the arch specific functions needed to support this
> feature. Patch 3 enables the support for powerpc. The last patch
> ensures cleanup is handled racefully.
> 
> Tested the changes successfully on a PowerVM. patch_instruction(),
> needed for bpf_arch_text_copy(), is failing for ppc32. Debugging it.
> Posting the patches in the meanwhile for feedback on these changes.

I did a quick test on ppc32, I don't get such a problem, only something 
wrong in the dump print as traps intructions only are dumped, but 
tcpdump works as expected:

[   55.692998] bpf_jit_enable = 2 was set! NEVER use this in production, 
only for JIT debugging!
[   66.279259] device eth0 entered promiscuous mode
[   67.214756] Pass 1: shrink = 0, seen = 0x1f980000
[   67.214880] Pass 2: shrink = 0, seen = 0x1f980000
[   67.214966] flen=5 proglen=60 pass=3 image=be7a8038 from=tcpdump pid=459
[   67.225261] JIT code: 00000000: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.233904] JIT code: 00000010: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.242579] JIT code: 00000020: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.249694] JIT code: 00000030: 7f e0 00 08 7f e0 00 08 7f e0 00 08
[   67.259255] Pass 1: shrink = 0, seen = 0x3ff801fe
[   67.259421] Pass 2: shrink = 0, seen = 0x3ff801fe
[   67.259514] flen=40 proglen=504 pass=3 image=be7a80a0 from=tcpdump 
pid=459
[   67.269467] JIT code: 00000000: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.278001] JIT code: 00000010: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.286519] JIT code: 00000020: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.295041] JIT code: 00000030: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.303596] JIT code: 00000040: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.312164] JIT code: 00000050: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.319231] JIT code: 00000060: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.328822] JIT code: 00000070: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.337382] JIT code: 00000080: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.345901] JIT code: 00000090: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.354423] JIT code: 000000a0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.362941] JIT code: 000000b0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.371462] JIT code: 000000c0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.378526] JIT code: 000000d0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.388120] JIT code: 000000e0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.396680] JIT code: 000000f0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.405199] JIT code: 00000100: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.413756] JIT code: 00000110: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.422324] JIT code: 00000120: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.429389] JIT code: 00000130: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.438982] JIT code: 00000140: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.447541] JIT code: 00000150: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.456059] JIT code: 00000160: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.464578] JIT code: 00000170: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.473201] JIT code: 00000180: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.481705] JIT code: 00000190: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.488770] JIT code: 000001a0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.498359] JIT code: 000001b0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.506921] JIT code: 000001c0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.515439] JIT code: 000001d0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.523998] JIT code: 000001e0: 7f e0 00 08 7f e0 00 08 7f e0 00 08 
7f e0 00 08
[   67.532565] JIT code: 000001f0: 7f e0 00 08 7f e0 00 08
[   82.620898] device eth0 left promiscuous mode


> 
> [1] https://lore.kernel.org/bpf/20220204185742.271030-1-song@kernel.org/
> 
> Hari Bathini (3):
>    powerpc/bpf: implement bpf_arch_text_copy
>    powerpc/bpf: implement bpf_arch_text_invalidate for bpf_prog_pack
>    powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]
> 
>   arch/powerpc/net/bpf_jit.h        |  18 +--
>   arch/powerpc/net/bpf_jit_comp.c   | 194 ++++++++++++++++++++++++------
>   arch/powerpc/net/bpf_jit_comp32.c |  26 ++--
>   arch/powerpc/net/bpf_jit_comp64.c |  32 ++---
>   4 files changed, 198 insertions(+), 72 deletions(-)
> 



More information about the Linuxppc-dev mailing list