Skip to contentSkip to conversation

perf util: Display warning when perf report/annotate is missing some libs

PATCH In review Jin Yao 3 participants 17 messages Jan 11, 2018 – Mar 23, 2018 perf events

lore
Share & tools
lore

Jin Yao

author
#0 lore raw

PATCH 1/1 perf util: Display warning when perf report/annotate is missing some libs

We keep having bug reports that when users build perf on their own, but they don't install some needed libraries like libelf, libbfd/libibery.

The perf can build, but it is missing important functionality.

For example, perf report doesn't display any symbols and perf annotate doesn't work.

This patch displays warnings that these libraries are missing in build when perf report / perf annotate are used.

---
 tools/perf/builtin-annotate.c |  2 ++
 tools/perf/builtin-report.c   |  2 ++
 tools/perf/util/symbol.c      | 21 +++++++++++++++++++++
 tools/perf/util/symbol.h      |  2 ++
 4 files changed, 27 insertions(+)
tools/perf/builtin-annotate.c +2 -0
index f15731a..609eb7a 100644
@@ -511,6 +511,8 @@ int cmd_annotate(int argc, const char **argv)
 
 	setup_browser(true);
 
+	build_lib_warning();
+
 	ret = __cmd_annotate(&annotate);
 
 out_delete:
tools/perf/builtin-report.c +2 -0
index dd4df9a..550adb7 100644
@@ -1293,6 +1293,8 @@ int cmd_report(int argc, const char **argv)
 		}
 	}
 
+	build_lib_warning();
+
 	if (symbol__init(&session->header.env) < 0)
 		goto error;
 
tools/perf/util/symbol.c +21 -0
index cc065d4..4205ba8 100644
@@ -2224,3 +2224,24 @@ int symbol__config_symfs(const struct option *opt __maybe_unused,
 	free(bf);
 	return 0;
 }
+
+void build_lib_warning(void)
+{
+#ifndef HAVE_LIBELF_SUPPORT
+	pr_warning("Symbols are disabled!\n"
+		   "Please install libelf-dev, libelf-devel "
+		   "or elfutils-libelf-devel before building perf.\n");
+#endif
+
+#ifndef HAVE_DWARF_SUPPORT
+	pr_warning("Unwind support is disabled!\n"
+		   "Please install elfutils-devel/libdw-dev "
+		   "before building perf.\n");
+#endif
+
+#ifndef HAVE_LIBBFD_SUPPORT
+	pr_warning("C++ demangling and line numbers are disabled!\n"
+		   "Please install binutils-dev[el]/"
+		   "libiberty-dev before building perf.\n");
+#endif
+}
tools/perf/util/symbol.h +2 -0
index 0563f33..d88e046 100644
@@ -383,6 +383,8 @@ int get_sdt_note_list(struct list_head *head, const char *target);
 int cleanup_sdt_note_list(struct list_head *sdt_notes);
 int sdt_notes__get_count(struct list_head *start);
 
+void build_lib_warning(void);
+
 #define SDT_BASE_SCN ".stapsdt.base"
 #define SDT_NOTE_SCN  ".note.stapsdt"
 #define SDT_NOTE_TYPE 3
Signature · 1 line
2.7.4
#1 lore raw
Quoted 1 line · Jin Yao

We keep having bug reports that when users build perf on their own,

we already have same warnings during the build

Quoted 1 line

but they don't install some needed libraries like libelf, libbfd/libibery.

how about saying that in the symbol column,
instead of poluting report's output, like:

	$ perf report --stdio
	# Overhead  Command  Shared Object     Symbol (disabled)
	# ........  .......  ................  ......................

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

jirka

author
#2 lore raw
Quoted 5 lines · Jiri Olsa
Quoted 1 line · Jin Yao

We keep having bug reports that when users build perf on their own,

we already have same warnings during the build

Yes, there will be warnings displayed during the build if some libraries are missing.

While I do find the users (especially the new perf user) don't notice the warning. They only care about the success of build.

