linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf unwind: Limit warnings when asked for not supported unwind
@ 2017-06-16 12:12 Jiri Olsa
  2017-06-16 16:25 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2017-06-16 12:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: He Kuang, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern

Ingo reported following warning flooding the report out:

  unwind: target platform=x86 is not supported

We trigger this warning when the dwarf unwinder is asked to
process architecture which wasn't compiled in, like when you
get 32bit application samples on your 64bit server and you
don't have the 32bit remote unwind support compiled in.

This patch limits the warning to single message for arch,
and adds bits info. Above message is changed to:

  unwind: target platform=x86 32bit is not supported

Cc: He Kuang <hekuang@huawei.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/unwind-libunwind.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 6d542a4e0648..1439a6bcfa07 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -1,12 +1,24 @@
+#include <linux/err.h>
 #include "unwind.h"
 #include "thread.h"
 #include "session.h"
 #include "debug.h"
 #include "arch/common.h"
 
-struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
-struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
-struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops;
+enum {
+	ERR_LOCAL  = 0,
+	ERR_X86_32 = 1,
+	ERR_ARM64  = 2,
+};
+
+/*
+ * Set default error values, so we can warn appropriately when
+ * the support is not compiled in. Using negative values so we
+ * can use ERR macros.
+ */
+struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops  = (void *) -ERR_LOCAL;
+struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops = (void *) -ERR_X86_32;
+struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops  = (void *) -ERR_ARM64;
 
 static void unwind__register_ops(struct thread *thread,
 			  struct unwind_libunwind_ops *ops)
@@ -48,8 +60,15 @@ int unwind__prepare_access(struct thread *thread, struct map *map,
 			ops = arm64_unwind_libunwind_ops;
 	}
 
