Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1918291imu; Fri, 14 Dec 2018 02:53:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/V9+cIRaVg0/zRnvspN+RX47gkPKGII1YntgaVim3iDcAUgixq0Qk5sjRBkh5dpDcJ4Hcay X-Received: by 2002:a63:4926:: with SMTP id w38mr2147808pga.353.1544784808670; Fri, 14 Dec 2018 02:53:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544784808; cv=none; d=google.com; s=arc-20160816; b=LNq0ieyW+XEtann6lVVWVam7/IWMHCxUU+U59DxAe4loBwWKCJAKRtmjXwBFzN42pQ ldtw9rZypye7uXTt3aFgdGkOG4vnakLdcV0QzuhL+2XKKEbyETSkFMeTgLUNLmwa6EEr DSTGXvlKPurQrKUuR0l0zhOJFZ0Qf5XjhA2dCj+k32MdPGjH7s1tivaMAj5BOyqrZFdd kdkKf3UPt0J++Riihe4oT2K5uXJitTCqh5AV2ZGkHxfRc1A8aXBC1ANL9BTpdx7wn510 FcjuSoyDgnthTQdbZcXQiOPlSlnOQvQJhcxulwPws8bFxMp1IxK3YFqX60PXIcNr09yR Hcpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yoI1/Yy4e07tevX8AvSF6dVe2+tNK3+e0YFa9fnB5bk=; b=mlHVW+TeHzho2uxnD/lc/hTdCfHkwSPB1OJsYrkJ8DtoTrnmXx/nHC2JodPW4nulDk ggXUa+OtnYCUzA6DJcnydJ+mpLQo2Hwdsg496Q8PTn98QB8YTRG83EdAQ6RYL1PVDkNj weM73fYDyR1sUXMYvPl9adEAPRWzE0P64APpizVdNQLhEB9TGTJKBeC6WA9ru09lqg6m V0KU9NiYZseJYMwyNV2rSGEOmqE7Pwlty8SPMamTWzj9YT+ug+a6gmZwrwH0nWBS6WSw Xj5F/EgL4t8bQ2Kbi/huB7gOQBq+k7jESHOU4fS+XuNWqUU8TUP5oIn2TjZMSboqbFMN kk0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si3917301pgn.390.2018.12.14.02.53.12; Fri, 14 Dec 2018 02:53:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729129AbeLNKwU (ORCPT + 99 others); Fri, 14 Dec 2018 05:52:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33354 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbeLNKwU (ORCPT ); Fri, 14 Dec 2018 05:52:20 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CAE23154852; Fri, 14 Dec 2018 10:52:20 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.32.181.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 965A726FB4; Fri, 14 Dec 2018 10:52:18 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paul Turner , linux-kernel@vger.kernel.org, Edward Cree , David Woodhouse Subject: [PATCH net-next v3 0/4] net: mitigate retpoline overhead Date: Fri, 14 Dec 2018 11:51:56 +0100 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 14 Dec 2018 10:52:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. v2 -> v3: - fix build error with CONFIG_IPV6=m v1 -> v2: - list explicitly the builtin function names in INDIRECT_CALL_*(), as suggested by Ed Cree - expand the recipients list rfc -> v1: - use branch prediction hints, as suggested by Eric [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 | 35 +++++++++++++++--- net/ipv6/tcpv6_offload.c | 7 ++-- net/ipv6/udp_offload.c | 7 ++-- 9 files changed, 136 insertions(+), 22 deletions(-) create mode 100644 include/linux/indirect_call_wrapper.h -- 2.19.2