All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Song Liu <songliubraving@fb.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>
Subject: Re: [PATCH v9 perf,bpf 12/15] perf, bpf: enable annotation of bpf program
Date: Tue, 19 Mar 2019 11:14:35 -0300	[thread overview]
Message-ID: <20190319141435.GD3029@kernel.org> (raw)
In-Reply-To: <20190319135813.GC3029@kernel.org>

Em Tue, Mar 19, 2019 at 10:58:13AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Mar 19, 2019 at 06:05:30AM +0000, Song Liu escreveu:
> > test-disassembler-four-args.c is an existing test used by bpftool.
> > It was added in fb982666e380c1632a74495b68b3c33a66e76430 .  

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

> > I used different versions of gcc to verify that current version of the 
> > patch works for both test-succeed and test-fail cases. I guess something 
> > like the following is needed? But the test does work without it. 

> Even with the file below, it fails, as:

> [acme@quaco perf]$ cat /tmp/build/perf/feature/test-all.make.output
> /usr/bin/ld: /tmp/ccTj7iV6.o: in function `main_test_disassembler_four_args':
> /home/acme/git/perf/tools/build/feature/test-disassembler-four-args.c:9: undefined reference to `disassembler'
> collect2: error: ld returned 1 exit status
> [acme@quaco perf]$

> Then we do the test for each of the features and _then_ this works:

> [acme@quaco perf]$ ls -la /tmp/build/perf/feature/test-disassembler-four-args.*
> -rwxrwxr-x. 1 acme acme 2098312 Mar 19 10:51 /tmp/build/perf/feature/test-disassembler-four-args.bin
> -rw-rw-r--. 1 acme acme    1079 Mar 19 10:51 /tmp/build/perf/feature/test-disassembler-four-args.d
> -rw-rw-r--. 1 acme acme       0 Mar 19 10:51 /tmp/build/perf/feature/test-disassembler-four-args.make.output
> [acme@quaco perf]$
> 
> So there is still something missing, i.e. which objects to add to the
> test-all case, I'll fix it.

This was missing:

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index c51b59e43dcc..4f491ad4f492 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -227,6 +227,8 @@ FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
 
 FEATURE_CHECK_LDFLAGS-libaio = -lrt
 
+FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lopcodes
+
 CFLAGS += -fno-omit-frame-pointer
 CFLAGS += -ggdb3
 CFLAGS += -funwind-tables

----------------------

After that, and with a clean /tmp/build/perf, re-running:

  make -C tools/perf O=/tmp/build/perf

we get:

[acme@quaco perf]$ ls -la /tmp/build/perf/feature/
total 2888
drwxrwxr-x.  2 acme acme     400 Mar 19 11:08 .
drwxrwxr-x. 16 acme acme    4280 Mar 19 11:08 ..
-rwxrwxr-x.  1 acme acme 2680352 Mar 19 11:07 test-all.bin
-rw-rw-r--.  1 acme acme   38753 Mar 19 11:07 test-all.d
-rw-rw-r--.  1 acme acme       0 Mar 19 11:07 test-all.make.output
-rw-rw-r--.  1 acme acme     168 Mar 19 11:07 test-bionic.make.output
-rwxrwxr-x.  1 acme acme  140960 Mar 19 11:08 test-cplus-demangle.bin
-rw-rw-r--.  1 acme acme     101 Mar 19 11:08 test-cplus-demangle.d
-rw-rw-r--.  1 acme acme       0 Mar 19 11:08 test-cplus-demangle.make.output
-rwxrwxr-x.  1 acme acme   17976 Mar 19 11:08 test-jvmti.bin
-rwxrwxr-x.  1 acme acme   17984 Mar 19 11:08 test-jvmti-cmlr.bin
-rw-rw-r--.  1 acme acme    1107 Mar 19 11:08 test-jvmti-cmlr.d
-rw-rw-r--.  1 acme acme       0 Mar 19 11:08 test-jvmti-cmlr.make.output
-rw-rw-r--.  1 acme acme    1014 Mar 19 11:08 test-jvmti.d
-rw-rw-r--.  1 acme acme       0 Mar 19 11:08 test-jvmti.make.output
-rwxrwxr-x.  1 acme acme   18368 Mar 19 11:07 test-libbabeltrace.bin
-rw-rw-r--.  1 acme acme    1470 Mar 19 11:07 test-libbabeltrace.d
-rw-rw-r--.  1 acme acme       0 Mar 19 11:07 test-libbabeltrace.make.output
-rw-rw-r--.  1 acme acme     179 Mar 19 11:07 test-libunwind-aarch64.make.output
-rw-rw-r--.  1 acme acme     163 Mar 19 11:07 test-libunwind-x86.make.output
[acme@quaco perf]$

