From: Jiri Olsa <jolsa@redhat.com>
To: Jean Pihet <jean.pihet@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>, Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"patches@linaro.org" <patches@linaro.org>
Subject: Re: [PATCH 3/4] perf tools: Check libunwind for availability of dwarf parsing feature
Date: Tue, 24 Sep 2013 19:43:18 +0200 [thread overview]
Message-ID: <20130924174318.GE3080@krava.brq.redhat.com> (raw)
In-Reply-To: <CAFrcx1k-sfHMRz6mvibBbph4vNOMkVddE4LEE4yXbWHC3DwMZA@mail.gmail.com>
On Tue, Sep 24, 2013 at 02:03:47PM +0200, Jean Pihet wrote:
> Hi Jiri, Will,
>
> On 24 September 2013 12:06, Will Deacon <will.deacon@arm.com> wrote:
> > On Tue, Sep 24, 2013 at 10:34:50AM +0100, Jiri Olsa wrote:
> >> On Tue, Sep 24, 2013 at 10:55:32AM +0200, Jean Pihet wrote:
> >> > Ping on the series. The two patches above (3/4 and 4/4) are generic
> >> > while the two others are impacting ARM only.
> >> > Is it possible to get an Ack for the generic ones?
> >>
> >> I'm fine with those changes.. still I'm sort of worried about
> >> current DWARF unwind users (but not sure if there're any),
> >> who depends on packaged libunwind compiled without
> >> --enable-debug-frame option.
> >
> > Since x86 is the only architecture using libunwind with perf at the moment,
> > and I'd expect it to use .eh_frame for unwinding, I'm also not sure there
> > are any existing users to worry about.
> Right
>
> >
> >> I've seen your libunwind patch to make it default, but
> >> not sure if it was accepted.. if not, maybe we should
> >> detect this and build that code conditionaly.
> >
> > It certainly defaults to "on" for ARM, but other architectures have to
> > enable it explicitly afaict.
> Yes that is correct.
> This patch (3/4) detects if the debug frame code is enabled in
> libunwind and uses the lib only if it is the case.
My concern is about users (again, not sure if there are any ;-) )
that use this with packaged libunwind compiled without
--enable-debug-frame option.
For them perf will consider libunwind as 'not available' with
your changes:
...
CHK libunwind
config/Makefile:223: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1
...
and they'll need to compile their own libunwind
(thats the case on Fedora).
This could be solved by detecting this and make your
code conditional as attached below (not much tested).
thanks,
jirka
---
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 134b36e..d40cf0a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -223,6 +223,10 @@ ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
NO_LIBUNWIND := 1
endif # Libunwind support
+ifneq ($(call try-cc,$(SOURCE_LIBUNWIND_DEBUG_FRAME),$(FLAGS_UNWIND),libunwind debug_frame),y)
+ msg := $(warning No debug_frame support found in libunwind);
+CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+endif
endif # NO_LIBUNWIND
ifndef NO_LIBUNWIND
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 87124d0..645141c 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -178,6 +178,28 @@ extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
+int main(void)
+{
+ unw_addr_space_t addr_space;
+ addr_space = unw_create_addr_space(NULL, 0);
+ unw_init_remote(NULL, addr_space, NULL);
+ dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
+ return 0;
+}
+endef
+
+define SOURCE_LIBUNWIND_DEBUG_FRAME
+#include <libunwind.h>
+#include <stdlib.h>
+
+extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_dyn_info_t *di,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+
+#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
+
extern int
UNW_OBJ(dwarf_find_debug_frame) (int found, unw_dyn_info_t *di_debug,
unw_word_t ip,
@@ -189,11 +211,7 @@ UNW_OBJ(dwarf_find_debug_frame) (int found, unw_dyn_info_t *di_debug,
int main(void)
{
- unw_addr_space_t addr_space;
- addr_space = unw_create_addr_space(NULL, 0);
- unw_init_remote(NULL, addr_space, NULL);
dwarf_find_debug_frame(0, NULL, 0, 0, NULL, 0, 0);
- dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
return 0;
}
endef
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 429a99c..231c941 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -277,6 +277,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
return ret;
}
+#ifndef NO_LIBUNWIND_DEBUG_FRAME
static int read_unwind_spec_debug_frame(struct dso *dso,
struct machine *machine, u64 *offset)
{
@@ -294,6 +295,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
return -EINVAL;
}
+#endif
static struct map *find_map(unw_word_t ip, struct unwind_info *ui)
{
@@ -334,6 +336,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
need_unwind_info, arg);
}
+#ifndef NO_LIBUNWIND_DEBUG_FRAME
/* Check the .debug_frame section for unwinding info */
if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
memset(&di, 0, sizeof(di));
@@ -342,7 +345,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
return dwarf_search_unwind_table(as, ip, &di, pi,
need_unwind_info, arg);
}
-
+#endif
return -EINVAL;
}
next prev parent reply other threads:[~2013-09-24 17:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 9:17 [PATCH v2 0/4] perf: parse the dwarf backtrace info from .debug_frame section Jean Pihet
2013-09-16 9:17 ` [PATCH 1/4] ARM: perf: add support for perf registers API Jean Pihet
2013-09-16 9:17 ` [PATCH 2/4] ARM: perf: wire up perf_regs and unwind support for ARM Jean Pihet
2013-09-16 9:17 ` [PATCH 3/4] perf tools: Check libunwind for availability of dwarf parsing feature Jean Pihet
2013-09-17 10:29 ` Will Deacon
2013-09-24 8:55 ` Jean Pihet
2013-09-24 9:34 ` Jiri Olsa
2013-09-24 10:06 ` Will Deacon
2013-09-24 12:03 ` Jean Pihet
2013-09-24 17:43 ` Jiri Olsa [this message]
2013-09-25 6:53 ` Jean Pihet
2013-09-25 7:31 ` Jiri Olsa
2013-09-26 11:39 ` Jean Pihet
2013-09-24 17:12 ` Arnaldo Carvalho de Melo
2013-09-30 16:01 ` Will Deacon
2013-09-16 9:17 ` [PATCH 4/4] perf: parse the .debug_frame section in case .eh_frame is not present Jean Pihet
2013-09-26 11:36 [PATCH v3 0/4] perf: parse the dwarf backtrace info from .debug_frame section Jean Pihet
2013-09-26 11:36 ` [PATCH 3/4] perf tools: Check libunwind for availability of dwarf parsing feature Jean Pihet
2013-09-26 12:48 ` Jiri Olsa
2013-10-08 10:44 ` Jean Pihet
2013-10-08 10:47 ` Peter Zijlstra
2013-10-08 14:15 ` Jean Pihet
2013-10-08 14:28 ` Arnaldo Carvalho de Melo
2013-10-08 14:31 ` Will Deacon
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=20130924174318.GE3080@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@ghostprotocols.net \
--cc=jean.pihet@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=patches@linaro.org \
--cc=will.deacon@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®