* [PATCH net-next v2 0/4] arm64 BPF JIT updates
@ 2016-06-07 5:22 Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 1/4] bpf: fix missing header inclusion Zi Shen Lim
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Zi Shen Lim @ 2016-06-07 5:22 UTC (permalink / raw)
To: David S. Miller, Catalin Marinas, Will Deacon
Cc: Zi Shen Lim, Yang Shi, Alexei Starovoitov, Daniel Borkmann,
netdev, linux-arm-kernel, linux-kernel
Updates for arm64 eBPF JIT.
The main addition here is implementation of bpf_tail_call.
#1: Fix missing header inclusion in linux/bpf.h.
#2: Add bpf_tail_call for arm64.
#3,4: Optimizations to reduce instruction count for jitted code.
Changes since v1:
- Added patch #1 to address build error due to missing header inclusion
in linux/bpf.h. (Thanks to suggestion and ack by Daniel Borkmann)
Ordered it ahead of bpf_tail_call patch #2 so build error is not
triggered.
Zi Shen Lim (4):
bpf: fix missing header inclusion
arm64: bpf: implement bpf_tail_call() helper
arm64: bpf: optimize JMP_CALL
arm64: bpf: optimize LD_ABS, LD_IND
arch/arm64/net/bpf_jit.h | 3 +-
arch/arm64/net/bpf_jit_comp.c | 111 ++++++++++++++++++++++++++++++++++++------
include/linux/bpf.h | 1 +
3 files changed, 99 insertions(+), 16 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2 1/4] bpf: fix missing header inclusion
2016-06-07 5:22 [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim
@ 2016-06-07 5:22 ` Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL Zi Shen Lim
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Zi Shen Lim @ 2016-06-07 5:22 UTC (permalink / raw)
To: David S. Miller, Catalin Marinas, Will Deacon
Cc: Zi Shen Lim, Yang Shi, Alexei Starovoitov, Daniel Borkmann,
netdev, linux-arm-kernel, linux-kernel
Commit 0fc174dea545 ("ebpf: make internal bpf API independent of
CONFIG_BPF_SYSCALL ifdefs") introduced usage of ERR_PTR() in
bpf_prog_get(), however did not include linux/err.h.
Without this patch, when compiling arm64 BPF without CONFIG_BPF_SYSCALL:
...
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h: In function 'bpf_prog_get':
include/linux/bpf.h:235:9: error: implicit declaration of function 'ERR_PTR' [-Werror=implicit-function-declaration]
return ERR_PTR(-EOPNOTSUPP);
^
include/linux/bpf.h:235:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
In file included from include/linux/rwsem.h:17:0,
from include/linux/mm_types.h:10,
from include/linux/sched.h:27,
from arch/arm64/include/asm/compat.h:25,
from arch/arm64/include/asm/stat.h:23,
from include/linux/stat.h:5,
from include/linux/compat.h:12,
from include/linux/filter.h:10,
from arch/arm64/net/bpf_jit_comp.c:22:
include/linux/err.h: At top level:
include/linux/err.h:23:35: error: conflicting types for 'ERR_PTR'
static inline void * __must_check ERR_PTR(long error)
^
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h:235:9: note: previous implicit declaration of 'ERR_PTR' was here
return ERR_PTR(-EOPNOTSUPP);
^
...
Fixes: 0fc174dea545 ("ebpf: make internal bpf API independent of CONFIG_BPF_SYSCALL ifdefs")
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
include/linux/bpf.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 8ee27b8..1bcae82 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -11,6 +11,7 @@
#include <linux/workqueue.h>
#include <linux/file.h>
#include <linux/percpu.h>
+#include <linux/err.h>
struct bpf_map;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL
2016-06-07 5:22 [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 1/4] bpf: fix missing header inclusion Zi Shen Lim
@ 2016-06-07 5:22 ` Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND Zi Shen Lim
2016-06-08 7:30 ` [PATCH net-next v2 0/4] arm64 BPF JIT updates David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Zi Shen Lim @ 2016-06-07 5:22 UTC (permalink / raw)
To: David S. Miller, Catalin Marinas, Will Deacon
Cc: Zi Shen Lim, Yang Shi, Alexei Starovoitov, Daniel Borkmann,
netdev, linux-arm-kernel, linux-kernel
Remove superfluous stack frame, saving us 3 instructions for
every JMP_CALL.
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
---
arch/arm64/net/bpf_jit_comp.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 51abc97..7ae304e 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -578,11 +578,8 @@ emit_cond_jmp:
const u64 func = (u64)__bpf_call_base + imm;
emit_a64_mov_i64(tmp, func, ctx);
- emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
- emit(A64_MOV(1, A64_FP, A64_SP), ctx);
emit(A64_BLR(tmp), ctx);
emit(A64_MOV(1, r0, A64_R(0)), ctx);
- emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
break;
}
/* tail call */
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND
2016-06-07 5:22 [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 1/4] bpf: fix missing header inclusion Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL Zi Shen Lim
@ 2016-06-07 5:22 ` Zi Shen Lim
2016-06-08 7:30 ` [PATCH net-next v2 0/4] arm64 BPF JIT updates David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Zi Shen Lim @ 2016-06-07 5:22 UTC (permalink / raw)
To: David S. Miller, Catalin Marinas, Will Deacon
Cc: Zi Shen Lim, Yang Shi, Alexei Starovoitov, Daniel Borkmann,
netdev, linux-arm-kernel, linux-kernel
Remove superfluous stack frame, saving us 3 instructions for every
LD_ABS or LD_IND.
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
---
arch/arm64/net/bpf_jit_comp.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 7ae304e..b2fc97a 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -731,11 +731,8 @@ emit_cond_jmp:
emit_a64_mov_i64(r3, size, ctx);
emit(A64_SUB_I(1, r4, fp, STACK_SIZE), ctx);
emit_a64_mov_i64(r5, (unsigned long)bpf_load_pointer, ctx);
- emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
- emit(A64_MOV(1, A64_FP, A64_SP), ctx);
emit(A64_BLR(r5), ctx);
emit(A64_MOV(1, r0, A64_R(0)), ctx);
- emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
jmp_offset = epilogue_offset(ctx);
check_imm19(jmp_offset);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2 0/4] arm64 BPF JIT updates
2016-06-07 5:22 [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim
` (2 preceding siblings ...)
2016-06-07 5:22 ` [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND Zi Shen Lim
@ 2016-06-08 7:30 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-06-08 7:30 UTC (permalink / raw)
To: zlim.lnx
Cc: catalin.marinas, will.deacon, yang.shi, ast, daniel, netdev,
linux-arm-kernel, linux-kernel
From: Zi Shen Lim <zlim.lnx@gmail.com>
Date: Mon, 6 Jun 2016 22:22:55 -0700
> Updates for arm64 eBPF JIT.
> The main addition here is implementation of bpf_tail_call.
>
> #1: Fix missing header inclusion in linux/bpf.h.
> #2: Add bpf_tail_call for arm64.
> #3,4: Optimizations to reduce instruction count for jitted code.
>
> Changes since v1:
> - Added patch #1 to address build error due to missing header inclusion
> in linux/bpf.h. (Thanks to suggestion and ack by Daniel Borkmann)
> Ordered it ahead of bpf_tail_call patch #2 so build error is not
> triggered.
>
> Zi Shen Lim (4):
> bpf: fix missing header inclusion
> arm64: bpf: implement bpf_tail_call() helper
> arm64: bpf: optimize JMP_CALL
> arm64: bpf: optimize LD_ABS, LD_IND
I only see patches 1, 3, and 4 on the list.
Please resubmit.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-08 7:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07 5:22 [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 1/4] bpf: fix missing header inclusion Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL Zi Shen Lim
2016-06-07 5:22 ` [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND Zi Shen Lim
2016-06-08 7:30 ` [PATCH net-next v2 0/4] arm64 BPF JIT updates David Miller
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).