[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ9Sr0PXvZAa74phnwm7um9AoN4ELGkNBMvyzvh7vYzRQ@mail.gmail.com>
Date: Tue, 17 Nov 2020 17:58:24 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: "Daniel T. Lee" <danieltimlee@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, brakmo <brakmo@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
David Ahern <dsa@...ulusnetworks.com>,
Yonghong Song <yhs@...com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Ira Weiny <ira.weiny@...el.com>, Thomas Graf <tgraf@...g.ch>,
Jakub Kicinski <kuba@...nel.org>,
Martin KaFai Lau <kafai@...com>,
John Fastabend <john.fastabend@...il.com>,
bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Xdp <xdp-newbies@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper
On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee <danieltimlee@...il.com> wrote:
>
> Under the samples/bpf directory, similar tracing helpers are
> fragmented around. To keep consistent of tracing programs, this commit
> moves the helper and define locations to increase the reuse of each
> helper function.
>
> Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>
>
> ---
> samples/bpf/Makefile | 2 +-
> samples/bpf/hbm.c | 51 ++++-----------------
> tools/testing/selftests/bpf/trace_helpers.c | 33 ++++++++++++-
> tools/testing/selftests/bpf/trace_helpers.h | 3 ++
> 4 files changed, 45 insertions(+), 44 deletions(-)
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index aeebf5d12f32..3e83cd5ca1c2 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -110,7 +110,7 @@ xdp_fwd-objs := xdp_fwd_user.o
> task_fd_query-objs := bpf_load.o task_fd_query_user.o $(TRACE_HELPERS)
> xdp_sample_pkts-objs := xdp_sample_pkts_user.o $(TRACE_HELPERS)
> ibumad-objs := bpf_load.o ibumad_user.o $(TRACE_HELPERS)
> -hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS)
> +hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS) $(TRACE_HELPERS)
>
> # Tell kbuild to always build the programs
> always-y := $(tprogs-y)
> diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
> index 400e741a56eb..b9f9f771dd81 100644
> --- a/samples/bpf/hbm.c
> +++ b/samples/bpf/hbm.c
> @@ -48,6 +48,7 @@
>
> #include "bpf_load.h"
> #include "bpf_rlimit.h"
> +#include "trace_helpers.h"
> #include "cgroup_helpers.h"
> #include "hbm.h"
> #include "bpf_util.h"
> @@ -65,51 +66,12 @@ bool no_cn_flag;
> bool edt_flag;
>
> static void Usage(void);
> -static void read_trace_pipe2(void);
> static void do_error(char *msg, bool errno_flag);
>
> -#define DEBUGFS "/sys/kernel/debug/tracing/"
> -
> struct bpf_object *obj;
> int bpfprog_fd;
> int cgroup_storage_fd;
>
> -static void read_trace_pipe2(void)
This is used only in hbm.c, why move it into trace_helpers.c?
> -{
> - int trace_fd;
> - FILE *outf;
> - char *outFname = "hbm_out.log";
> -
[...]
Powered by blists - more mailing lists