linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Song Liu <songliubraving@fb.com>, Kairui Song <kasong@redhat.com>
Subject: Re: [PATCH 2/9] objtool: Fix ORC unwinding in non-JIT BPF generated code
Date: Thu, 13 Jun 2019 20:51:31 -0500	[thread overview]
Message-ID: <20190614015131.wmw63qwzjyzack7f@treble> (raw)
In-Reply-To: <20190614013719.eqwpqfxukh6nhgec@ast-mbp.dhcp.thefacebook.com>

On Thu, Jun 13, 2019 at 06:37:21PM -0700, Alexei Starovoitov wrote:
> On Thu, Jun 13, 2019 at 08:20:30PM -0500, Josh Poimboeuf wrote:
> > On Thu, Jun 13, 2019 at 01:57:11PM -0700, Alexei Starovoitov wrote:
> > > On Thu, Jun 13, 2019 at 08:20:59AM -0500, Josh Poimboeuf wrote:
> > > > Objtool currently ignores ___bpf_prog_run() because it doesn't
> > > > understand the jump table.  This results in the ORC unwinder not being
> > > > able to unwind through non-JIT BPF code.
> > > > 
> > > > Luckily, the BPF jump table resembles a GCC switch jump table, which
> > > > objtool already knows how to read.
> > > > 
> > > > Add generic support for reading any static local jump table array named
> > > > "jump_table", and rename the BPF variable accordingly, so objtool can
> > > > generate ORC data for ___bpf_prog_run().
> > > > 
> > > > Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER")
> > > > Reported-by: Song Liu <songliubraving@fb.com>
> > > > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > > > ---
> > > >  kernel/bpf/core.c     |  5 ++---
> > > >  tools/objtool/check.c | 16 ++++++++++++++--
> > > >  2 files changed, 16 insertions(+), 5 deletions(-)
> > > > 
> > > > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> > > > index 7c473f208a10..aa546ef7dbdc 100644
> > > > --- a/kernel/bpf/core.c
> > > > +++ b/kernel/bpf/core.c
> > > > @@ -1299,7 +1299,7 @@ static u64 ___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
> > > > -	static const void *jumptable[256] = {
> > > > +	static const void *jump_table[256] = {
> > > 
> > > Nack to the change like above
> > 
> > "jump table" is two words, so does it not make sense to separate them
> > with an underscore for readability?
> > 
> > I created a generic feature in objtool for this so that other code can
> > also use it.  So a generic name (and typical Linux naming convention --
> > separating words with an underscore) makes sense here.
> > 
> > > and to patches 8 and 9.
> > 
> > Well, it's your code, but ... can I ask why?  AT&T syntax is the
> > standard for Linux, which is in fact the OS we are developing for.
> > 
> > It makes the code extra confusing for it to be annotated differently
> > than all other Linux asm code.  And due to the inherent complexity of
> > generating code at runtime, I'd think we'd want to make the code as
> > readable as possible, for as many people as possible (i.e. other Linux
> > developers).
> 
> imo your changes make it less readable.

How does introducing an underscore between two words make them less
readable?

> please do not randomly change names and style based on your own preferences.

These are Linux standards, not my own preferences.

> dst=src
> mov(dst,src)
> memcpy(dst,src)
> if people want to have more bugs in assembler code. it's their call.
> bpf_jit_comp.c is C code. dest is on the left.

So you don't like the ordering of the src,dst function arguments?  Ok.

But what do you think about the AT&T syntax comments?

-- 
Josh

  reply	other threads:[~2019-06-14  1:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 13:20 [PATCH 0/9] x86/bpf: unwinder fixes Josh Poimboeuf
2019-06-13 13:20 ` [PATCH 1/9] perf/x86: Always store regs->ip in perf_callchain_kernel() Josh Poimboeuf
2019-06-13 13:20 ` [PATCH 2/9] objtool: Fix ORC unwinding in non-JIT BPF generated code Josh Poimboeuf
2019-06-13 20:57   ` Alexei Starovoitov
2019-06-14  1:20     ` Josh Poimboeuf
2019-06-14  1:37       ` Alexei Starovoitov
2019-06-14  1:51         ` Josh Poimboeuf [this message]
2019-06-14  7:08       ` Peter Zijlstra
2019-06-14  7:35         ` Alexei Starovoitov
2019-06-14  8:11           ` Peter Zijlstra
2019-06-14 15:13             ` Alexei Starovoitov
2019-06-14 16:11               ` Josh Poimboeuf
2019-06-13 13:21 ` [PATCH 3/9] x86/bpf: Move epilogue generation to a dedicated function Josh Poimboeuf
2019-06-13 18:57   ` Song Liu
2019-06-13 19:12     ` Josh Poimboeuf
2019-06-13 13:21 ` [PATCH 4/9] x86/bpf: Simplify prologue generation Josh Poimboeuf
2019-06-13 13:21 ` [PATCH 5/9] x86/bpf: Support SIB byte generation Josh Poimboeuf
2019-06-13 13:21 ` [PATCH 6/9] x86/bpf: Fix JIT frame pointer usage Josh Poimboeuf
2019-06-13 21:58   ` Alexei Starovoitov
2019-06-14  1:22     ` Josh Poimboeuf
2019-06-14  1:39       ` Alexei Starovoitov
2019-06-14  1:52         ` Josh Poimboeuf
2019-06-14 10:50     ` David Laight
2019-06-14 13:44       ` Josh Poimboeuf
2019-06-14 13:58         ` David Laight
2019-06-14 17:07           ` Josh Poimboeuf
2019-06-17 15:07             ` David Laight
2019-06-13 13:21 ` [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code Josh Poimboeuf
2019-06-13 22:00   ` Alexei Starovoitov
2019-06-14  1:30     ` Josh Poimboeuf
2019-06-14  1:42       ` Alexei Starovoitov
2019-06-14  1:58         ` Josh Poimboeuf
2019-06-14  2:28           ` Josh Poimboeuf
2019-06-14  4:50             ` Josh Poimboeuf
2019-06-14  6:00               ` Alexei Starovoitov
2019-06-14  7:41                 ` Peter Zijlstra
2019-06-14 13:31                   ` Josh Poimboeuf
2019-06-14 15:29                   ` Alexei Starovoitov
2019-06-14 13:34                 ` Josh Poimboeuf
2019-06-14 15:31                   ` Alexei Starovoitov
2019-06-14 15:56                     ` Josh Poimboeuf
2019-06-13 13:21 ` [PATCH 8/9] x86/bpf: Convert asm comments to AT&T syntax Josh Poimboeuf
2019-06-13 18:52   ` Song Liu
2019-06-13 19:11     ` Josh Poimboeuf
2019-06-14  7:42     ` Peter Zijlstra
2019-06-14 15:13       ` Song Liu
2019-06-13 13:21 ` [PATCH 9/9] x86/bpf: Convert MOV function/macro argument ordering " Josh Poimboeuf
2019-06-13 19:00 ` [PATCH 0/9] x86/bpf: unwinder fixes Song Liu
2019-06-13 20:41 ` Peter Zijlstra

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=20190614015131.wmw63qwzjyzack7f@treble \
    --to=jpoimboe@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kasong@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --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).