From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: x86@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org,
mingo@kernel.org, hpa@zytor.com, ast@kernel.org,
peterz@infradead.org, rdunlap@infradead.org,
Arnd Bergmann <arnd@arndb.de>,
bpf@vger.kernel.org, daniel@iogearbox.net
Subject: Re: BPF vs objtool again
Date: Wed, 29 Apr 2020 19:13:00 -0500 [thread overview]
Message-ID: <20200430001300.k3pgq2minrowstbs@treble> (raw)
In-Reply-To: <20200429234159.gid6ht74qqmlpuz7@ast-mbp.dhcp.thefacebook.com>
On Wed, Apr 29, 2020 at 04:41:59PM -0700, Alexei Starovoitov wrote:
> On Wed, Apr 29, 2020 at 04:51:59PM -0500, Josh Poimboeuf wrote:
> > On Thu, Jul 18, 2019 at 12:14:08PM -0700, tip-bot for Josh Poimboeuf wrote:
> > > Commit-ID: 3193c0836f203a91bef96d88c64cccf0be090d9c
> > > Gitweb: https://git.kernel.org/tip/3193c0836f203a91bef96d88c64cccf0be090d9c
> > > Author: Josh Poimboeuf <jpoimboe@redhat.com>
> > > AuthorDate: Wed, 17 Jul 2019 20:36:45 -0500
> > > Committer: Thomas Gleixner <tglx@linutronix.de>
> > > CommitDate: Thu, 18 Jul 2019 21:01:06 +0200
> > >
> > > bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()
> >
> > For some reason, this
> >
> > __attribute__((optimize("-fno-gcse")))
> >
> > is disabling frame pointers in ___bpf_prog_run(). If you compile with
> > CONFIG_FRAME_POINTER it'll show something like:
> >
> > kernel/bpf/core.o: warning: objtool: ___bpf_prog_run.cold()+0x7: call without frame pointer save/setup
>
> you mean it started to disable frame pointers from some version of gcc?
> It wasn't doing this before, since objtool wasn't complaining, right?
> Sounds like gcc bug?
I actually think this warning has been around for a while. I just only
recently looked at it. I don't think anything changed in GCC, it's just
that almost nobody uses CONFIG_FRAME_POINTER, so it wasn't really
noticed.
> > Also, since GCC 9.1, the GCC docs say "The optimize attribute should be
> > used for debugging purposes only. It is not suitable in production
> > code." That doesn't sound too promising.
> >
> > So it seems like this commit should be reverted. But then we're back to
> > objtool being broken again in the RETPOLINE=n case, which means no ORC
> > coverage in this function. (See above commit for the details)
> >
> > Some ideas:
> >
> > - Skip objtool checking of that func/file (at least for RETPOLINE=n) --
> > but then it won't have ORC coverage.
> >
> > - Get rid of the "double goto" in ___bpf_prog_run(), which simplifies it
> > enough for objtool to understand -- but then the text explodes for
> > RETPOLINE=y.
>
> How that will look like?
> That could be the best option.
For example:
#define GOTO ({ goto *jumptable[insn->code]; })
and then replace all 'goto select_insn' with 'GOTO;'
The problem is that with RETPOLINE=y, the function text size grows from
5k to 7k, because for each of the 160+ retpoline JMPs, GCC (stupidly)
reloads the jump table register into a scratch register.
> > - Add -fno-gfcse to the Makefile for kernel/bpf/core.c -- but then that
> > affects the optimization of other functions in the file. However I
> > don't think the impact is significant.
> >
> > - Move ___bpf_prog_run() to its own file with the -fno-gfcse flag. I'm
> > thinking this could be the least bad option. Alexei?
>
> I think it would be easier to move some of the hot path
> functions out of core.c instead.
> Like *ksym*, BPF_CALL*, bpf_jit*, bpf_prog*.
> I think resulting churn will be less.
> imo it's more important to keep git blame history for interpreter
> than for the other funcs.
> Sounds like it's a fix that needs to be sent for the next RC ?
> Please send a patch for bpf tree then.
I can make a patch, what file would you recommend moving those hot path
functions to?
--
Josh
next prev parent reply other threads:[~2020-04-30 0:13 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 1:36 [PATCH v2 00/22] x86, objtool: several fixes/improvements Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 01/22] x86/paravirt: Fix callee-saved function ELF sizes Josh Poimboeuf
2019-07-18 19:07 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 02/22] x86/kvm: Fix fastop function ELF metadata Josh Poimboeuf
2019-07-18 19:08 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 03/22] x86/kvm: Replace vmx_vmenter()'s call to kvm_spurious_fault() with UD2 Josh Poimboeuf
2019-07-18 8:17 ` Paolo Bonzini
2019-07-18 19:08 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 04/22] x86/kvm: Don't call kvm_spurious_fault() from .fixup Josh Poimboeuf
2019-07-18 8:22 ` Paolo Bonzini
2019-07-18 13:16 ` Sean Christopherson
2019-07-18 13:18 ` Paolo Bonzini
2019-07-18 14:12 ` Josh Poimboeuf
2019-07-18 14:13 ` Paolo Bonzini
2019-07-18 14:03 ` Josh Poimboeuf
2019-07-18 19:09 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 05/22] x86/entry: Fix thunk function ELF sizes Josh Poimboeuf
2019-07-18 19:10 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 06/22] x86/head/64: Annotate start_cpu0() as non-callable Josh Poimboeuf
2019-07-18 19:11 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 07/22] x86/uaccess: Remove ELF function annotation from copy_user_handle_tail() Josh Poimboeuf
2019-07-18 19:11 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 08/22] x86/uaccess: Don't leak AC flag into fentry from mcsafe_handle_tail() Josh Poimboeuf
2019-07-18 19:12 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 09/22] x86/uaccess: Remove redundant CLACs in getuser/putuser error paths Josh Poimboeuf
2019-07-18 19:13 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 10/22] bpf: Disable GCC -fgcse optimization for ___bpf_prog_run() Josh Poimboeuf
2019-07-18 19:14 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2020-04-29 21:51 ` BPF vs objtool again Josh Poimboeuf
2020-04-29 22:01 ` Arvind Sankar
2020-04-29 23:41 ` Alexei Starovoitov
2020-04-30 0:13 ` Josh Poimboeuf [this message]
2020-04-30 2:10 ` Alexei Starovoitov
2020-04-30 3:53 ` Josh Poimboeuf
2020-04-30 4:24 ` Alexei Starovoitov
2020-04-30 4:43 ` Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 11/22] objtool: Add mcsafe_handle_tail() to the uaccess safe list Josh Poimboeuf
2019-07-18 19:14 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 12/22] objtool: Track original function across branches Josh Poimboeuf
2019-07-18 19:15 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 13/22] objtool: Refactor function alias logic Josh Poimboeuf
2019-07-18 19:16 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 14/22] objtool: Warn on zero-length functions Josh Poimboeuf
2019-07-18 19:17 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 15/22] objtool: Change dead_end_function() to return boolean Josh Poimboeuf
2019-07-18 19:17 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 16/22] objtool: Do frame pointer check before dead end check Josh Poimboeuf
2019-07-18 19:18 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 17/22] objtool: Refactor sibling call detection logic Josh Poimboeuf
2019-07-18 19:19 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 18/22] objtool: Refactor jump table code Josh Poimboeuf
2019-07-18 19:20 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 19/22] objtool: Support repeated uses of the same C jump table Josh Poimboeuf
2019-07-18 19:20 ` [tip:core/urgent] " tip-bot for Jann Horn
2019-07-18 1:36 ` [PATCH v2 20/22] objtool: Fix seg fault on bad switch table entry Josh Poimboeuf
2019-07-18 19:21 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 21/22] objtool: convert insn type to enum Josh Poimboeuf
2019-07-18 19:22 ` [tip:core/urgent] objtool: Convert " tip-bot for Josh Poimboeuf
2019-07-18 1:36 ` [PATCH v2 22/22] objtool: Support conditional retpolines Josh Poimboeuf
2019-07-18 19:23 ` [tip:core/urgent] " 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=20200430001300.k3pgq2minrowstbs@treble \
--to=jpoimboe@redhat.com \
--cc=alexei.starovoitov@gmail.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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).