Once they use this perf version and find something working strangely, they will say that perf may have bug. :(

Quoted 10 lines
Quoted 1 line

but they don't install some needed libraries like libelf, libbfd/libibery.

how about saying that in the symbol column,
instead of poluting report's output, like:

	$ perf report --stdio
	# Overhead  Command  Shared Object     Symbol (disabled)
	# ........  .......  ................  ......................

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 7 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

Thanks
Jin Yao

author
#3 lore raw

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

Thanks
Jin Yao

Quoted 48 lines · Yao
Quoted 5 lines · Jiri Olsa
Quoted 1 line · Jin Yao

We keep having bug reports that when users build perf on their own,

we already have same warnings during the build

Yes, there will be warnings displayed during the build if some libraries are missing.

While I do find the users (especially the new perf user) don't notice the warning. They only care about the success of build.

Once they use this perf version and find something working strangely, they will say that perf may have bug. :(

Quoted 10 lines
Quoted 1 line

but they don't install some needed libraries like libelf, libbfd/libibery.

how about saying that in the symbol column,
instead of poluting report's output, like:

    $ perf report --stdio

    # Overhead  Command  Shared Object     Symbol (disabled) # ........  .......  ................  ......................

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 7 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

Thanks
Jin Yao

#4 lore raw
Quoted 11 lines · Yao

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

  $ ./perf -vv
  perf version 4.16.rc6.g18fd48
                   dwarf: [ on  ]
      dwarf_getlocations: [ on  ]
                   glibc: [ on  ]
                    gtk2: [ on  ]
                libaudit: [ on  ]
                  libbfd: [ on  ]
                  libelf: [ on  ]
                 libnuma: [ on  ]
  numa_num_possible_cpus: [ on  ]
                 libperl: [ on  ]
               libpython: [ on  ]
                libslang: [ on  ]
               libcrypto: [ on  ]
               libunwind: [ on  ]
      libdw-dwarf-unwind: [ on  ]
                    zlib: [ on  ]
                    lzma: [ on  ]
               get_cpuid: [ on  ]
                     bpf: [ on  ]

and perf -vvv could display the 'make VF=1' info

jirka

#5 lore raw

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 6 lines · Yao
Quoted 5 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Quoted 8 lines
Quoted 6 lines

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Lemme re-read the thread...

Quoted 52 lines
Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

  $ ./perf -vv
  perf version 4.16.rc6.g18fd48
                   dwarf: [ on  ]
      dwarf_getlocations: [ on  ]
                   glibc: [ on  ]
                    gtk2: [ on  ]
                libaudit: [ on  ]
                  libbfd: [ on  ]
                  libelf: [ on  ]
                 libnuma: [ on  ]
  numa_num_possible_cpus: [ on  ]
                 libperl: [ on  ]
               libpython: [ on  ]
                libslang: [ on  ]
               libcrypto: [ on  ]
               libunwind: [ on  ]
      libdw-dwarf-unwind: [ on  ]
                    zlib: [ on  ]
                    lzma: [ on  ]
               get_cpuid: [ on  ]
                     bpf: [ on  ]

and perf -vvv could display the 'make VF=1' info

jirka

#6 lore raw

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 10 lines · Yao
Quoted 9 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Lemme re-read the thread...

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

?

- Arnaldo

Quoted 53 lines
Quoted 53 lines
Quoted 15 lines
Quoted 15 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

  $ ./perf -vv
  perf version 4.16.rc6.g18fd48
                   dwarf: [ on  ]
      dwarf_getlocations: [ on  ]
                   glibc: [ on  ]
                    gtk2: [ on  ]
                libaudit: [ on  ]
                  libbfd: [ on  ]
                  libelf: [ on  ]
                 libnuma: [ on  ]
  numa_num_possible_cpus: [ on  ]
                 libperl: [ on  ]
               libpython: [ on  ]
                libslang: [ on  ]
               libcrypto: [ on  ]
               libunwind: [ on  ]
      libdw-dwarf-unwind: [ on  ]
                    zlib: [ on  ]
                    lzma: [ on  ]
               get_cpuid: [ on  ]
                     bpf: [ on  ]

and perf -vvv could display the 'make VF=1' info

jirka

#7 lore raw

Em Wed, Mar 21, 2018 at 12:43:15PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 19 lines

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 10 lines · Yao
Quoted 9 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Lemme re-read the thread...

Quoted 7 lines

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

?

And for some stuff, that we know people feel strongly about, like PeterZ with the TUI, the warning has to be subtle, like a one line "Please build with slang-devel to have interactive annotation".

- Arnaldo

#8 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 17 lines · Arnaldo Carvalho de Melo

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 16 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 14 lines · Yao
Quoted 11 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 7 lines
Quoted 1 line

Lemme re-read the thread...

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

hum, not sure we want to complicate the build even more than it is now :-\ and IMO it still won't help much in Jin's problem, if user forces the build anyway

jirka

#9 lore raw

Em Wed, Mar 21, 2018 at 05:04:46PM +0100, Jiri Olsa escreveu:

Quoted 26 lines · Arnaldo Carvalho de Melo
Quoted 17 lines

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 14 lines · Yao
Quoted 11 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 7 lines
Quoted 1 line

Lemme re-read the thread...

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

Quoted 3 lines

hum, not sure we want to complicate the build even more than it is now :-\ and IMO it still won't help much in Jin's problem, if user forces the build anyway

Well, if a user _forces_ a build, not taking into consideration a warning that _is_ emitted and _stops_ the build, about the functionality it will lose by doing forcing the build, then comes back and complains that that functionality is not present, then it becomes difficult to help this user... :-)

On the other hand, if the user forgets to install an important library, the warning is emitted but the build proceeds, no explicit action was performed, just a warning wasn't noticed, and the user complains, then I'd say: "hey, are you sure library foo devel files were present when you build it?", i.e. the support back and forth Jin is trying to avoid.

And for users that _saw_ the warning, _knew_ they _didn't_ want that functionality, to be reminded while running, say 'perf report' that something they _decided not to have_ isn't present, then that could be annoying, no?

Lemme try another idea: what if we do something like gcc does and print the features present when showing the version?

I.e.:

[acme@jouet perf]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
[acme@jouet perf]$

- Arnaldo

#10 lore raw
Quoted 65 lines · Arnaldo Carvalho de Melo

Em Wed, Mar 21, 2018 at 05:04:46PM +0100, Jiri Olsa escreveu:

Quoted 26 lines · Arnaldo Carvalho de Melo
Quoted 17 lines

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 14 lines · Yao
Quoted 11 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 7 lines
Quoted 1 line

Lemme re-read the thread...

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

Quoted 3 lines

hum, not sure we want to complicate the build even more than it is now :-\ and IMO it still won't help much in Jin's problem, if user forces the build anyway

Well, if a user _forces_ a build, not taking into consideration a warning that _is_ emitted and _stops_ the build, about the functionality it will lose by doing forcing the build, then comes back and complains that that functionality is not present, then it becomes difficult to help this user... :-)

