ARM: net: JIT compiler for packet filters
Subsystems (5)
PATCH RESEND v8 1/1 ARM: net: JIT compiler for packet filters
Based of Matt Evans's PPC64 implementation.
The compiler generates ARM instructions but interworking is supported for Thumb2 kernels.
Supports both little and big endian. Unaligned loads are emitted for ARMv6+. Not all the BPF opcodes that deal with ancillary data are supported. The scratch memory of the filter lives on the stack. Hardware integer division is used if it is available.
Enabled in the same way as for x86-64 and PPC64:
echo 1 > /proc/sys/net/core/bpf_jit_enable
A value greater than 1 enables opcode output.
---
Changes in v8:
* skb_copy_bits() return value check in LDX_MSH
* immediate value as signed integer for absolute loads
Changes in v7:
* fix the intruction generation for LDX_MSH, OR_X, LSH_K, RSH_K and JMP_JA
* fix the condition for saving the A register
* use fls() instead of the compiler builtin
* punt to the interpreter on absolute loads with K < 0
* check for invalid data references
* support the NEG opcode
* clear X in the prologue based on a context flag
* simplify the conditional jumps
Changes in v6:
* fix the code generation for the ANC_CPU opcode
Changes in v5:
* replace SEEN_LEN with SEEN_SKB
* set ctx->seen when handling some ancillary data opcodes
Changes in v4:
* first check if the JIT compiler is enabled
* fix the code generation for the LDX_MSH opcode
Changes in v3:
* no longer depend on EABI and !Thumb2
* add BLX "emulation" for ARMv4 without Thumb
* use the integer divide instruction on Cortex-A15
* fix the handling of the DIV_K opcode
* use a C wrapper for __aeabi_uidiv
* fix the generation of the epilogue (non-FP case)
Changes in v2:
* enable the compiler only for ARMv5+ because of the BLX instruction
* use the same comparison for the ARM version checks
* use misaligned accesses on ARMv6
* fix the SEEN_MEM
* fix the mem_words_used()
arch/arm/Kconfig | 1 + arch/arm/Makefile | 1 + arch/arm/net/Makefile | 3 + arch/arm/net/bpf_jit_32.c | 916 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/net/bpf_jit_32.h | 190 ++++++++++ 5 files changed, 1111 insertions(+), 0 deletions(-) create mode 100644 arch/arm/net/Makefile create mode 100644 arch/arm/net/bpf_jit_32.c create mode 100644 arch/arm/net/bpf_jit_32.h
arch/arm/Kconfig +1 -0
@@ -32,6 +32,7 @@ config ARM select GENERIC_IRQ_SHOW select CPU_PM if (SUSPEND || CPU_IDLE) select GENERIC_PCI_IOMAP + select HAVE_BPF_JIT help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
arch/arm/Makefile +1 -0
@@ -252,6 +252,7 @@ core-$(CONFIG_VFP) += arch/arm/vfp/ # If we have a machine-specific directory, then include it in the build. core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ +core-y += arch/arm/net/ core-y += $(machdirs) $(platdirs) drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
arch/arm/net/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# ARM-specific networking code + +obj-$(CONFIG_BPF_JIT) += bpf_jit_32.o
arch/arm/net/bpf_jit_32.c new file +916 -0
916 lines not on this page · raw message
arch/arm/net/bpf_jit_32.h new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
1.7.9.1
David Miller
maintainerI would like to see this merged however is feasible, this has been in a catatonic state for two releases and waiting longer isn't going to improve things enough to justify any further delay.
Am 19.03.2012 22:20, schrieb David Miller:
Quoted 3 lines
I would like to see this merged however is feasible, this has been in a catatonic state for two releases and waiting longer isn't going to improve things enough to justify any further delay.
It has been merged into the ARM tree more than a week ago, but unfortunately it seems it will not make it into 3.4.
Mircea
Quoted 7 lines · Mircea Gherzan
Am 19.03.2012 22:20, schrieb David Miller:
Quoted 3 lines
I would like to see this merged however is feasible, this has been in a catatonic state for two releases and waiting longer isn't going to improve things enough to justify any further delay.
It has been merged into the ARM tree more than a week ago, but unfortunately it seems it will not make it into 3.4.
Why do you say that?
Am 25.03.2012 11:57, schrieb Russell King - ARM Linux:
Quoted 10 lines · Mircea Gherzan
Quoted 7 lines
Am 19.03.2012 22:20, schrieb David Miller:
Quoted 3 lines
I would like to see this merged however is feasible, this has been in a catatonic state for two releases and waiting longer isn't going to improve things enough to justify any further delay.
It has been merged into the ARM tree more than a week ago, but unfortunately it seems it will not make it into 3.4.
Why do you say that?
The patch is nowhere to be found in any of the branches of your linaro.org tree, the tree from which Linus pulls.
Quoted 7 lines · Mircea Gherzan
Am 25.03.2012 11:57, schrieb Russell King - ARM Linux:
Quoted 6 lines · Mircea Gherzan
Quoted 5 lines
Am 19.03.2012 22:20, schrieb David Miller:
Quoted 3 lines
I would like to see this merged however is feasible, this has been in a catatonic state for two releases and waiting longer isn't going to improve things enough to justify any further delay.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
It has been merged into the ARM tree more than a week ago, but unfortunately it seems it will not make it into 3.4.
Why do you say that?
The patch is nowhere to be found in any of the branches of your linaro.org tree, the tree from which Linus pulls.
I only push stuff out there just before asking Linus to pull. The main tree is on zeniv aka ftp.arm.linux.org.uk as detailed on my website which does contain your patch - and its this tree with linux-next fetches.
As Linus is away on an extended weekend, don't expect to see many more pushes from me before Monday/Tuesday.
But, rest assured, I _am_ intending sending it for this merge window.
Mircea, could you please supply an ack for the below fix to silence a warning. Thanks.
8<=====
ARM: fix Kconfig warning for HAVE_BPF_JIT
Last night's randconfig and the allnoconfig builds spat out the following warning while building:
warning: (ARM) selects HAVE_BPF_JIT which has unmet direct dependencies (NET)
--- arch/arm/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/Kconfig +1 -1
@@ -33,7 +33,7 @@ config ARM select GENERIC_IRQ_SHOW select CPU_PM if (SUSPEND || CPU_IDLE) select GENERIC_PCI_IOMAP - select HAVE_BPF_JIT + select HAVE_BPF_JIT if NET help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
Mircea Gherzan
Acked-by2012/3/27 Russell King - ARM Linux <[email protected]>:
Quoted 21 lines
Mircea, could you please supply an ack for the below fix to silence a warning. ?Thanks.
8<=====
ARM: fixKconfigwarning forHAVE_BPF_JITLast night's randconfig and the allnoconfig builds spat out the following warning while building:
warning: (ARM) selects
HAVE_BPF_JITwhich has unmet direct dependencies (NET)Signed-off-by Russell King <[email protected]>---
?arch/arm/Kconfig | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/Kconfig +0
-0@@ -33,7 +33,7 @@ config ARM
Quoted 8 lines
? ? ? ?select
GENERIC_IRQ_SHOW
? ? ? ?selectCPU_PMif (SUSPEND ||CPU_IDLE)
? ? ? ?selectGENERIC_PCI_IOMAP
- ? ? ? selectHAVE_BPF_JIT
+ ? ? ? selectHAVE_BPF_JITif NET
? ? ? ?help
? ? ? ? ?The ARM series is a line of low-power-consumption RISC chip designs ? ? ? ? ?licensed by ARM Ltd and targeted at embedded applications and