mbox series

[0/9] x86/bpf: unwinder fixes

Message ID cover.1560431531.git.jpoimboe@redhat.com
Headers show
Series x86/bpf: unwinder fixes | expand

Message

Josh Poimboeuf June 13, 2019, 1:20 p.m. UTC
The following commit

  d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER")

was a step in the right direction, but it triggered some BPF selftest
failures.  That commit exposed the fact that we currently can't unwind
through BPF code.

- Patch 1 (originally from Song Liu) fixes a bug in the above commit
  (regs->ip getting skipped in the stack trace).

- Patch 2 fixes non-JIT BPF for the ORC unwinder.

- Patches 3-5 are preparatory improvements for patch 6.

- Patch 6 fixes JIT BPF for the FP unwinder.

- Patch 7 fixes JIT BPF for the ORC unwinder (building on patch 6).

- Patches 8-9 are some readability cleanups.


Josh Poimboeuf (8):
  objtool: Fix ORC unwinding in non-JIT BPF generated code
  x86/bpf: Move epilogue generation to a dedicated function
  x86/bpf: Simplify prologue generation
  x86/bpf: Support SIB byte generation
  x86/bpf: Fix JIT frame pointer usage
  x86/unwind/orc: Fall back to using frame pointers for generated code
  x86/bpf: Convert asm comments to AT&T syntax
  x86/bpf: Convert MOV function/macro argument ordering to AT&T syntax

Song Liu (1):
  perf/x86: Always store regs->ip in perf_callchain_kernel()

 arch/x86/events/core.c       |  10 +-
 arch/x86/kernel/unwind_orc.c |  26 ++-
 arch/x86/net/bpf_jit_comp.c  | 355 ++++++++++++++++++++---------------
 kernel/bpf/core.c            |   5 +-
 tools/objtool/check.c        |  16 +-
 5 files changed, 246 insertions(+), 166 deletions(-)

Comments

Song Liu June 13, 2019, 7 p.m. UTC | #1
> On Jun 13, 2019, at 6:20 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> 
> The following commit
> 
>  d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER")
> 
> was a step in the right direction, but it triggered some BPF selftest
> failures.  That commit exposed the fact that we currently can't unwind
> through BPF code.
> 
> - Patch 1 (originally from Song Liu) fixes a bug in the above commit
>  (regs->ip getting skipped in the stack trace).
> 
> - Patch 2 fixes non-JIT BPF for the ORC unwinder.
> 
> - Patches 3-5 are preparatory improvements for patch 6.
> 
> - Patch 6 fixes JIT BPF for the FP unwinder.
> 
> - Patch 7 fixes JIT BPF for the ORC unwinder (building on patch 6).
> 
> - Patches 8-9 are some readability cleanups.

These work well in my tests. Thanks!

Tested-by: Song Liu <songliubraving@fb.com>

> 
> 
> Josh Poimboeuf (8):
>  objtool: Fix ORC unwinding in non-JIT BPF generated code
>  x86/bpf: Move epilogue generation to a dedicated function
>  x86/bpf: Simplify prologue generation
>  x86/bpf: Support SIB byte generation
>  x86/bpf: Fix JIT frame pointer usage
>  x86/unwind/orc: Fall back to using frame pointers for generated code
>  x86/bpf: Convert asm comments to AT&T syntax
>  x86/bpf: Convert MOV function/macro argument ordering to AT&T syntax
> 
> Song Liu (1):
>  perf/x86: Always store regs->ip in perf_callchain_kernel()
> 
> arch/x86/events/core.c       |  10 +-
> arch/x86/kernel/unwind_orc.c |  26 ++-
> arch/x86/net/bpf_jit_comp.c  | 355 ++++++++++++++++++++---------------
> kernel/bpf/core.c            |   5 +-
> tools/objtool/check.c        |  16 +-
> 5 files changed, 246 insertions(+), 166 deletions(-)
> 
> -- 
> 2.20.1
>
Peter Zijlstra June 13, 2019, 8:41 p.m. UTC | #2
On Thu, Jun 13, 2019 at 08:20:57AM -0500, Josh Poimboeuf wrote:

> Josh Poimboeuf (8):
>   objtool: Fix ORC unwinding in non-JIT BPF generated code
>   x86/bpf: Move epilogue generation to a dedicated function
>   x86/bpf: Simplify prologue generation
>   x86/bpf: Support SIB byte generation
>   x86/bpf: Fix JIT frame pointer usage
>   x86/unwind/orc: Fall back to using frame pointers for generated code
>   x86/bpf: Convert asm comments to AT&T syntax
>   x86/bpf: Convert MOV function/macro argument ordering to AT&T syntax
> 
> Song Liu (1):
>   perf/x86: Always store regs->ip in perf_callchain_kernel()
> 
>  arch/x86/events/core.c       |  10 +-
>  arch/x86/kernel/unwind_orc.c |  26 ++-
>  arch/x86/net/bpf_jit_comp.c  | 355 ++++++++++++++++++++---------------
>  kernel/bpf/core.c            |   5 +-
>  tools/objtool/check.c        |  16 +-
>  5 files changed, 246 insertions(+), 166 deletions(-)

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>