On the other hand, if the user forgets to install an important library, the warning is emitted but the build proceeds, no explicit action was performed, just a warning wasn't noticed, and the user complains, then I'd say: "hey, are you sure library foo devel files were present when you build it?", i.e. the support back and forth Jin is trying to avoid.

And for users that _saw_ the warning, _knew_ they _didn't_ want that functionality, to be reminded while running, say 'perf report' that something they _decided not to have_ isn't present, then that could be annoying, no?

Lemme try another idea: what if we do something like gcc does and print the features present when showing the version?

I.e.:

[acme@jouet perf]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
[acme@jouet perf]$

Quoted 1 line

- Arnaldo

yep I guess you overlooked it in my previous reply ;-)

jirka

---

Quoted 29 lines

how about displaying libraries separately with -vv output, that would mimic the build message, like:

  $ ./perf -vv
  perf version 4.16.rc6.g18fd48
                   dwarf: [ on  ]
      dwarf_getlocations: [ on  ]
                   glibc: [ on  ]
                    gtk2: [ on  ]
                libaudit: [ on  ]
                  libbfd: [ on  ]
                  libelf: [ on  ]
                 libnuma: [ on  ]
  numa_num_possible_cpus: [ on  ]
                 libperl: [ on  ]
               libpython: [ on  ]
                libslang: [ on  ]
               libcrypto: [ on  ]
               libunwind: [ on  ]
      libdw-dwarf-unwind: [ on  ]
                    zlib: [ on  ]
                    lzma: [ on  ]
               get_cpuid: [ on  ]
                     bpf: [ on  ]

and perf -vvv could display the 'make VF=1' info

jirka

author
#11 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 65 lines · Arnaldo Carvalho de Melo

Em Wed, Mar 21, 2018 at 05:04:46PM +0100, Jiri Olsa escreveu:

Quoted 26 lines · Arnaldo Carvalho de Melo
Quoted 17 lines

Em Wed, Mar 21, 2018 at 12:40:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Wed, Mar 21, 2018 at 04:38:07PM +0100, Jiri Olsa escreveu:

Quoted 14 lines · Yao
Quoted 11 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 7 lines
Quoted 1 line

Lemme re-read the thread...

Well, how about we make it harder to build without key libraries? I.e. if we detect that what we consider a core set of libraries isn't found in the system, then we stop the build, warn about it and ask the user to confirm that the build should proceed by passing some explicit -DI_KNOW_WHAT_I_AM_DOING___PROCEED=doit