-	if (!ops) {
-		pr_err("unwind: target platform=%s is not supported\n", arch);
+	if (IS_ERR(ops)) {
+		static unsigned long warned;
+		long bit = -PTR_ERR(ops);
+
+		if (!test_and_set_bit(bit, &warned)) {
+			pr_err("unwind: target platform=%s %dbit is not supported\n",
+				arch, dso_type == DSO__TYPE_64BIT ? 64 : 32);
+		}
+
 		return -1;
 	}
 out_register:
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf unwind: Limit warnings when asked for not supported unwind
  2017-06-16 12:12 [PATCH] perf unwind: Limit warnings when asked for not supported unwind Jiri Olsa
@ 2017-06-16 16:25 ` Arnaldo Carvalho de Melo
  2017-06-18 22:53   ` Jiri Olsa
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-16 16:25 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: He Kuang, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern

Em Fri, Jun 16, 2017 at 02:12:53PM +0200, Jiri Olsa escreveu:
> Ingo reported following warning flooding the report out:
> 
>   unwind: target platform=x86 is not supported
> 
> We trigger this warning when the dwarf unwinder is asked to
> process architecture which wasn't compiled in, like when you
> get 32bit application samples on your 64bit server and you
> don't have the 32bit remote unwind support compiled in.
> 
> This patch limits the warning to single message for arch,
> and adds bits info. Above message is changed to:
> 
>   unwind: target platform=x86 32bit is not supported

Can we have a more informative message telling the user what is
necessary to have this feature supported?

The way you phrased it looks like it is not supported at all, while what
I read in the discussion is that one needs to have specific versions of
support libraries installed to have this working, right?

- Arnaldo
 
> Cc: He Kuang <hekuang@huawei.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/unwind-libunwind.c | 29 ++++++++++++++++++++++++-----
>  1 file changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> index 6d542a4e0648..1439a6bcfa07 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -1,12 +1,24 @@
> +#include <linux/err.h>
>  #include "unwind.h"
>  #include "thread.h"
>  #include "session.h"
>  #include "debug.h"
>  #include "arch/common.h"
>  
> -struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
> -struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
> -struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops;
> +enum {
> +	ERR_LOCAL  = 0,
> +	ERR_X86_32 = 1,
> +	ERR_ARM64  = 2,
> +};
> +
> +/*
> + * Set default error values, so we can warn appropriately when
> + * the support is not compiled in. Using negative values so we
> + * can use ERR macros.
> + */
> +struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops  = (void *) -ERR_LOCAL;
> +struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops = (void *) -ERR_X86_32;
> +struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops  = (void *) -ERR_ARM64;
>  
>  static void unwind__register_ops(struct thread *thread,
>  			  struct unwind_libunwind_ops *ops)
> @@ -48,8 +60,15 @@ int unwind__prepare_access(struct thread *thread, struct map *map,
>  			ops = arm64_unwind_libunwind_ops;
>  	}
>  
> -	if (!ops) {
> -		pr_err("unwind: target platform=%s is not supported\n", arch);
> +	if (IS_ERR(ops)) {
> +		static unsigned long warned;
> +		long bit = -PTR_ERR(ops);
> +
> +		if (!test_and_set_bit(bit, &warned)) {
> +			pr_err("unwind: target platform=%s %dbit is not supported\n",
> +				arch, dso_type == DSO__TYPE_64BIT ? 64 : 32);
> +		}
> +
>  		return -1;
>  	}
>  out_register:
> -- 
> 2.9.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf unwind: Limit warnings when asked for not supported unwind
  2017-06-16 16:25 ` Arnaldo Carvalho de Melo
@ 2017-06-18 22:53   ` Jiri Olsa
       [not found]     ` <CA+JHD91HyFiNkRpJU+y1ppQO6t8KS3QQKEacNw_bu6s9PFH11w@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2017-06-18 22:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, He Kuang, lkml, Ingo Molnar, Peter Zijlstra,
	Namhyung Kim, David Ahern

On Fri, Jun 16, 2017 at 01:25:04PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 16, 2017 at 02:12:53PM +0200, Jiri Olsa escreveu:
> > Ingo reported following warning flooding the report out:
> > 
> >   unwind: target platform=x86 is not supported
> > 
> > We trigger this warning when the dwarf unwinder is asked to
> > process architecture which wasn't compiled in, like when you
> > get 32bit application samples on your 64bit server and you
> > don't have the 32bit remote unwind support compiled in.
> > 
> > This patch limits the warning to single message for arch,
> > and adds bits info. Above message is changed to:
> > 
> >   unwind: target platform=x86 32bit is not supported
> 
> Can we have a more informative message telling the user what is
> necessary to have this feature supported?
> 
> The way you phrased it looks like it is not supported at all, while what
> I read in the discussion is that one needs to have specific versions of
> support libraries installed to have this working, right?

exactly, I'll dig out from changelogs needed libunwind version
and change the changelog in v2

jirka

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf unwind: Limit warnings when asked for not supported unwind
       [not found]     ` <CA+JHD91HyFiNkRpJU+y1ppQO6t8KS3QQKEacNw_bu6s9PFH11w@mail.gmail.com>
@ 2017-06-19 21:28       ` Jiri Olsa
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2017-06-19 21:28 UTC (permalink / raw)
  To: He Kuang, Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Jiri Olsa, Peter Zijlstra, Ingo Molnar,
	David Ahern, lkml, Arnaldo Carvalho de Melo

On Sun, Jun 18, 2017 at 08:01:38PM -0300, Arnaldo Carvalho de Melo wrote:
> Thanks!
> 
> On Jun 18, 2017 7:53 PM, "Jiri Olsa" <jolsa@redhat.com> wrote:
> 
> > On Fri, Jun 16, 2017 at 01:25:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Fri, Jun 16, 2017 at 02:12:53PM +0200, Jiri Olsa escreveu:
> > > > Ingo reported following warning flooding the report out:
> > > >
> > > >   unwind: target platform=x86 is not supported
> > > >
> > > > We trigger this warning when the dwarf unwinder is asked to
> > > > process architecture which wasn't compiled in, like when you
> > > > get 32bit application samples on your 64bit server and you
> > > > don't have the 32bit remote unwind support compiled in.
> > > >
> > > > This patch limits the warning to single message for arch,
> > > > and adds bits info. Above message is changed to:
> > > >
> > > >   unwind: target platform=x86 32bit is not supported
> > >
> > > Can we have a more informative message telling the user what is
> > > necessary to have this feature supported?
> > >
> > > The way you phrased it looks like it is not supported at all, while what
> > > I read in the discussion is that one needs to have specific versions of
> > > support libraries installed to have this working, right?
> >
> > exactly, I'll dig out from changelogs needed libunwind version
> > and change the changelog in v2

He Kuang,
could you please give me details on how to enable x86 remote unwind
on x86_64 server? can't find that in the libunwind's ./configure script

the feature tool detection example needs libunwind-x86.h header
and -lunwind-x86..  which is provided by libunwind-devel.i686 pkg,
but it conflicts with x86_64 libunwind-devel on fedora:

Error: Transaction check error:
  file /usr/include/libunwind.h from install of libunwind-devel-1.2-1.fc25.i686 conflicts with file from package libunwind-devel-1.2-1.fc25.x86_64

jirka

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-19 21:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 12:12 [PATCH] perf unwind: Limit warnings when asked for not supported unwind Jiri Olsa
2017-06-16 16:25 ` Arnaldo Carvalho de Melo
2017-06-18 22:53   ` Jiri Olsa
     [not found]     ` <CA+JHD91HyFiNkRpJU+y1ppQO6t8KS3QQKEacNw_bu6s9PFH11w@mail.gmail.com>
2017-06-19 21:28       ` Jiri Olsa

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