From: Philippe Ombredanne <pombredanne@nexb.com>
To: Song Liu <songliubraving@fb.com>
Cc: peterz@infradead.org, rostedt@goodmis.org, mingo@redhat.com,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
daniel@iogearbox.net, kernel-team@fb.com
Subject: Re: [PATCH v2 6/6] bpf: add new test test_many_kprobe
Date: Thu, 30 Nov 2017 09:24:18 +0100 [thread overview]
Message-ID: <CAOFm3uHoPPM0yOUNpAMBsJTcxYwy7UTCbyPy2wOG33j3wsVw-Q@mail.gmail.com> (raw)
In-Reply-To: <20171130014447.190229-9-songliubraving@fb.com>
On Thu, Nov 30, 2017 at 2:44 AM, Song Liu <songliubraving@fb.com> wrote:
> The test compares old text based kprobe API with PERF_TYPE_KPROBE.
>
> Here is a sample output of this test:
>
> Creating 1000 kprobes with text-based API takes 6.979683 seconds
> Cleaning 1000 kprobes with text-based API takes 84.897687 seconds
> Creating 1000 kprobes with PERF_TYPE_KPROBE (function name) takes 5.077558 seconds
> Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function name) takes 81.241354 seconds
> Creating 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 5.218255 seconds
> Cleaning 1000 kprobes with PERF_TYPE_KPROBE (function addr) takes 80.010731 seconds
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Reviewed-by: Josef Bacik <jbacik@fb.com>
> ---
> samples/bpf/Makefile | 3 +
> samples/bpf/bpf_load.c | 5 +-
> samples/bpf/bpf_load.h | 4 +
> samples/bpf/test_many_kprobe_user.c | 182 ++++++++++++++++++++++++++++++++++++
> 4 files changed, 191 insertions(+), 3 deletions(-)
> create mode 100644 samples/bpf/test_many_kprobe_user.c
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 9b4a66e..ec92f35 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -42,6 +42,7 @@ hostprogs-y += xdp_redirect
> hostprogs-y += xdp_redirect_map
> hostprogs-y += xdp_monitor
> hostprogs-y += syscall_tp
> +hostprogs-y += test_many_kprobe
>
> # Libbpf dependencies
> LIBBPF := ../../tools/lib/bpf/bpf.o
> @@ -87,6 +88,7 @@ xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o
> xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o
> xdp_monitor-objs := bpf_load.o $(LIBBPF) xdp_monitor_user.o
> syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o
> +test_many_kprobe-objs := bpf_load.o $(LIBBPF) test_many_kprobe_user.o
>
> # Tell kbuild to always build the programs
> always := $(hostprogs-y)
> @@ -172,6 +174,7 @@ HOSTLOADLIBES_xdp_redirect += -lelf
> HOSTLOADLIBES_xdp_redirect_map += -lelf
> HOSTLOADLIBES_xdp_monitor += -lelf
> HOSTLOADLIBES_syscall_tp += -lelf
> +HOSTLOADLIBES_test_many_kprobe += -lelf
>
> # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
> # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
> diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> index 872510e..caba9bc 100644
> --- a/samples/bpf/bpf_load.c
> +++ b/samples/bpf/bpf_load.c
> @@ -635,9 +635,8 @@ void read_trace_pipe(void)
> }
> }
>
> -#define MAX_SYMS 300000
> -static struct ksym syms[MAX_SYMS];
> -static int sym_cnt;
> +struct ksym syms[MAX_SYMS];
> +int sym_cnt;
>
> static int ksym_cmp(const void *p1, const void *p2)
> {
> diff --git a/samples/bpf/bpf_load.h b/samples/bpf/bpf_load.h
> index e7a8a21..16bc263 100644
> --- a/samples/bpf/bpf_load.h
> +++ b/samples/bpf/bpf_load.h
> @@ -67,6 +67,10 @@ static inline __u64 ptr_to_u64(const void *ptr)
> return (__u64) (unsigned long) ptr;
> }
>
> +#define MAX_SYMS 300000
> +extern struct ksym syms[MAX_SYMS];
> +extern int sym_cnt;
> +
> int load_kallsyms(void);
> struct ksym *ksym_search(long key);
> int set_link_xdp_fd(int ifindex, int fd, __u32 flags);
> diff --git a/samples/bpf/test_many_kprobe_user.c b/samples/bpf/test_many_kprobe_user.c
> new file mode 100644
> index 0000000..1f3ee07
> --- /dev/null
> +++ b/samples/bpf/test_many_kprobe_user.c
> @@ -0,0 +1,182 @@
> +/* Copyright (c) 2017 Facebook
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + */
I think an SPDX id would be better here e.g. just this may be?
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2017 Facebook
It should be on the first line as requested by Linus and documented by
Thomas (tglx) and Greg (greg-kh). And it should use // comments.
See threads on these topics.
--
Cordially
Philippe Ombredanne
prev parent reply other threads:[~2017-11-30 8:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-30 1:44 [PATCH v2 0/6] enable creating [k,u]probe with perf_event_open Song Liu
2017-11-30 1:44 ` [PATCH v2] bcc: Try use new API to create " Song Liu
2017-11-30 1:44 ` [PATCH v2 1/6] perf: Add new types PERF_TYPE_KPROBE and PERF_TYPE_UPROBE Song Liu
2017-11-30 1:44 ` [PATCH v2] perf_event_open.2: add type " Song Liu
2017-11-30 1:44 ` [PATCH v2 2/6] perf: copy new perf_event.h to tools/include/uapi Song Liu
2017-11-30 1:44 ` [PATCH v2 3/6] perf: implement support of PERF_TYPE_KPROBE Song Liu
2017-11-30 1:44 ` [PATCH v2 4/6] perf: implement support of PERF_TYPE_UPROBE Song Liu
2017-11-30 1:44 ` [PATCH v2 5/6] bpf: add option for bpf_load.c to use PERF_TYPE_KPROBE Song Liu
2017-11-30 1:44 ` [PATCH v2 6/6] bpf: add new test test_many_kprobe Song Liu
2017-11-30 8:24 ` Philippe Ombredanne [this message]
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=CAOFm3uHoPPM0yOUNpAMBsJTcxYwy7UTCbyPy2wOG33j3wsVw-Q@mail.gmail.com \
--to=pombredanne@nexb.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.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;
as well as URLs for NNTP newsgroup(s).