Re: [PATCH net-next 2/3] arm64: bpf: optimize JMP_CALL

2016-06-06 Thread Z Lim
Hi Will, On Mon, Jun 6, 2016 at 10:05 AM, Will Deacon wrote: > On Sat, Jun 04, 2016 at 03:00:29PM -0700, Zi Shen Lim wrote: >> Remove superfluous stack frame, saving us 3 instructions for >> every JMP_CALL. >> >> Signed-off-by: Zi Shen Lim >> --- >> arch/arm64/net/bpf_jit_comp.c | 3 --- >> 1 f

Re: [PATCH net-next 1/3] arm64: bpf: implement bpf_tail_call() helper

2016-06-05 Thread Z Lim
Hi Daniel, On Sun, Jun 5, 2016 at 12:53 AM, Daniel Borkmann wrote: > On 06/05/2016 01:46 AM, kbuild test robot wrote: >> >> Hi, >> >> [auto build test ERROR on net-next/master] >> >> url: >> https://github.com/0day-ci/linux/commits/Zi-Shen-Lim/arm64-bpf-implement-bpf_tail_call-helper/20160605-060

Re: [PATCH net-next] bpf: arm64: remove callee-save registers use for tmp registers

2016-05-16 Thread Z Lim
Hi Yang, On Mon, May 16, 2016 at 4:09 PM, Yang Shi wrote: > In the current implementation of ARM64 eBPF JIT, R23 and R24 are used for > tmp registers, which are callee-saved registers. This leads to variable size > of JIT prologue and epilogue. The latest blinding constant change prefers to > con

Re: [PATCH net-next 2/5] bpf: move clearing of A/X into classic to eBPF migration prologue

2015-12-17 Thread Z Lim
On Thu, Dec 17, 2015 at 2:51 PM, Daniel Borkmann wrote: > Back in the days where eBPF (or back then "internal BPF" ;->) was not > exposed to user space, and only the classic BPF programs internally > translated into eBPF programs, we missed the fact that for classic BPF > A and X needed to be clea

Re: [PATCH] arm64: bpf: fix buffer pointer

2015-11-18 Thread Z Lim
On Wed, Nov 18, 2015 at 1:07 PM, Shi, Yang wrote: > On 11/18/2015 12:56 AM, Zi Shen Lim wrote: >> emit_a64_mov_i64(r3, size, ctx); >> - emit(A64_ADD_I(1, r4, fp, MAX_BPF_STACK), ctx); >> + emit(A64_SUB_I(1, r4, fp, STACK_SIZE), ctx); > > > Should not it

Re: [PATCH V4 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS

2015-11-16 Thread Z Lim
On Mon, Nov 16, 2015 at 2:35 PM, Yang Shi wrote: > Save and restore FP/LR in BPF prog prologue and epilogue, save SP to FP > in prologue in order to get the correct stack backtrace. > > However, ARM64 JIT used FP (x29) as eBPF fp register, FP is subjected to > change during function call so it may

Re: [PATCH V3 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS

2015-11-13 Thread Z Lim
Yang, I noticed another thing... On Fri, Nov 13, 2015 at 10:09 AM, Yang Shi wrote: > Save and restore FP/LR in BPF prog prologue and epilogue, save SP to FP > in prologue in order to get the correct stack backtrace. > > However, ARM64 JIT used FP (x29) as eBPF fp register, FP is subjected to > ch

Re: [PATCH 1/2] arm64: bpf: add 'store immediate' instruction

2015-11-12 Thread Z Lim
On Thu, Nov 12, 2015 at 11:33 AM, Shi, Yang wrote: > On 11/11/2015 4:39 AM, Will Deacon wrote: >> >> Wait a second, we're both talking rubbish here :) The STR (immediate) >> form is referring to the addressing mode, whereas this patch wants to >> store an immediate value to memory, which does need

Re: [PATCH 2/2] arm64: bpf: make BPF prologue and epilogue align with ARM64 AAPCS

2015-11-12 Thread Z Lim
On Thu, Nov 12, 2015 at 1:57 PM, Yang Shi wrote: > > Save and restore FP/LR in BPF prog prologue and epilogue, save SP to FP > in prologue in order to get the correct stack backtrace. > > However, ARM64 JIT used FP (x29) as eBPF fp register, FP is subjected to > change during function call so it m

Re: [PATCH 1/2] arm64: bpf: fix JIT frame pointer setup

2015-11-12 Thread Z Lim
On Thu, Nov 12, 2015 at 1:57 PM, Yang Shi wrote: > BPF fp should point to the top of the BPF prog stack. The original > implementation made it point to the bottom incorrectly. > Move A64_SP to fp before reserve BPF prog stack space. > > CC: Zi Shen Lim > CC: Xi Wang > Signed-off-by: Yang Shi >

Re: [PATCH] arm64: bpf: fix JIT stack setup

2015-11-10 Thread Z Lim
On Tue, Nov 10, 2015 at 11:46 AM, Shi, Yang wrote: > On 11/9/2015 12:00 PM, Z Lim wrote: >> >> How about splitting this into two patches? One for the BPF-related >> bug, and another for A64 FP-handling. > > I'm not sure if this is a good approach or not. IMHO, th

Re: [PATCH 2/2] arm64: bpf: add BPF XADD instruction

2015-11-10 Thread Z Lim
Yang, On Tue, Nov 10, 2015 at 4:42 PM, Alexei Starovoitov wrote: > On Tue, Nov 10, 2015 at 04:26:02PM -0800, Shi, Yang wrote: >> On 11/10/2015 4:08 PM, Eric Dumazet wrote: >> >On Tue, 2015-11-10 at 14:41 -0800, Yang Shi wrote: >> >>aarch64 doesn't have native support for XADD instruction, impleme

Re: [PATCH 1/2] arm64: bpf: add 'store immediate' instruction

2015-11-10 Thread Z Lim
On Tue, Nov 10, 2015 at 2:41 PM, Yang Shi wrote: > aarch64 doesn't have native store immediate instruction, such operation Actually, aarch64 does have "STR (immediate)". For arm64 JIT, we can consider using it as an optimization. You may also want to consider adding a note about the correspondin

Re: [PATCH] arm64: bpf: fix JIT stack setup

2015-11-09 Thread Z Lim
On Mon, Nov 9, 2015 at 10:08 AM, Shi, Yang wrote: > I added it to stay align with ARMv8 AAPCS to maintain the correct FP during > function call. It makes us get correct stack backtrace. > > I think we'd better to keep compliant with ARMv8 AAPCS in BPF JIT prologue > too. > > If nobody thinks it is

Re: [PATCH] arm64: bpf: fix JIT stack setup

2015-11-08 Thread Z Lim
On Sat, Nov 7, 2015 at 6:27 PM, Alexei Starovoitov wrote: > On Fri, Nov 06, 2015 at 09:36:17PM -0800, Yang Shi wrote: >> ARM64 JIT used FP (x29) as eBPF fp register, but FP is subjected to >> change during function call so it may cause the BPF prog stack base address >> change too. Whenever, it po

Re: [PATCH] bpf: add mod default A and X test cases

2015-11-04 Thread Z Lim
On Wed, Nov 4, 2015 at 11:36 AM, Yang Shi wrote: > When running "mod X" operation, if X is 0 the filter has to be halt. > Add new test cases to cover A = A mod X if X is 0, and A = A mod 1. > > CC: Xi Wang > CC: Zi Shen Lim > Signed-off-by: Yang Shi > --- Acked-by: Zi Shen Lim -- To unsubscri