Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415705 > unrolled thread

[PATCH net-next v2 0/4] arm64 BPF JIT updates

Started byZi Shen Lim <zlim.lnx@gmail.com>
First post2016-06-07 07:30 +0200
Last post2016-06-08 09:40 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next v2 0/4] arm64 BPF JIT updates Zi Shen Lim <zlim.lnx@gmail.com> - 2016-06-07 07:30 +0200
    [PATCH net-next v2 1/4] bpf: fix missing header inclusion Zi Shen Lim <zlim.lnx@gmail.com> - 2016-06-07 07:30 +0200
    [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND Zi Shen Lim <zlim.lnx@gmail.com> - 2016-06-07 07:30 +0200
    [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL Zi Shen Lim <zlim.lnx@gmail.com> - 2016-06-07 07:30 +0200
    Re: [PATCH net-next v2 0/4] arm64 BPF JIT updates David Miller <davem@davemloft.net> - 2016-06-08 09:40 +0200

#1415705 — [PATCH net-next v2 0/4] arm64 BPF JIT updates

FromZi Shen Lim <zlim.lnx@gmail.com>
Date2016-06-07 07:30 +0200
Subject[PATCH net-next v2 0/4] arm64 BPF JIT updates
Message-ID<rHhKp-6U6-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1415709 — [PATCH net-next v2 1/4] bpf: fix missing header inclusion

FromZi Shen Lim <zlim.lnx@gmail.com>
Date2016-06-07 07:30 +0200
Subject[PATCH net-next v2 1/4] bpf: fix missing header inclusion
Message-ID<rHhKq-6U6-15@gated-at.bofh.it>
In reply to#1415705
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

[toc] | [prev] | [next] | [standalone]


#1415710 — [PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND

FromZi Shen Lim <zlim.lnx@gmail.com>
Date2016-06-07 07:30 +0200
Subject[PATCH net-next v2 4/4] arm64: bpf: optimize LD_ABS, LD_IND
Message-ID<rHhKq-6U6-17@gated-at.bofh.it>
In reply to#1415705
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

[toc] | [prev] | [next] | [standalone]


#1415711 — [PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL

FromZi Shen Lim <zlim.lnx@gmail.com>
Date2016-06-07 07:30 +0200
Subject[PATCH net-next v2 3/4] arm64: bpf: optimize JMP_CALL
Message-ID<rHhKq-6U6-19@gated-at.bofh.it>
In reply to#1415705
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

[toc] | [prev] | [next] | [standalone]


#1416985

FromDavid Miller <davem@davemloft.net>
Date2016-06-08 09:40 +0200
Message-ID<rHGfL-5Ap-19@gated-at.bofh.it>
In reply to#1415705
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web