On Tue, Oct 22, 2019 at 12:06 PM Samudrala, Sridhar <sridhar.samudrala@xxxxxxxxx> wrote: > > OK. Here is another data point that shows the perf report with the same test but CPU mitigations > turned OFF. Here bpf_prog overhead goes down from almost (10.18 + 4.51)% to (3.23 + 1.44%). > > 21.40% ksoftirqd/28 [i40e] [k] i40e_clean_rx_irq_zc > 14.13% xdpsock [i40e] [k] i40e_clean_rx_irq_zc > 8.33% ksoftirqd/28 [kernel.vmlinux] [k] xsk_rcv > 6.09% ksoftirqd/28 [kernel.vmlinux] [k] xdp_do_redirect > 5.19% xdpsock xdpsock [.] main > 3.48% ksoftirqd/28 [kernel.vmlinux] [k] bpf_xdp_redirect_map > 3.23% ksoftirqd/28 bpf_prog_3c8251c7e0fef8db [k] bpf_prog_3c8251c7e0fef8db > > So a major component of the bpf_prog overhead seems to be due to the CPU vulnerability mitigations. I feel that it's an incorrect conclusion because JIT is not doing any retpolines (because there are no indirect calls in bpf). There should be no difference in bpf_prog runtime with or without mitigations. Also you're running root, so no spectre mitigations either. This 3% seems like a lot for a function that does few loads that should hit d-cache and one direct call. Please investigate why you're seeing this 10% cpu cost when mitigations are on. perf report/annotate is the best. Also please double check that you're using the latest perf. Since bpf performance analysis was greatly improved several versions ago. I don't think old perf will be showing bogus numbers, but better to run the latest. > The other component is the bpf_xdp_redirect_map() codepath. > > Let me know if it helps to collect any other data that should further help with the perf analysis. >