mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Brendan Gregg <brendan.d.gregg@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	David Ahern <dsahern@gmail.com>, He Kuang <hekuang@huawei.com>,
	Jiri Olsa <jolsa@redhat.com>, Jonathan Cameron <jic23@cam.ac.uk>,
	Kaixu Xia <xiakaixu@huawei.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	pi3orama@163.com, Wang Nan <wangnan0@huawei.com>,
	Zefan Li <lizefan@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [GIT PULL 00/16] perf/ebpf improvements and fixes
Date: Tue, 17 Nov 2015 12:31:15 -0300	[thread overview]
Message-ID: <1447774291-14532-1-git-send-email-acme@kernel.org> (raw)

Hi Ingo,

	This is on top of my last perf-urgent-for-mingo pull req, that is
outstanding, please check if this can get into this merge window.

- Arnaldo

The following changes since commit 092b1f0b5f9f797812da0de927c3aa26acbe8762:

  perf probe: Clear probe_trace_event when add_probe_trace_event() fails (2015-11-13 12:28:09 -0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-ebpf-for-mingo

for you to fetch changes up to 0fbcd50e1385d3a78ddb3cf52dcdff802bfb835e:

  perf test: Mute test cases error messages if verbose == 0 (2015-11-17 11:45:06 -0300)

----------------------------------------------------------------
perf/ebpf improvements and fixes:

User visible:

- Allows BPF scriptlets specify arguments to be fetched using
  DWARF info, using a prologue generated at compile/build time (He Kuang, Wang Nan)

- Allow attaching BPF scriptlets to module symbols (Wang Nan)

- Allow attaching BPF scriptlets to userspace code using uprobe (Wang Nan)

- BPF programs now can specify 'perf probe' tunables via its section name,
  separating key=val values using semicolons (Wang Nan)

Testing some of these new BPF features:

Use case: get callchains when receiving SSL packets, filter then in the
          kernel, at arbitrary place.

  # cat ssl.bpf.c
  #define SEC(NAME) __attribute__((section(NAME), used))

  struct pt_regs;

  SEC("func=__inet_lookup_established hnum")
  int func(struct pt_regs *ctx, int err, unsigned short port)
  {
          return err == 0 && port == 443;
  }

  char _license[] SEC("license") = "GPL";
  int  _version   SEC("version") = LINUX_VERSION_CODE;
  #
  # perf record -a -g -e ssl.bpf.c
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.787 MB perf.data (3 samples) ]
  # perf script | head -30
  swapper     0 [000] 58783.268118: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
	 8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
	 856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
	 2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
	 2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
	 96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
	 969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
	 2dede5 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
	 95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
	1163ffa start_kernel ([kernel.vmlinux].init.text)
	11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
	1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)

  qemu-system-x86  9178 [003] 58785.792417: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
	 856660 netif_receive_skb_internal (/lib/modules/4.3.0+/build/vmlinux)
	 8566ec netif_receive_skb_sk (/lib/modules/4.3.0+/build/vmlinux)
	   430a br_handle_frame_finish ([bridge])
	   48bc br_handle_frame ([bridge])
	 855f44 __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
  #

  Use 'perf probe' various options to list functions, see what variables can
  be collected at any given point, experiment first collecting without a filter,
  then filter, use it together with 'perf trace', 'perf top', with or without
  callchains, if it explodes, please tell us!

Infrastructure:

- Add further 'perf test' entries for BPF and LLVM (Wang Nan)

- Improve 'perf test' to suport subtests, so that the series of tests
  performed in the LLVM and BPF main tests appear in the default 'perf test'
  output (Wang Nan)

- Move memdup() from tools/perf to tools/lib/string.c (Arnaldo Carvalho de Melo)