Quoted 3 lines

hum, not sure we want to complicate the build even more than it is now :-\ and IMO it still won't help much in Jin's problem, if user forces the build anyway

Well, if a user _forces_ a build, not taking into consideration a warning that _is_ emitted and _stops_ the build, about the functionality it will lose by doing forcing the build, then comes back and complains that that functionality is not present, then it becomes difficult to help this user... :-)

On the other hand, if the user forgets to install an important library, the warning is emitted but the build proceeds, no explicit action was performed, just a warning wasn't noticed, and the user complains, then I'd say: "hey, are you sure library foo devel files were present when you build it?", i.e. the support back and forth Jin is trying to avoid.

And for users that _saw_ the warning, _knew_ they _didn't_ want that functionality, to be reminded while running, say 'perf report' that something they _decided not to have_ isn't present, then that could be annoying, no?

Lemme try another idea: what if we do something like gcc does and print the features present when showing the version?

I.e.:

[acme@jouet perf]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
[acme@jouet perf]$

Quoted 2 lines

- Arnaldo

Is this too complicated for perf newbie to understand?

For my problem, the mistake only occurs on perf newbie. I just think, it'd better return a direct and clear message to them. Maybe they don't know or don't use -v or -vv to do more investigation by themselves.

Thanks
Jin Yao

author
#12 lore raw
In reply to Jiri Olsa
Quoted 64 lines · Jiri Olsa
Quoted 11 lines · Yao

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

   $ ./perf -vv
   perf version 4.16.rc6.g18fd48
                    dwarf: [ on  ]
       dwarf_getlocations: [ on  ]
                    glibc: [ on  ]
                     gtk2: [ on  ]
                 libaudit: [ on  ]
                   libbfd: [ on  ]
                   libelf: [ on  ]
                  libnuma: [ on  ]
   numa_num_possible_cpus: [ on  ]
                  libperl: [ on  ]
                libpython: [ on  ]
                 libslang: [ on  ]
                libcrypto: [ on  ]
                libunwind: [ on  ]
       libdw-dwarf-unwind: [ on  ]
                     zlib: [ on  ]
                     lzma: [ on  ]
                get_cpuid: [ on  ]
                      bpf: [ on  ]
Quoted 4 lines

and perf -vvv could display the 'make VF=1' info

jirka

I'm just afraid that the newbie will not check the -vv on his own when he gets trouble in using perf.

In other words, if a user is experienced and he knows -vv yet, I may assume that he should know installing all libraries before building the perf.

This patch is specific for the perf newbie. It will directly shows the error/warning when the user launches the perf binary. It will have a little bit helps, I guess. :)

Thanks
Jin Yao

#13 lore raw
Quoted 75 lines · Yao
Quoted 64 lines · Jiri Olsa
Quoted 11 lines · Yao

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

   $ ./perf -vv
   perf version 4.16.rc6.g18fd48
                    dwarf: [ on  ]
       dwarf_getlocations: [ on  ]
                    glibc: [ on  ]
                     gtk2: [ on  ]
                 libaudit: [ on  ]
                   libbfd: [ on  ]
                   libelf: [ on  ]
                  libnuma: [ on  ]
   numa_num_possible_cpus: [ on  ]
                  libperl: [ on  ]
                libpython: [ on  ]
                 libslang: [ on  ]
                libcrypto: [ on  ]
                libunwind: [ on  ]
       libdw-dwarf-unwind: [ on  ]
                     zlib: [ on  ]
                     lzma: [ on  ]
                get_cpuid: [ on  ]
                      bpf: [ on  ]
Quoted 4 lines

and perf -vvv could display the 'make VF=1' info

jirka

I'm just afraid that the newbie will not check the -vv on his own when he gets trouble in using perf.

Quoted 6 lines

In other words, if a user is experienced and he knows -vv yet, I may assume that he should know installing all libraries before building the perf.

This patch is specific for the perf newbie. It will directly shows the error/warning when the user launches the perf binary. It will have a little bit helps, I guess. :)

I just don't like the idea that when you run perf report, or annotate it spits out lines for every missing feature

maybe we could detect missing features for given command and display line about missing features and say something like:

'Warning: symbol,dwarf support not compiled in (for more details run perf -vv)'

or somwthing like that.. ;-)

jirka

