Re: [PATCH v4 net-next] arm: eBPF JIT compiler
Hi David, On Tue, Aug 22, 2017 at 10:02 PM, David Miller wrote: > > You posted this 4 times. :-( > > I hope I applied the right one. All 4 of these are the same patch. I mistakenly sent it 4 times. My apologies for that. > > Go check net-next and please send me any necessary fix up patches. I just checked. Its the correct patch. Thanks a lot David. :)
Re: [PATCH v4 net-next] arm: eBPF JIT compiler
You posted this 4 times. :-( I hope I applied the right one. Go check net-next and please send me any necessary fix up patches. Thanks.
Re: [PATCH v4 net-next] arm: eBPF JIT compiler
On 08/22/2017 05:08 PM, Daniel Borkmann wrote: On 08/22/2017 08:36 AM, Shubham Bansal wrote: [...] + +static int out_offset = -1; /* initialized on the first pass of build_body() */ Hm, why is this a global var actually? There can be multiple parallel calls to bpf_int_jit_compile(), we don't take a global lock on this. Unless I'm missing something this should really reside in jit_ctx, no? Hm, okay, it's for generating the out jmp offsets in tail call emission which are supposed to always be the same relative offsets; should be fine then. Given this is on emit_bpf_tail_call(), did you get tail calls working the way I suggested to test? +static int emit_bpf_tail_call(struct jit_ctx *ctx) { [...] +const int idx0 = ctx->idx; +#define cur_offset (ctx->idx - idx0) +#define jmp_offset (out_offset - (cur_offset)) [...] + +/* out: */ +if (out_offset == -1) +out_offset = cur_offset; +if (cur_offset != out_offset) { +pr_err_once("tail_call out_offset = %d, expected %d!\n", +cur_offset, out_offset); +return -1; +} +return 0; +#undef cur_offset +#undef jmp_offset }
Re: [PATCH v4 net-next] arm: eBPF JIT compiler
On 08/22/2017 08:36 AM, Shubham Bansal wrote: [...] + +static int out_offset = -1; /* initialized on the first pass of build_body() */ Hm, why is this a global var actually? There can be multiple parallel calls to bpf_int_jit_compile(), we don't take a global lock on this. Unless I'm missing something this should really reside in jit_ctx, no? Given this is on emit_bpf_tail_call(), did you get tail calls working the way I suggested to test? +static int emit_bpf_tail_call(struct jit_ctx *ctx) { [...] + const int idx0 = ctx->idx; +#define cur_offset (ctx->idx - idx0) +#define jmp_offset (out_offset - (cur_offset)) [...] + + /* out: */ + if (out_offset == -1) + out_offset = cur_offset; + if (cur_offset != out_offset) { + pr_err_once("tail_call out_offset = %d, expected %d!\n", + cur_offset, out_offset); + return -1; + } + return 0; +#undef cur_offset +#undef jmp_offset }
Re: [PATCH v4 net-next] arm: eBPF JIT compiler
Please ignore this mail. Sent it by mistake. Sent the correct patch later on.
Re: [PATCH v4 net-next] arm: eBPF JIT compiler
Russell, David, Alexei, Daniel and Kees. Please check this patch and lets finish it. Thanks.