- Adopt strtobool() from the kernel into tools/lib/ (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
      tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c

He Kuang (1):
      perf bpf: Add prologue for BPF programs for fetching arguments

Wang Nan (14):
      tools: Clone the kernel's strtobool function
      bpf tools: Load a program with different instances using preprocessor
      perf bpf: Add BPF_PROLOGUE config options for further patches
      perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on
      perf bpf: Allow BPF program attach to uprobe events
      perf bpf: Allow attaching BPF programs to modules symbols
      perf bpf: Allow BPF program config probing options
      perf bpf: Generate prologue for BPF programs
      perf test: Test the BPF prologue adding infrastructure
      perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux
      perf bpf: Use same BPF program if arguments are identical
      perf test: Print result for each LLVM subtest
      perf test: Print result for each BPF subtest
      perf test: Mute test cases error messages if verbose == 0

 tools/include/linux/string.h                |  11 +
 tools/lib/bpf/libbpf.c                      | 146 ++++++++-
 tools/lib/bpf/libbpf.h                      |  64 ++++
 tools/lib/string.c                          |  62 ++++
 tools/perf/MANIFEST                         |   2 +
 tools/perf/arch/x86/util/Build              |   1 +
 tools/perf/config/Makefile                  |  12 +
 tools/perf/tests/.gitignore                 |   1 +
 tools/perf/tests/Build                      |   9 +-
 tools/perf/tests/bpf-script-test-prologue.c |  35 +++
 tools/perf/tests/bpf.c                      |  79 ++++-
 tools/perf/tests/builtin-test.c             | 134 ++++++--
 tools/perf/tests/llvm.c                     |  67 ++--
 tools/perf/tests/llvm.h                     |   2 +
 tools/perf/tests/tests.h                    |  27 +-
 tools/perf/util/Build                       |   7 +
 tools/perf/util/bpf-loader.c                | 434 +++++++++++++++++++++++++-
 tools/perf/util/bpf-loader.h                |   4 +
 tools/perf/util/bpf-prologue.c              | 455 ++++++++++++++++++++++++++++
 tools/perf/util/bpf-prologue.h              |  34 +++
 tools/perf/util/include/linux/string.h      |   3 -
 tools/perf/util/probe-event.c               |   7 +-
 tools/perf/util/string.c                    |  16 -
 23 files changed, 1502 insertions(+), 110 deletions(-)
 create mode 100644 tools/include/linux/string.h
 create mode 100644 tools/lib/string.c
 create mode 100644 tools/perf/tests/bpf-script-test-prologue.c
 create mode 100644 tools/perf/util/bpf-prologue.c
 create mode 100644 tools/perf/util/bpf-prologue.h
 delete mode 100644 tools/perf/util/include/linux/string.h

             reply	other threads:[~2015-11-17 15:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 15:31 Arnaldo Carvalho de Melo [this message]
2015-11-17 15:31 ` [PATCH 01/16] tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 02/16] tools: Clone the kernel's strtobool function Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 03/16] bpf tools: Load a program with different instances using preprocessor Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 04/16] perf bpf: Add BPF_PROLOGUE config options for further patches Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 05/16] perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 06/16] perf bpf: Allow BPF program attach to uprobe events Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 07/16] perf bpf: Allow attaching BPF programs to modules symbols Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 08/16] perf bpf: Allow BPF program config probing options Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 09/16] perf bpf: Add prologue for BPF programs for fetching arguments Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 10/16] perf bpf: Generate prologue for BPF programs Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 11/16] perf test: Test the BPF prologue adding infrastructure Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 12/16] perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 13/16] perf bpf: Use same BPF program if arguments are identical Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 14/16] perf test: Print result for each LLVM subtest Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 15/16] perf test: Print result for each BPF subtest Arnaldo Carvalho de Melo
2015-11-17 15:31 ` [PATCH 16/16] perf test: Mute test cases error messages if verbose == 0 Arnaldo Carvalho de Melo
2015-11-18  6:32 ` [GIT PULL 00/16] perf/ebpf improvements and fixes Ingo Molnar
2015-11-18 12:44   ` Arnaldo Carvalho de Melo
2015-11-18 13:06     ` pi3orama
2015-11-18 13:27       ` Arnaldo Carvalho de Melo

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=1447774291-14532-1-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=ast@kernel.org \
    --cc=brendan.d.gregg@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=hekuang@huawei.com \
    --cc=jic23@cam.ac.uk \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    --cc=xiakaixu@huawei.com \
    /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

Powered by JetHome