linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] perf probe: Introduce remote cross-arch probes
@ 2016-08-24  5:57 Masami Hiramatsu
  2016-08-24  5:57 ` [RFC PATCH 1/4] perf-probe: Remove unused tracing_dir variable Masami Hiramatsu
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Masami Hiramatsu @ 2016-08-24  5:57 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Masami Hiramatsu, linux-kernel, Peter Zijlstra, Ingo Molnar, Jiri Olsa

Hi,

Here is an RFC series for remote cross-arch probe support on perf-probe.

I've made a perf-probe for remote arch (currently arm on x86-64) for
helping debugging and performance analysis.

Currently perf-probe doesn't supoort cross/remote target. This means
we have to cross-build the perf-tools including libraries (elfutils,
libelf etc.), and to prepare vmlinux with debuginfo which can be 
accessed from the target machine.
This requires too much resource for a small embededd device.

If we can analyze the debuginfo by perf-probe on host machine,
we do not need to cross-build perf-tools, nor copy vmlinux on the
device. :)

This series introduces such features on perf-probe.

To use this, on host machine (with cross build kernel image),
below command outputs the target-machine's kprobe-events definition
in <output-directory>/kprobe_events.

  perf probe -k <cross-vmlinux> --outdir=<output-directory> \
                <probe-point> <arguments>

Perf analyzes the given vmlinux and get the architecture and
switch the dwarf-register mappings.

Here is an example:
  -----
  $ mkdir tracing
  $ sudo perf probe --outdir=./tracing --vmlinux=./vmlinux-arm \
    do_sys_open '$vars'
  Added new event:
  probe:do_sys_open    (on do_sys_open with $vars)

  You can now use it in all perf tools, such as:

        perf record -e probe:do_sys_open -aR sleep 1

  $ cat tracing/kprobe_events
  p:probe/do_sys_open _text+1282292 dfd=%r5:s32 filename=%r1:u32
   flags=%r6:s32 mode=%r3:u16 op=-60(%sp) fd=%r4:s32 tmp=%r7:u32
  -----
Here, we can get probe/do_sys_open event by "copy & paste" the
definition to target-machine's debugfs/tracing/kprobe_events.

To make sure it is correct:
  -----
  $ nm vmlinux-arm | grep "T _text"
  80008000 T _text
  $ nm vmlinux-arm | grep "T do_sys_open"
  801410f4 T do_sys_open
  $ expr `printf "%d + %d" 0x80008000 1282292`
  2148798708
  $ printf "%x\n" 2148798708
  801410f4
  -----
So "_text+12882292" indicates do_sys_open on the target binary correctly.

Thanks,
---

Masami Hiramatsu (4):
      perf-probe: Remove unused tracing_dir variable
      perf-probe: Add offline output directory option
      perf-probe: Ignore vmlinux buildid if offline kernel is given
      perf-probe: Support probing on offline cross-arch binary


 tools/perf/arch/arm/include/dwarf-regs-table.h     |    9 +++
 tools/perf/arch/arm64/include/dwarf-regs-table.h   |   13 +++++
 tools/perf/arch/powerpc/include/dwarf-regs-table.h |   27 ++++++++++
 tools/perf/arch/s390/include/dwarf-regs-table.h    |    8 +++
 tools/perf/arch/sh/include/dwarf-regs-table.h      |   25 +++++++++
 tools/perf/arch/sparc/include/dwarf-regs-table.h   |   18 +++++++
 tools/perf/arch/x86/include/dwarf-regs-table.h     |   14 +++++
 tools/perf/arch/xtensa/include/dwarf-regs-table.h  |    8 +++
 tools/perf/builtin-probe.c                         |    8 +++
 tools/perf/util/Build                              |    1 
 tools/perf/util/dwarf-regs.c                       |   55 ++++++++++++++++++++
 tools/perf/util/include/dwarf-regs.h               |    6 ++
 tools/perf/util/probe-event.h                      |    1 
 tools/perf/util/probe-file.c                       |   22 ++++++--
 tools/perf/util/probe-finder.c                     |   27 ++++++----
 tools/perf/util/probe-finder.h                     |    1 
 tools/perf/util/symbol-elf.c                       |    2 -
 17 files changed, 228 insertions(+), 17 deletions(-)
 create mode 100644 tools/perf/arch/arm/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/arm64/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/powerpc/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/s390/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/sh/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/sparc/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/x86/include/dwarf-regs-table.h
 create mode 100644 tools/perf/arch/xtensa/include/dwarf-regs-table.h
 create mode 100644 tools/perf/util/dwarf-regs.c

--
Masami Hiramatsu (Linaro Ltd.) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-09-05 13:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24  5:57 [RFC PATCH 0/4] perf probe: Introduce remote cross-arch probes Masami Hiramatsu
2016-08-24  5:57 ` [RFC PATCH 1/4] perf-probe: Remove unused tracing_dir variable Masami Hiramatsu
2016-09-05 13:19   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2016-08-24  5:58 ` [RFC PATCH 2/4] perf-probe: Add offline output directory option Masami Hiramatsu
2016-08-24 12:58   ` Arnaldo Carvalho de Melo
2016-08-25  6:37     ` Masami Hiramatsu
2016-08-25 10:48     ` Masami Hiramatsu
2016-08-25 14:40       ` Arnaldo Carvalho de Melo
2016-08-24  5:58 ` [RFC PATCH 3/4] perf-probe: Ignore vmlinux buildid if offline kernel is given Masami Hiramatsu
2016-08-24  5:58 ` [RFC PATCH 4/4] perf-probe: Support probing on offline cross-arch binary Masami Hiramatsu
2016-08-24 13:03   ` Arnaldo Carvalho de Melo
2016-08-25  6:57     ` Masami Hiramatsu

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).