Re: [PATCH] bpf: optimize constant blinding

2019-06-19 Thread Jiong Wang
Edward Cree writes: > On 17/06/2019 21:40, Jiong Wang wrote: >> Now if we don't split patch when patch an insn inside patch, instead, if we >> replace the patched insn using what you suggested, then the logic looks to >> me becomes even more complex, something like >> >>for (idx = 0; idx < i

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Edward Cree
On 17/06/2019 21:40, Jiong Wang wrote: > Now if we don't split patch when patch an insn inside patch, instead, if we > replace the patched insn using what you suggested, then the logic looks to > me becomes even more complex, something like > >for (idx = 0; idx < insn_cnt; idx++) { > if (i

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Jiong Wang
Alexei Starovoitov writes: > On Mon, Jun 17, 2019 at 1:40 PM Jiong Wang wrote: >> >> After digest Alexei and Andrii's reply, I still don't see the need to turn >> branch target into list, and I am not sure whether pool based list sound >> good? it saves size, resize pool doesn't invalid allocat

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Alexei Starovoitov
On Mon, Jun 17, 2019 at 1:40 PM Jiong Wang wrote: > > After digest Alexei and Andrii's reply, I still don't see the need to turn > branch target into list, and I am not sure whether pool based list sound > good? it saves size, resize pool doesn't invalid allocated node (the offset > doesn't change

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Jiong Wang
Edward Cree writes: > On 17/06/2019 20:59, Jiong Wang wrote: >> Edward Cree writes: >> >>> On 14/06/2019 16:13, Jiong Wang wrote: Just an update and keep people posted. Working on linked list based approach, the implementation looks like the following, mostly a combine of dis

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Edward Cree
On 17/06/2019 20:59, Jiong Wang wrote: > Edward Cree writes: > >> On 14/06/2019 16:13, Jiong Wang wrote: >>> Just an update and keep people posted. >>> >>> Working on linked list based approach, the implementation looks like the >>> following, mostly a combine of discussions happened and Naveen's p

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Jiong Wang
Edward Cree writes: > On 14/06/2019 16:13, Jiong Wang wrote: >> Just an update and keep people posted. >> >> Working on linked list based approach, the implementation looks like the >> following, mostly a combine of discussions happened and Naveen's patch, >> please feel free to comment. >> >>

Re: [PATCH] bpf: optimize constant blinding

2019-06-17 Thread Edward Cree
On 14/06/2019 16:13, Jiong Wang wrote: > Just an update and keep people posted. > > Working on linked list based approach, the implementation looks like the > following, mostly a combine of discussions happened and Naveen's patch, > please feel free to comment. > > - Use the reserved opcode 0xf0

Re: [PATCH] bpf: optimize constant blinding

2019-06-14 Thread Andrii Nakryiko
On Fri, Jun 14, 2019 at 10:06 AM Alexei Starovoitov wrote: > > On Fri, Jun 14, 2019 at 8:13 AM Jiong Wang wrote: > > > > > > Alexei Starovoitov writes: > > > > > On Wed, Jun 12, 2019 at 8:25 AM Jiong Wang > > > wrote: > > >> > > >> > > >> Jiong Wang writes: > > >> > > >> > Alexei Starovoitov wr

Re: [PATCH] bpf: optimize constant blinding

2019-06-14 Thread Alexei Starovoitov
On Fri, Jun 14, 2019 at 8:13 AM Jiong Wang wrote: > > > Alexei Starovoitov writes: > > > On Wed, Jun 12, 2019 at 8:25 AM Jiong Wang wrote: > >> > >> > >> Jiong Wang writes: > >> > >> > Alexei Starovoitov writes: > >> > > >> >> On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao > >> >> wrote: > >> >>>

Re: [PATCH] bpf: optimize constant blinding

2019-06-14 Thread Jiong Wang
Alexei Starovoitov writes: > On Wed, Jun 12, 2019 at 8:25 AM Jiong Wang wrote: >> >> >> Jiong Wang writes: >> >> > Alexei Starovoitov writes: >> > >> >> On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao >> >> wrote: >> >>> >> >>> Currently, for constant blinding, we re-allocate the bpf program to

Re: [PATCH] bpf: optimize constant blinding

2019-06-13 Thread kbuild test robot
Hi "Naveen, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] [also build test WARNING on v5.2-rc4 next-20190613] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/li

Re: [PATCH] bpf: optimize constant blinding

2019-06-12 Thread Alexei Starovoitov
On Wed, Jun 12, 2019 at 8:25 AM Jiong Wang wrote: > > > Jiong Wang writes: > > > Alexei Starovoitov writes: > > > >> On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao > >> wrote: > >>> > >>> Currently, for constant blinding, we re-allocate the bpf program to > >>> account for its new size and adjust

Re: [PATCH] bpf: optimize constant blinding

2019-06-12 Thread Jiong Wang
Jiong Wang writes: > Alexei Starovoitov writes: > >> On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao >> wrote: >>> >>> Currently, for constant blinding, we re-allocate the bpf program to >>> account for its new size and adjust all branches to accommodate the >>> same, for each BPF instruction tha

Re: [PATCH] bpf: optimize constant blinding

2019-06-12 Thread Jiong Wang
Alexei Starovoitov writes: > On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao > wrote: >> >> Currently, for constant blinding, we re-allocate the bpf program to >> account for its new size and adjust all branches to accommodate the >> same, for each BPF instruction that needs constant blinding. Th

Re: [PATCH] bpf: optimize constant blinding

2019-06-12 Thread Alexei Starovoitov
On Wed, Jun 12, 2019 at 4:32 AM Naveen N. Rao wrote: > > Currently, for constant blinding, we re-allocate the bpf program to > account for its new size and adjust all branches to accommodate the > same, for each BPF instruction that needs constant blinding. This is > inefficient and can lead to so

[PATCH] bpf: optimize constant blinding

2019-06-12 Thread Naveen N. Rao
Currently, for constant blinding, we re-allocate the bpf program to account for its new size and adjust all branches to accommodate the same, for each BPF instruction that needs constant blinding. This is inefficient and can lead to soft lockup with sufficiently large programs, such as the new veri