From: David Woodhouse <dwmw2@infradead.org>
To: daniel@iogearbox.net, mingo@kernel.org, bjorn.topel@intel.com,
davem@davemloft.net, brouer@redhat.com,
magnus.karlsson@intel.com, luto@kernel.org, hpa@zytor.com,
tglx@linutronix.de, peterz@infradead.org, bp@alien8.de,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
ast@kernel.org, linux-tip-commits@vger.kernel.org
Cc: hjl.tools@gmail.com
Subject: Re: [tip:x86/build] x86, retpolines: Raise limit for generating indirect calls from switch-case
Date: Thu, 28 Feb 2019 11:27:17 +0000 [thread overview]
Message-ID: <33bf951448e7d916fd4a6ad41cd3d040e9d1f118.camel@infradead.org> (raw)
In-Reply-To: <tip-ce02ef06fcf7a399a6276adb83f37373d10cbbe1@git.kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]
On Thu, 2019-02-28 at 03:12 -0800, tip-bot for Daniel Borkmann wrote:
> Commit-ID: ce02ef06fcf7a399a6276adb83f37373d10cbbe1
> Gitweb: https://git.kernel.org/tip/ce02ef06fcf7a399a6276adb83f37373d10cbbe1
> Author: Daniel Borkmann <daniel@iogearbox.net>
> AuthorDate: Thu, 21 Feb 2019 23:19:41 +0100
> Committer: Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Thu, 28 Feb 2019 12:10:31 +0100
>
> x86, retpolines: Raise limit for generating indirect calls from switch-case
>
> From networking side, there are numerous attempts to get rid of indirect
> calls in fast-path wherever feasible in order to avoid the cost of
> retpolines, for example, just to name a few:
>
> * 283c16a2dfd3 ("indirect call wrappers: helpers to speed-up indirect calls of builtin")
> * aaa5d90b395a ("net: use indirect call wrappers at GRO network layer")
> * 028e0a476684 ("net: use indirect call wrappers at GRO transport layer")
> * 356da6d0cde3 ("dma-mapping: bypass indirect calls for dma-direct")
> * 09772d92cd5a ("bpf: avoid retpoline for lookup/update/delete calls on maps")
> * 10870dd89e95 ("netfilter: nf_tables: add direct calls for all builtin expressions")
> [...]
>
> Recent work on XDP from Björn and Magnus additionally found that manually
> transforming the XDP return code switch statement with more than 5 cases
> into if-else combination would result in a considerable speedup in XDP
> layer due to avoidance of indirect calls in CONFIG_RETPOLINE enabled
> builds.
+HJL
This is a GCC bug, surely? It should know how expensive each
instruction is, and choose which to use accordingly. That should be
true even when the indirect branch "instruction" is a retpoline, and
thus enormously expensive.
I believe this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86952 so
please at least reference that bug, and be prepared to turn this hack
off when GCC is fixed.
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5174 bytes --]
next prev parent reply other threads:[~2019-02-28 11:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 22:19 [PATCH] x86, retpolines: raise limit for generating indirect calls from switch-case Daniel Borkmann
2019-02-21 22:27 ` Linus Torvalds
2019-02-21 22:56 ` Daniel Borkmann
2019-02-22 7:31 ` Jesper Dangaard Brouer
2019-02-26 18:20 ` Björn Töpel
2019-02-28 11:12 ` [tip:x86/build] x86, retpolines: Raise " tip-bot for Daniel Borkmann
2019-02-28 11:27 ` David Woodhouse [this message]
2019-02-28 12:53 ` H.J. Lu
2019-02-28 16:18 ` Daniel Borkmann
2019-02-28 16:25 ` H.J. Lu
2019-02-28 17:58 ` Daniel Borkmann
2019-02-28 18:09 ` H.J. Lu
2019-02-28 18:13 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33bf951448e7d916fd4a6ad41cd3d040e9d1f118.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=ast@kernel.org \
--cc=bjorn.topel@intel.com \
--cc=bp@alien8.de \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hjl.tools@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).