author
#14 lore raw
Quoted 90 lines · Jiri Olsa
Quoted 75 lines · Yao
Quoted 64 lines · Jiri Olsa
Quoted 11 lines · Yao

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

    $ ./perf -vv
    perf version 4.16.rc6.g18fd48
                     dwarf: [ on  ]
        dwarf_getlocations: [ on  ]
                     glibc: [ on  ]
                      gtk2: [ on  ]
                  libaudit: [ on  ]
                    libbfd: [ on  ]
                    libelf: [ on  ]
                   libnuma: [ on  ]
    numa_num_possible_cpus: [ on  ]
                   libperl: [ on  ]
                 libpython: [ on  ]
                  libslang: [ on  ]
                 libcrypto: [ on  ]
                 libunwind: [ on  ]
        libdw-dwarf-unwind: [ on  ]
                      zlib: [ on  ]
                      lzma: [ on  ]
                 get_cpuid: [ on  ]
                       bpf: [ on  ]
Quoted 4 lines

and perf -vvv could display the 'make VF=1' info

jirka

I'm just afraid that the newbie will not check the -vv on his own when he gets trouble in using perf.

Quoted 6 lines

In other words, if a user is experienced and he knows -vv yet, I may assume that he should know installing all libraries before building the perf.

This patch is specific for the perf newbie. It will directly shows the error/warning when the user launches the perf binary. It will have a little bit helps, I guess. :)

I just don't like the idea that when you run perf report, or annotate it spits out lines for every missing feature

maybe we could detect missing features for given command and display line about missing features and say something like:

Quoted 6 lines

'Warning: symbol,dwarf support not compiled in (for more details run perf -vv)'

or somwthing like that.. ;-)

jirka

Hi Jiri,

I think your idea is very good!

I guess following it's just an example copied from perf building process, right?

$ ./perf -vv
perf version 4.16.rc6.g18fd48
                 dwarf: [ on  ]
    dwarf_getlocations: [ on  ]
                 glibc: [ on  ]
                  gtk2: [ on  ]
              libaudit: [ on  ]
                libbfd: [ on  ]
                libelf: [ on  ]
               libnuma: [ on  ]
numa_num_possible_cpus: [ on  ]
               libperl: [ on  ]
             libpython: [ on  ]
              libslang: [ on  ]
             libcrypto: [ on  ]
             libunwind: [ on  ]
    libdw-dwarf-unwind: [ on  ]
                  zlib: [ on  ]
                  lzma: [ on  ]
             get_cpuid: [ on  ]
                   bpf: [ on  ]

We can check some CFLAGS like "#ifdef HAVE_XXX" in perf code to determine if some libraries are compiled in.

For example,

#ifdef HAVE_LIBNUMA_SUPPORT
	printf("libnuma: [ on  ]");

#endif

For some features, such as "numa_num_possible_cpus", which doesn't have CFLAGS variables. Maybe we can ignore them in report?

I'd like to upgrade my patch to support perf -vv.

Thanks
Jin Yao

#15 lore raw

Em Fri, Mar 23, 2018 at 11:09:03AM +0800, Jin, Yao escreveu:

Quoted 131 lines · Jiri Olsa
Quoted 88 lines · Yao
Quoted 73 lines · Jiri Olsa
Quoted 64 lines · Yao
Quoted 11 lines

Hi Jiri,

I'm still thinking it's worth displaying the warning when perf missing some libraries.

Somebody just told me that perf didn't work well. While after some investigations, I found it's just missing some libraries when building the perf.

But I have spent some time on getting the root cause. If with this patch, it should be very easily to know that.

true.. Arnaldo, any feedback on this one?

Quoted 14 lines
Quoted 14 lines

I just think it'd better provide some hints to user. For example, "symbol is disabled and you need to install libelf/xxx", say something like that.

But it looks the column can't contain too much information (i.e. no more space to contain the entire hints).

Any idea? Or just add this warning in verbose mode?

Quoted 5 lines

also your change does not affect tui mode

annotation for some reason does not start at all.. could be little more verbose ;-)

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

jirka

Yes, it doesn't affect tui mode.

Or we just add this warning in verbose mode?

e.g. perf report -v?

how about displaying libraries separately with -vv output, that would mimic the build message, like:

    $ ./perf -vv
    perf version 4.16.rc6.g18fd48
                     dwarf: [ on  ]
        dwarf_getlocations: [ on  ]
                     glibc: [ on  ]
                      gtk2: [ on  ]
                  libaudit: [ on  ]
                    libbfd: [ on  ]
                    libelf: [ on  ]
                   libnuma: [ on  ]
    numa_num_possible_cpus: [ on  ]
                   libperl: [ on  ]
                 libpython: [ on  ]
                  libslang: [ on  ]
                 libcrypto: [ on  ]
                 libunwind: [ on  ]
        libdw-dwarf-unwind: [ on  ]
                      zlib: [ on  ]
                      lzma: [ on  ]
                 get_cpuid: [ on  ]
                       bpf: [ on  ]
