From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751906AbdFPQZJ (ORCPT ); Fri, 16 Jun 2017 12:25:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbdFPQZH (ORCPT ); Fri, 16 Jun 2017 12:25:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3830219A9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Date: Fri, 16 Jun 2017 13:25:04 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: He Kuang , lkml , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern Subject: Re: [PATCH] perf unwind: Limit warnings when asked for not supported unwind Message-ID: <20170616162504.GJ3645@kernel.org> References: <20170616121253.3816-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170616121253.3816-1-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Jiri Olsa > --- > 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 > #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