I.e. test-all.bin got built, and if we look at it:

[acme@quaco perf]$ nm /tmp/build/perf/feature/test-all.bin  | grep disassembler
0000000000061f90 T disassembler
0000000000062110 T disassembler_options_cmp
0000000000061fb0 T disassembler_usage
0000000000061f40 T main_test_disassembler_four_args
000000000006b7c0 T print_i386_disassembler_options
[acme@quaco perf]$ 

I.e. the -lopcodes was added to the test-all.bin, and as we include that
itest-disassembler-four-args.c in the test-all.c file, it gets linked
and that test-all.c build doesn't fail, so all that is in
FEATURE_TESTS_BASIC is marked as present, CFLAGS +=
-DDISASM_FOUR_ARGS_SIGNATURE gets set, etc.

Now the test is really being performed, the test-all.bin feature
detection fast path is working, proceeding.

- Arnaldo

  reply	other threads:[~2019-03-19 14:14 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  5:30 [PATCH v9 perf,bpf 00/15] perf annotation of BPF programs Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 01/15] perf-record: replace option --bpf-event with --no-bpf-event Song Liu
2019-03-22 22:35   ` [tip:perf/urgent] perf record: Replace " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 02/15] bpf: libbpf: introduce bpf_program__get_prog_info_linear() Song Liu
2019-03-12 13:50   ` Arnaldo Carvalho de Melo
2019-03-22 22:36   ` [tip:perf/urgent] tools lib bpf: Introduce bpf_program__get_prog_info_linear() tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 03/15] bpf: bpftool: use bpf_program__get_prog_info_linear() in prog.c:do_dump() Song Liu
2019-03-22 22:36   ` [tip:perf/urgent] " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 04/15] perf, bpf: synthesize bpf events with bpf_program__get_prog_info_linear() Song Liu
2019-03-13 21:00   ` Arnaldo Carvalho de Melo
2019-03-13 21:08     ` Arnaldo Carvalho de Melo
2019-03-14  5:08       ` Song Liu
2019-03-14 16:45         ` Song Liu
2019-03-14 18:30           ` Arnaldo Carvalho de Melo
2019-03-22 22:37   ` [tip:perf/urgent] perf bpf: Synthesize " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 05/15] perf: change prototype of perf_event__synthesize_bpf_events() Song Liu
2019-03-22 22:37   ` [tip:perf/urgent] perf bpf: Make synthesize_bpf_events() receive perf_session pointer instead of perf_tool tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 06/15] perf, bpf: save bpf_prog_info in a rbtree in perf_env Song Liu
2019-03-12 13:10   ` Jiri Olsa
2019-03-12 14:34     ` Arnaldo Carvalho de Melo
2019-03-22 22:38   ` [tip:perf/urgent] perf bpf: Save " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 07/15] perf, bpf: save bpf_prog_info information as headers to perf.data Song Liu
2019-03-12 13:10   ` Jiri Olsa
2019-03-12 14:47     ` Arnaldo Carvalho de Melo
2019-03-13 19:05   ` Arnaldo Carvalho de Melo
2019-03-22 22:39   ` [tip:perf/urgent] perf bpf: Save " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 08/15] perf, bpf: save btf in a rbtree in perf_env Song Liu
2019-03-12 15:00   ` Arnaldo Carvalho de Melo
2019-03-22 22:39   ` [tip:perf/urgent] perf bpf: Save BTF " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 09/15] perf, bpf: save btf information as headers to perf.data Song Liu
2019-03-12 15:14   ` Arnaldo Carvalho de Melo
2019-03-12 15:16     ` Arnaldo Carvalho de Melo
2019-03-12 16:26       ` Song Liu
2019-03-12 17:05         ` Arnaldo Carvalho de Melo
2019-03-12 17:29           ` Song Liu
2019-03-15 19:06             ` Arnaldo Carvalho de Melo
2019-03-15 19:26               ` Arnaldo Carvalho de Melo
2019-03-15 19:31                 ` Song Liu
2019-03-15 19:42                 ` Arnaldo Carvalho de Melo
2019-03-22 22:40   ` [tip:perf/urgent] perf bpf: Save BTF " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 10/15] perf-top: add option --no-bpf-event Song Liu
2019-03-22 22:41   ` [tip:perf/urgent] perf top: Add " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 11/15] perf: add -lopcodes to feature-libbfd Song Liu
2019-03-22 22:41   ` [tip:perf/urgent] perf feature detection: Add " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 12/15] perf, bpf: enable annotation of bpf program Song Liu
2019-03-18 16:38   ` Arnaldo Carvalho de Melo
2019-03-18 16:43     ` Arnaldo Carvalho de Melo
2019-03-19  6:10       ` Song Liu
2019-03-19 13:37         ` Arnaldo Carvalho de Melo
2019-03-19  6:05     ` Song Liu
2019-03-19 13:37       ` Arnaldo Carvalho de Melo
2019-03-19 13:58       ` Arnaldo Carvalho de Melo
2019-03-19 14:14         ` Arnaldo Carvalho de Melo [this message]
2019-03-19 14:52           ` [WORKS!] " Arnaldo Carvalho de Melo
2019-03-19 16:51             ` Song Liu
2019-03-19 16:55               ` Arnaldo Carvalho de Melo
2019-03-19 17:07                 ` Arnaldo Carvalho de Melo
2019-03-22 22:42   ` [tip:perf/urgent] perf symbols: Introduce DSO_BINARY_TYPE__BPF_PROG_INFO tip-bot for Song Liu
2019-03-22 22:43   ` [tip:perf/urgent] perf build: Check what binutils's 'disassembler()' signature to use tip-bot for Song Liu
2019-03-22 22:44   ` [tip:perf/urgent] perf annotate: Enable annotation of BPF programs tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 13/15] perf, bpf: process PERF_BPF_EVENT_PROG_LOAD for annotation Song Liu
2019-03-22 22:43   ` [tip:perf/urgent] perf bpf: Process " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 14/15] perf: introduce side band thread Song Liu
2019-03-22 22:45   ` [tip:perf/urgent] perf evlist: Introduce " tip-bot for Song Liu
2019-03-12  5:30 ` [PATCH v9 perf,bpf 15/15] perf, bpf: save bpf_prog_info and btf of short living bpf programs Song Liu
2019-03-19 15:25   ` Arnaldo Carvalho de Melo
2019-03-22 22:45   ` [tip:perf/urgent] perf tools: Save bpf_prog_info and BTF of new BPF programs tip-bot for Song Liu
2019-03-12 13:12 ` [PATCH v9 perf,bpf 00/15] perf annotation of " Jiri Olsa
2019-03-21  9:10 ` Jiri Olsa
2019-03-21 14:12   ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2019-03-07 17:57 [PATCH v7 " Song Liu
2019-03-07 17:57 ` [PATCH v7 perf,bpf 01/15] perf, bpf: consider events with attr.bpf_event as side-band events Song Liu
2019-03-07 17:57 ` [PATCH v7 perf,bpf 02/15] bpf: libbpf: introduce bpf_program__get_prog_info_linear() Song Liu
2019-03-11 18:26   ` Arnaldo Carvalho de Melo
2019-03-11 20:45     ` Daniel Borkmann
2019-03-11 20:57       ` Arnaldo Carvalho de Melo
2019-03-12 11:20         ` Daniel Borkmann
2019-03-07 17:57 ` [PATCH v7 perf,bpf 03/15] bpf: bpftool: use bpf_program__get_prog_info_linear() in prog.c:do_dump() Song Liu
2019-03-07 17:57 ` [PATCH v7 perf,bpf 04/15] perf, bpf: synthesize bpf events with bpf_program__get_prog_info_linear() Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 05/15] perf: change prototype of perf_event__synthesize_bpf_events() Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 06/15] perf, bpf: save bpf_prog_info in a rbtree in perf_env Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 07/15] perf, bpf: save bpf_prog_info information as headers to perf.data Song Liu
2019-03-11 17:56   ` Jiri Olsa
2019-03-11 18:05     ` Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 08/15] perf, bpf: save btf in a rbtree in perf_env Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 09/15] perf, bpf: save btf information as headers to perf.data Song Liu
2019-03-11 17:56   ` Jiri Olsa
2019-03-07 17:58 ` [PATCH v7 perf,bpf 10/15] perf-top: add option --no-bpf-event Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 11/15] perf: add -lopcodes to feature-libbfd Song Liu
2019-03-07 23:26   ` Stanislav Fomichev
2019-03-07 23:47     ` Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 12/15] perf, bpf: enable annotation of bpf program Song Liu
2019-03-11 17:56   ` Jiri Olsa
2019-03-11 18:04     ` Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 13/15] perf, bpf: process PERF_BPF_EVENT_PROG_LOAD for annotation Song Liu
2019-03-07 17:58 ` [PATCH v7 perf,bpf 14/15] perf: introduce side band thread Song Liu
2019-03-11 17:57   ` Jiri Olsa
2019-03-07 17:58 ` [PATCH v7 perf,bpf 15/15] perf, bpf: save bpf_prog_info and btf of short living bpf programs Song Liu
2019-03-11 13:59 ` [PATCH v7 perf,bpf 00/15] perf annotation of BPF programs Jiri Olsa
2019-03-11 14:16   ` Song Liu

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=20190319141435.GD3029@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=Kernel-team@fb.com \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=sdf@fomichev.me \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.