Quoted 4 lines

and perf -vvv could display the 'make VF=1' info

jirka

I'm just afraid that the newbie will not check the -vv on his own when he gets trouble in using perf.

Quoted 6 lines

In other words, if a user is experienced and he knows -vv yet, I may assume that he should know installing all libraries before building the perf.

This patch is specific for the perf newbie. It will directly shows the error/warning when the user launches the perf binary. It will have a little bit helps, I guess. :)

I just don't like the idea that when you run perf report, or annotate it spits out lines for every missing feature

maybe we could detect missing features for given command and display line about missing features and say something like:

Quoted 6 lines

'Warning: symbol,dwarf support not compiled in (for more details run perf -vv)'

or somwthing like that.. ;-)

jirka

Hi Jiri,

I think your idea is very good!

I guess following it's just an example copied from perf building process, right?

$ ./perf -vv
perf version 4.16.rc6.g18fd48
                 dwarf: [ on  ]
    dwarf_getlocations: [ on  ]
                 glibc: [ on  ]
                  gtk2: [ on  ]
              libaudit: [ on  ]
                libbfd: [ on  ]
                libelf: [ on  ]
               libnuma: [ on  ]
numa_num_possible_cpus: [ on  ]
               libperl: [ on  ]
             libpython: [ on  ]
              libslang: [ on  ]
             libcrypto: [ on  ]
             libunwind: [ on  ]
    libdw-dwarf-unwind: [ on  ]
                  zlib: [ on  ]
                  lzma: [ on  ]
             get_cpuid: [ on  ]
                   bpf: [ on  ]

We can check some CFLAGS like "#ifdef HAVE_XXX" in perf code to determine if some libraries are compiled in.

For example,

Quoted 8 lines
#ifdef HAVE_LIBNUMA_SUPPORT
	printf("libnuma: [ on  ]");

#endif

For some features, such as "numa_num_possible_cpus", which doesn't have CFLAGS variables. Maybe we can ignore them in report?

I'd like to upgrade my patch to support perf -vv.

Please go ahead! :-) We're all on the same page now, I think.

- Arnaldo

#16 lore raw

On Fri, Mar 23, 2018 at 11:50:49AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

I just don't like the idea that when you run perf report, or annotate it spits out lines for every missing feature

maybe we could detect missing features for given command and display line about missing features and say something like:

'Warning: symbol,dwarf support not compiled in (for more details run perf -vv)'

or somwthing like that.. ;-)

jirka

Quoted 6 lines
Quoted 6 lines

Hi Jiri,

I think your idea is very good!

I guess following it's just an example copied from perf building process, right?

yes

Quoted 24 lines
Quoted 24 lines
$ ./perf -vv
perf version 4.16.rc6.g18fd48
                 dwarf: [ on  ]
    dwarf_getlocations: [ on  ]
                 glibc: [ on  ]
                  gtk2: [ on  ]
              libaudit: [ on  ]
                libbfd: [ on  ]
                libelf: [ on  ]
               libnuma: [ on  ]
numa_num_possible_cpus: [ on  ]
               libperl: [ on  ]
             libpython: [ on  ]
              libslang: [ on  ]
             libcrypto: [ on  ]
             libunwind: [ on  ]
    libdw-dwarf-unwind: [ on  ]
                  zlib: [ on  ]
                  lzma: [ on  ]
             get_cpuid: [ on  ]
                   bpf: [ on  ]
Quoted 8 lines
Quoted 8 lines

We can check some CFLAGS like "#ifdef HAVE_XXX" in perf code to determine if some libraries are compiled in.

For example,

#ifdef HAVE_LIBNUMA_SUPPORT
	printf("libnuma: [ on  ]");

#endif

please display also the OFF status, to mirror the build output

#ifdef HAVE_LIBNUMA_SUPPORT
	printf("libnuma: [ on  ]");
#else
	printf("libnuma: [ OFF ]");

#endif

or in some other smarter way..

Quoted 7 lines
Quoted 5 lines

For some features, such as "numa_num_possible_cpus", which doesn't have CFLAGS variables. Maybe we can ignore them in report?

I'd like to upgrade my patch to support perf -vv.

Please go ahead! :-) We're all on the same page now, I think.

yes ;-)

jirka