lkml.org 
[lkml]   [2019]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH v9 perf,bpf 12/15] perf, bpf: enable annotation of bpf program
Em Tue, Mar 19, 2019 at 06:10:42AM +0000, Song Liu escreveu:
>
>
> > On Mar 18, 2019, at 9:43 AM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> >
> > Em Mon, Mar 18, 2019 at 01:38:48PM -0300, Arnaldo Carvalho de Melo escreveu:
> >> Em Mon, Mar 11, 2019 at 10:30:48PM -0700, Song Liu escreveu:
> >>> This patch enables the annotation of bpf program.
> >>>
> >>> A new dso type DSO_BINARY_TYPE__BPF_PROG_INFO is introduced to for BPF
> >>> programs. In symbol__disassemble(), DSO_BINARY_TYPE__BPF_PROG_INFO dso
> >>> calls into a new function symbol__disassemble_bpf(), where annotation
> >>> line information is filled based bpf_prog_info and btf saved in given
> >>> perf_env.
> >>>
> >>> symbol__disassemble_bpf() uses libbfd to disassemble bpf programs.
> >>>
> >>> Signed-off-by: Song Liu <songliubraving@fb.com>
> >>> ---
> >>> tools/build/Makefile.feature | 6 +-
> >>> tools/perf/Makefile.config | 4 +
> >>
> >> I see the changes to these two files, but I can't see the feature test
> >> that it triggers, forgot to do a git-add? Or is it in an upcoming patch
> >> in this series?
> >>
> >> After applying this test it "works":
> >>
> >> make: Entering directory '/home/acme/git/perf/tools/perf'
> >> BUILD: Doing 'make -j8' parallel build
> >>
> >> Auto-detecting system features:
> >> ... dwarf: [ on ]
> >> ... dwarf_getlocations: [ on ]
> >> <SNIP>
> >> ... bpf: [ on ]
> >> ... libaio: [ on ]
> >> ... disassembler-four-args: [ on ]
> >>
> >> Because you added it to FEATURE_TESTS_BASIC, and this means that if
> >> tools/build/feature/test-all.c builds, then what is in
> >> FEATURE_TESTS_BASIC is set to 'on', but you didn't add anything to
> >> tools/build/feature/test-all.c, so it works because all the other
> >> features are present.
> >>
> >> Take a look at:
> >>
> >> 2a07d814747b ("tools build feature: Check if libaio is available")
> >>
> >> To see what needs to be done.
> >>
> >> Either way, its interesting to break this patch in two, one adding the
> >> feature test and another to use it, i.e. the second patch out of this
> >> should have the commit log message in this patch.
> >>
> >> I've applied the patches up to before this one and will continue
> >> processing other patches while you address this.
> >
> > Ok, to continue processing the other patches I chunked out the part
> > below into a 3rd patch from the above one and have it applied already.
>
> Could you please push applied patches to the tmp.perf/bpf-annotation
> branch?

It is in my perf/core branch already.

> Thanks,
> Song
>
> >
> > commit f326de312abc3657b0397817c66cd7e1540655f7
> > Author: Song Liu <songliubraving@fb.com>
> > Date: Mon Mar 11 22:30:48 2019 -0700
> >
> > perf symbols: Introduce DSO_BINARY_TYPE__BPF_PROG_INFO
> >
> > Introduce a new dso type DSO_BINARY_TYPE__BPF_PROG_INFO for BPF programs. In
> > symbol__disassemble(), DSO_BINARY_TYPE__BPF_PROG_INFO dso will call into a new
> > function symbol__disassemble_bpf() in an upcoming patch, where annotation line
> > information is filled based bpf_prog_info and btf saved in given perf_env.
> >
> > Signed-off-by: Song Liu <songliubraving@fb.com>
> > Reviewed-by: Jiri Olsa <jolsa@kernel.org>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > Cc: Daniel Borkmann <daniel@iogearbox.net>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Stanislav Fomichev <sdf@google.com>
> > Cc: kernel-team@fb.com
> > Link: http://lkml.kernel.org/r/20190312053051.2690567-13-songliubraving@fb.com
> > [ split from a larger patch ]
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> > index ba58ba603b69..58547c468c65 100644
> > --- a/tools/perf/util/dso.c
> > +++ b/tools/perf/util/dso.c
> > @@ -184,6 +184,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
> > case DSO_BINARY_TYPE__KALLSYMS:
> > case DSO_BINARY_TYPE__GUEST_KALLSYMS:
> > case DSO_BINARY_TYPE__JAVA_JIT:
> > + case DSO_BINARY_TYPE__BPF_PROG_INFO:
> > case DSO_BINARY_TYPE__NOT_FOUND:
> > ret = -1;
> > break;
> > diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> > index bb417c54c25a..c274b5aa839d 100644
> > --- a/tools/perf/util/dso.h
> > +++ b/tools/perf/util/dso.h
> > @@ -14,6 +14,7 @@
> >
> > struct machine;
> > struct map;
> > +struct perf_env;
> >
> > enum dso_binary_type {
> > DSO_BINARY_TYPE__KALLSYMS = 0,
> > @@ -35,6 +36,7 @@ enum dso_binary_type {
> > DSO_BINARY_TYPE__KCORE,
> > DSO_BINARY_TYPE__GUEST_KCORE,
> > DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO,
> > + DSO_BINARY_TYPE__BPF_PROG_INFO,
> > DSO_BINARY_TYPE__NOT_FOUND,
> > };
> >
> > @@ -178,17 +180,25 @@ struct dso {
> > struct auxtrace_cache *auxtrace_cache;
> > int comp;
> >
> > - /* dso data file */
> > - struct {
> > - struct rb_root cache;
> > - int fd;
> > - int status;
> > - u32 status_seen;
> > - size_t file_size;
> > - struct list_head open_entry;
> > - u64 debug_frame_offset;
> > - u64 eh_frame_hdr_offset;
> > - } data;
> > + union {
> > + /* dso data file */
> > + struct {
> > + struct rb_root cache;
> > + int fd;
> > + int status;
> > + u32 status_seen;
> > + size_t file_size;
> > + struct list_head open_entry;
> > + u64 debug_frame_offset;
> > + u64 eh_frame_hdr_offset;
> > + } data;
> > + /* bpf prog information */
> > + struct {
> > + u32 id;
> > + u32 sub_id;
> > + struct perf_env *env;
> > + } bpf_prog;
> > + };
> >
> > union { /* Tool specific area */
> > void *priv;
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index 58442ca5e3c4..5cbad55cd99d 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -1455,6 +1455,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
> > case DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO:
> > return true;
> >
> > + case DSO_BINARY_TYPE__BPF_PROG_INFO:
> > case DSO_BINARY_TYPE__NOT_FOUND:
> > default:
> > return false;

--

- Arnaldo

\
 
 \ /
  Last update: 2019-03-19 14:39    [W:0.095 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site