Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-14 Thread Alexei Starovoitov
On Tue, Jul 14, 2020 at 1:55 PM Maciej Fijalkowski wrote: > > On Mon, Jul 13, 2020 at 08:36:30PM -0700, Alexei Starovoitov wrote: > > On Tue, Jul 14, 2020 at 03:00:45AM +0200, Maciej Fijalkowski wrote: > > > On Fri, Jul 10, 2020 at 08:25:20PM -0700, Alexei Starovoitov wrote: > > > > On Fri, Jul 10

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-14 Thread Maciej Fijalkowski
On Mon, Jul 13, 2020 at 08:36:30PM -0700, Alexei Starovoitov wrote: > On Tue, Jul 14, 2020 at 03:00:45AM +0200, Maciej Fijalkowski wrote: > > On Fri, Jul 10, 2020 at 08:25:20PM -0700, Alexei Starovoitov wrote: > > > On Fri, Jul 10, 2020 at 8:20 PM Alexei Starovoitov > > > wrote: > > > > > > > > Of

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-13 Thread Alexei Starovoitov
On Tue, Jul 14, 2020 at 03:00:45AM +0200, Maciej Fijalkowski wrote: > On Fri, Jul 10, 2020 at 08:25:20PM -0700, Alexei Starovoitov wrote: > > On Fri, Jul 10, 2020 at 8:20 PM Alexei Starovoitov > > wrote: > > > > > > Of course you are right. > > > pop+nop+push is incorrect. > > > > > > How about th

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-13 Thread Maciej Fijalkowski
On Fri, Jul 10, 2020 at 08:25:20PM -0700, Alexei Starovoitov wrote: > On Fri, Jul 10, 2020 at 8:20 PM Alexei Starovoitov > wrote: > > > > Of course you are right. > > pop+nop+push is incorrect. > > > > How about the following instead: > > - during JIT: > > emit_jump(to_skip_below) <- poke->tailca

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-10 Thread Alexei Starovoitov
On Fri, Jul 10, 2020 at 8:20 PM Alexei Starovoitov wrote: > > Of course you are right. > pop+nop+push is incorrect. > > How about the following instead: > - during JIT: > emit_jump(to_skip_below) <- poke->tailcall_bypass > pop_callee_regs > emit_jump(to_tailcall_target) <- poke->tailcall_target >

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-10 Thread Alexei Starovoitov
On Fri, Jul 10, 2020 at 4:56 PM Alexei Starovoitov wrote: > > On Thu, Jul 02, 2020 at 03:49:29PM +0200, Maciej Fijalkowski wrote: > > This commit serves two things: > > 1) it optimizes BPF prologue/epilogue generation > > 2) it makes possible to have tailcalls within BPF subprogram > > > > Both po

Re: [RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-10 Thread Alexei Starovoitov
On Thu, Jul 02, 2020 at 03:49:29PM +0200, Maciej Fijalkowski wrote: > This commit serves two things: > 1) it optimizes BPF prologue/epilogue generation > 2) it makes possible to have tailcalls within BPF subprogram > > Both points are related to each other since without 1), 2) could not be > achie

[RFC PATCH bpf-next 4/5] bpf, x64: rework pro/epilogue and tailcall handling in JIT

2020-07-02 Thread Maciej Fijalkowski
This commit serves two things: 1) it optimizes BPF prologue/epilogue generation 2) it makes possible to have tailcalls within BPF subprogram Both points are related to each other since without 1), 2) could not be achieved. In [1], Alexei says: "The prologue will look like: nop5 xor eax,eax  // tw