On Fri, Dec 13, 2019 at 05:09:46PM +0100, Björn Töpel wrote: > On Fri, 13 Dec 2019 at 17:03, Alexei Starovoitov > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > On Fri, Dec 13, 2019 at 7:59 AM Björn Töpel <bjorn.topel@xxxxxxxxx> wrote: > > > > > > On Fri, 13 Dec 2019 at 16:52, Alexei Starovoitov > > > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > > > > > On Fri, Dec 13, 2019 at 7:49 AM Björn Töpel <bjorn.topel@xxxxxxxxx> wrote: > > > > > > > > > > On Fri, 13 Dec 2019 at 16:04, Alexei Starovoitov > > > > > <alexei.starovoitov@xxxxxxxxx> wrote: > > > > > > > > > > > > On Fri, Dec 13, 2019 at 08:51:47AM +0100, Björn Töpel wrote: > > > > > > > > > > > > > > > I hope my guess that compiler didn't inline it is correct. Then extra noinline > > > > > > > > will not hurt and that's the only thing needed to avoid the issue. > > > > > > > > > > > > > > > > > > > > > > I'd say it's broken not marking it as noinline, and I was lucky. It > > > > > > > would break if other BPF entrypoints that are being called from > > > > > > > filter.o would appear. I'll wait for more comments, and respin a v5 > > > > > > > after the weekend. > > > > > > > > > > > > Also noticed that EXPORT_SYMBOL for dispatch function is not necessary atm. > > > > > > Please drop it. It can be added later when need arises. > > > > > > > > > > > > > > > > It's needed for module builds, so I cannot drop it! > > > > > > > > Not following. Which module it's used out of? > > > > > > The trampoline is referenced from bpf_prog_run_xdp(), which is > > > inlined. Without EXPORT, the symbol is not visible for the module. So, > > > if, say i40e, is built as a module, you'll get a linker error. > > > > I'm still not following. i40e is not using this dispatch logic any more. > > Hmm, *all* XDP users uses it, but indirectly via bpf_prog_run_xdp(). > All drivers that execute an XDP program, does that via the > bpf_prog_run_xdp(), say, i40e_txrx.c and i40e_xsk.c. > bpf_prog_run_xdp() is inlined and expaned to __BPF_PROG_RUN(), which > calls into the dispatcher trampoline. > > $ nm drivers/net/ethernet/intel/i40e/i40e_xsk.o|grep xdpfunc > U bpf_dispatcher_xdpfunc > > Makes sense? ahh. got it. bpf_prog_run_xdp() is static inline in .h Thank you for explaining!