On 2016/06/22 12:42PM, Naveen N Rao wrote: > On 2016/06/21 11:47AM, Thadeu Lima de Souza Cascardo wrote: > > On Tue, Jun 21, 2016 at 09:15:48PM +1000, Michael Ellerman wrote: > > > On Tue, 2016-06-21 at 14:28 +0530, Naveen N. Rao wrote: > > > > On 2016/06/20 03:56PM, Thadeu Lima de Souza Cascardo wrote: > > > > > On Sun, Jun 19, 2016 at 11:19:14PM +0530, Naveen N. Rao wrote: > > > > > > On 2016/06/17 10:00AM, Thadeu Lima de Souza Cascardo wrote: > > > > > > > > > > > > > > Hi, Michael and Naveen. > > > > > > > > > > > > > > I noticed independently that there is a problem with BPF JIT and > > > > > > > ABIv2, and > > > > > > > worked out the patch below before I noticed Naveen's patchset and > > > > > > > the latest > > > > > > > changes in ppc tree for a better way to check for ABI versions. > > > > > > > > > > > > > > However, since the issue described below affect mainline and > > > > > > > stable kernels, > > > > > > > would you consider applying it before merging your two patchsets, > > > > > > > so that we can > > > > > > > more easily backport the fix? > > > > > > > > > > > > Hi Cascardo, > > > > > > Given that this has been broken on ABIv2 since forever, I didn't > > > > > > bother > > > > > > fixing it. But, I can see why this would be a good thing to have > > > > > > for > > > > > > -stable and existing distros. However, while your patch below may > > > > > > fix > > > > > > the crash you're seeing on ppc64le, it is not sufficient -- you'll > > > > > > need > > > > > > changes in bpf_jit_asm.S as well. > > > > > > > > > > Hi, Naveen. > > > > > > > > > > Any tips on how to exercise possible issues there? Or what changes > > > > > you think > > > > > would be sufficient? > > > > > > > > The calling convention is different with ABIv2 and so we'll need > > > > changes > > > > in bpf_slow_path_common() and sk_negative_common(). > > > > > > How big would those changes be? Do we know?
So, this does need quite a few changes: - the skb helpers need to emit code to setup TOC and the JIT code needs to be updated to setup r12. - the slow path code needs to be changed to store r3 elsewhere on ABIv2 - the above also means we need to change the stack macros with the proper ABIv2 values - the little endian support isn't complete as well -- some of the skb helpers are not using byte swap instructions. As such, I think we should just disable classic JIT on ppc64le. - Naveen