linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net: mitigate retpoline overhead
@ 2018-12-05 18:13 Paolo Abeni
  2018-12-05 18:13 ` [PATCH net-next v2 1/4] indirect call wrappers: helpers to speed-up indirect calls of builtin Paolo Abeni
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Paolo Abeni @ 2018-12-05 18:13 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Eric Dumazet, Paul Turner, linux-kernel

The spectre v2 counter-measures, aka retpolines, are a source of measurable
overhead[1]. We can partially address that when the function pointer refers to
a builtin symbol resorting to a list of tests vs well-known builtin function and
direct calls.

Experimental results show that replacing a single indirect call via
retpoline with several branches and a direct call gives performance gains
even when multiple branches are added - 5 or more, as reported in [2].

This may lead to some uglification around the indirect calls. In netconf 2018
Eric Dumazet described a technique to hide the most relevant part of the needed
boilerplate with some macro help.

This series is a [re-]implementation of such idea, exposing the introduced
helpers in a new header file. They are later leveraged to avoid the indirect
call overhead in the GRO path, when possible.

Overall this gives > 10% performance improvement for UDP GRO benchmark and
smaller but measurable for TCP syn flood.

The added infra can be used in follow-up patches to cope with retpoline overhead
in other points of the networking stack (e.g. at the qdisc layer) and possibly
even in other subsystems.

rfc -> v1:
 - use branch prediction hints, as suggested by Eric

v1  -> v2:
 - list explicitly the builtin function names in INDIRECT_CALL_*()
 - expand the recipients list

[1] http://vger.kernel.org/netconf2018_files/PaoloAbeni_netconf2018.pdf
[2] https://linuxplumbersconf.org/event/2/contributions/99/attachments/98/117/lpc18_paper_af_xdp_perf-v2.pdf

Paolo Abeni (4):
  indirect call wrappers: helpers to speed-up indirect calls of builtin
  net: use indirect call wrappers at GRO network layer
  net: use indirect call wrappers at GRO transport layer
  udp: use indirect call wrappers for GRO socket lookup

 include/linux/indirect_call_wrapper.h | 51 +++++++++++++++++++++++++++
 include/net/inet_common.h             |  9 +++++
 net/core/dev.c                        | 15 ++++++--
 net/ipv4/af_inet.c                    | 13 +++++--
 net/ipv4/tcp_offload.c                |  6 ++--
 net/ipv4/udp_offload.c                | 15 +++++---
 net/ipv6/ip6_offload.c                | 18 +++++++---
 net/ipv6/tcpv6_offload.c              |  7 ++--
 net/ipv6/udp_offload.c                |  7 ++--
 9 files changed, 119 insertions(+), 22 deletions(-)
 create mode 100644 include/linux/indirect_call_wrapper.h

-- 
2.19.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-12-21  2:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 18:13 [PATCH net-next v2 0/4] net: mitigate retpoline overhead Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 1/4] indirect call wrappers: helpers to speed-up indirect calls of builtin Paolo Abeni
2018-12-07  9:46   ` David Woodhouse
2018-12-07 20:46     ` Paolo Abeni
2018-12-07 21:46       ` David Woodhouse
2018-12-11 22:28         ` Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 2/4] net: use indirect call wrappers at GRO network layer Paolo Abeni
2018-12-05 18:13 ` [PATCH net-next v2 3/4] net: use indirect call wrappers at GRO transport layer Paolo Abeni
2018-12-21  2:57   ` Stephen Hemminger
2018-12-05 18:13 ` [PATCH net-next v2 4/4] udp: use indirect call wrappers for GRO socket lookup Paolo Abeni
2018-12-06  4:49 ` [PATCH net-next v2 0/4] net: mitigate retpoline overhead David Miller
2018-12-07  6:24 ` David Miller
2018-12-07  6:28   ` David Miller
2018-12-07 20:29     ` Paolo Abeni
2018-12-07 21:06       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).