From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Song Liu <songliubraving@fb.com>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Kairui Song <kasong@redhat.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code
Date: Tue, 9 Jul 2019 12:47:44 -0500 [thread overview]
Message-ID: <20190709174744.dtbjm72cbu5fepar@treble> (raw)
In-Reply-To: <CAADnVQ+imsK-reGBiSzY02e+KdyGYZxm1su7T1bWvti=YmSV-Q@mail.gmail.com>
On Mon, Jul 08, 2019 at 04:16:25PM -0700, Alexei Starovoitov wrote:
> total time is hard to compare.
> Could you compare few tests?
> like two that are called "tcpdump *"
>
> I think small regression is ok.
> Folks that care about performance should be using JIT.
I did each test 20 times and computed the averages:
"tcpdump port 22":
default: 0.00743175s
-fno-gcse: 0.00709920s (~4.5% speedup)
"tcpdump complex":
default: 0.00876715s
-fno-gcse: 0.00854895s (~2.5% speedup)
So there does seem to be a small performance gain by disabling this
optimization.
We could change it for the whole file, by adjusting CFLAGS_core.o in the
BPF makefile, or we could change it for the function only with something
like the below patch.
Thoughts?
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index e8579412ad21..d7ee4c6bad48 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -170,3 +170,5 @@
#else
#define __diag_GCC_8(s)
#endif
+
+#define __no_fgcse __attribute__((optimize("-fno-gcse")))
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 095d55c3834d..599c27b56c29 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -189,6 +189,10 @@ struct ftrace_likely_data {
#define asm_volatile_goto(x...) asm goto(x)
#endif
+#ifndef __no_fgcse
+# define __no_fgcse
+#endif
+
/* Are two types/vars the same type (ignoring qualifiers)? */
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 7e98f36a14e2..8191a7db2777 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1295,7 +1295,7 @@ bool bpf_opcode_in_insntable(u8 code)
*
* Decode and execute eBPF instructions.
*/
-static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
+static u64 __no_fgcse ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack)
{
#define BPF_INSN_2_LBL(x, y) [BPF_##x | BPF_##y] = &&x##_##y
#define BPF_INSN_3_LBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z
next prev parent reply other threads:[~2019-07-09 17:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 1:50 [PATCH v4 0/2] x86: bpf unwinder fixes Josh Poimboeuf
2019-06-28 1:50 ` [PATCH v4 1/2] objtool: Add support for C jump tables Josh Poimboeuf
2019-06-29 5:58 ` [tip:x86/urgent] " tip-bot for Josh Poimboeuf
2019-07-09 12:01 ` [tip:x86/debug] " tip-bot for Josh Poimboeuf
2019-06-28 1:50 ` [PATCH v4 2/2] bpf: Fix ORC unwinding in non-JIT BPF code Josh Poimboeuf
2019-06-28 15:37 ` Alexei Starovoitov
2019-06-29 5:58 ` [tip:x86/urgent] " tip-bot for Josh Poimboeuf
2019-07-06 20:29 ` Ingo Molnar
2019-07-07 1:32 ` Josh Poimboeuf
2019-07-07 5:52 ` Josh Poimboeuf
2019-07-08 22:15 ` Alexei Starovoitov
2019-07-08 22:38 ` Josh Poimboeuf
2019-07-08 22:49 ` Alexei Starovoitov
2019-07-08 22:53 ` Josh Poimboeuf
2019-07-08 23:02 ` Josh Poimboeuf
2019-07-08 23:16 ` Alexei Starovoitov
2019-07-09 17:47 ` Josh Poimboeuf [this message]
2019-07-09 18:02 ` Alexei Starovoitov
2019-07-09 19:17 ` Josh Poimboeuf
2019-07-09 19:26 ` Daniel Borkmann
2019-07-09 12:02 ` [tip:x86/debug] " tip-bot for Josh Poimboeuf
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=20190709174744.dtbjm72cbu5fepar@treble \
--to=jpoimboe@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=daniel@iogearbox.net \
--cc=hpa@zytor.com \
--cc=kasong@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®