* [PATCH] perf callchain: separate eh/debug frame offset cache.
@ 2015-03-13 7:02 Wang Nan
2015-03-13 9:44 ` Namhyung Kim
2015-03-22 10:13 ` [tip:perf/core] perf callchain: Separate eh/ debug " tip-bot for Wang Nan
0 siblings, 2 replies; 6+ messages in thread
From: Wang Nan @ 2015-03-13 7:02 UTC (permalink / raw)
To: Namhyung Kim, Arnaldo Carvalho de Melo, Jiri Olsa,
linux-kernel@vger.kernel.org
Cc: Ingo Molnar, Li Zefan
Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for
dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr.
Unfortunately, it makes them share a same cache (dso->frame_offset).
Which causes unwind failure on ARM:
$ perf test unwind
Test dwarf unwind: FAILED!
The reason is that, if a dso has '.debug_frame' but doesn't have
'.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset
of '.debug_frame' during the first time calling of find_proc_info() ->
read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when
the second time calling of find_proc_info() ->
read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to
'.debug_frame'.
This patch solves the problem by creating two cache fields for
'.eh_frame_hdr' and '.debug_frame'.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
tools/perf/util/dso.h | 3 ++-
tools/perf/util/unwind-libunwind.c | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index ced9284..408c65f 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -139,7 +139,8 @@ struct dso {
u32 status_seen;
size_t file_size;
struct list_head open_entry;
- u64 frame_offset;
+ u64 debug_frame_offset;
+ u64 eh_frame_hdr_offset;
} data;
union { /* Tool specific area */
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index e3c40a5..7b09a44 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
u64 *fde_count)
{
int ret = -EINVAL, fd;
- u64 offset = dso->data.frame_offset;
+ u64 offset = dso->data.eh_frame_hdr_offset;
if (offset == 0) {
fd = dso__data_fd(dso, machine);
@@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
/* Check the .eh_frame section for unwinding info */
offset = elf_section_offset(fd, ".eh_frame_hdr");
- dso->data.frame_offset = offset;
+ dso->data.eh_frame_hdr_offset = offset;
}
if (offset)
@@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
struct machine *machine, u64 *offset)
{
int fd;
- u64 ofs = dso->data.frame_offset;
+ u64 ofs = dso->data.debug_frame_offset;
if (ofs == 0) {
fd = dso__data_fd(dso, machine);
@@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
/* Check the .debug_frame section for unwinding info */
ofs = elf_section_offset(fd, ".debug_frame");
- dso->data.frame_offset = ofs;
+ dso->data.debug_frame_offset = ofs;
}
*offset = ofs;
--
1.8.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] perf callchain: separate eh/debug frame offset cache. 2015-03-13 7:02 [PATCH] perf callchain: separate eh/debug frame offset cache Wang Nan @ 2015-03-13 9:44 ` Namhyung Kim 2015-03-19 6:20 ` Wang Nan 2015-03-22 10:13 ` [tip:perf/core] perf callchain: Separate eh/ debug " tip-bot for Wang Nan 1 sibling, 1 reply; 6+ messages in thread From: Namhyung Kim @ 2015-03-13 9:44 UTC (permalink / raw) To: Wang Nan Cc: Arnaldo Carvalho de Melo, Jiri Olsa, linux-kernel@vger.kernel.org, Ingo Molnar, Li Zefan Hi Wang, On Fri, Mar 13, 2015 at 03:02:56PM +0800, Wang Nan wrote: > Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for > dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr. > Unfortunately, it makes them share a same cache (dso->frame_offset). > Which causes unwind failure on ARM: > > $ perf test unwind > Test dwarf unwind: FAILED! > > The reason is that, if a dso has '.debug_frame' but doesn't have > '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset > of '.debug_frame' during the first time calling of find_proc_info() -> > read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when > the second time calling of find_proc_info() -> > read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to > '.debug_frame'. > > This patch solves the problem by creating two cache fields for > '.eh_frame_hdr' and '.debug_frame'. > > Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Thanks, Namhyung > --- > tools/perf/util/dso.h | 3 ++- > tools/perf/util/unwind-libunwind.c | 8 ++++---- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h > index ced9284..408c65f 100644 > --- a/tools/perf/util/dso.h > +++ b/tools/perf/util/dso.h > @@ -139,7 +139,8 @@ struct dso { > u32 status_seen; > size_t file_size; > struct list_head open_entry; > - u64 frame_offset; > + u64 debug_frame_offset; > + u64 eh_frame_hdr_offset; > } data; > > union { /* Tool specific area */ > diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c > index e3c40a5..7b09a44 100644 > --- a/tools/perf/util/unwind-libunwind.c > +++ b/tools/perf/util/unwind-libunwind.c > @@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, > u64 *fde_count) > { > int ret = -EINVAL, fd; > - u64 offset = dso->data.frame_offset; > + u64 offset = dso->data.eh_frame_hdr_offset; > > if (offset == 0) { > fd = dso__data_fd(dso, machine); > @@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, > > /* Check the .eh_frame section for unwinding info */ > offset = elf_section_offset(fd, ".eh_frame_hdr"); > - dso->data.frame_offset = offset; > + dso->data.eh_frame_hdr_offset = offset; > } > > if (offset) > @@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, > struct machine *machine, u64 *offset) > { > int fd; > - u64 ofs = dso->data.frame_offset; > + u64 ofs = dso->data.debug_frame_offset; > > if (ofs == 0) { > fd = dso__data_fd(dso, machine); > @@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, > > /* Check the .debug_frame section for unwinding info */ > ofs = elf_section_offset(fd, ".debug_frame"); > - dso->data.frame_offset = ofs; > + dso->data.debug_frame_offset = ofs; > } > > *offset = ofs; > -- > 1.8.3.4 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf callchain: separate eh/debug frame offset cache. 2015-03-13 9:44 ` Namhyung Kim @ 2015-03-19 6:20 ` Wang Nan 2015-03-19 14:03 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 6+ messages in thread From: Wang Nan @ 2015-03-19 6:20 UTC (permalink / raw) To: Ingo Molnar Cc: Namhyung Kim, Arnaldo Carvalho de Melo, Jiri Olsa, linux-kernel@vger.kernel.org, Li Zefan Hi Ingo, Could you please collect this patch? It fixes a bug which prevent unwind for ARM. Thank you. On 2015/3/13 17:44, Namhyung Kim wrote: > Hi Wang, > > On Fri, Mar 13, 2015 at 03:02:56PM +0800, Wang Nan wrote: >> Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for >> dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr. >> Unfortunately, it makes them share a same cache (dso->frame_offset). >> Which causes unwind failure on ARM: >> >> $ perf test unwind >> Test dwarf unwind: FAILED! >> >> The reason is that, if a dso has '.debug_frame' but doesn't have >> '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset >> of '.debug_frame' during the first time calling of find_proc_info() -> >> read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when >> the second time calling of find_proc_info() -> >> read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to >> '.debug_frame'. >> >> This patch solves the problem by creating two cache fields for >> '.eh_frame_hdr' and '.debug_frame'. >> >> Signed-off-by: Wang Nan <wangnan0@huawei.com> > > Acked-by: Namhyung Kim <namhyung@kernel.org> > > Thanks, > Namhyung > > >> --- >> tools/perf/util/dso.h | 3 ++- >> tools/perf/util/unwind-libunwind.c | 8 ++++---- >> 2 files changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h >> index ced9284..408c65f 100644 >> --- a/tools/perf/util/dso.h >> +++ b/tools/perf/util/dso.h >> @@ -139,7 +139,8 @@ struct dso { >> u32 status_seen; >> size_t file_size; >> struct list_head open_entry; >> - u64 frame_offset; >> + u64 debug_frame_offset; >> + u64 eh_frame_hdr_offset; >> } data; >> >> union { /* Tool specific area */ >> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c >> index e3c40a5..7b09a44 100644 >> --- a/tools/perf/util/unwind-libunwind.c >> +++ b/tools/perf/util/unwind-libunwind.c >> @@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, >> u64 *fde_count) >> { >> int ret = -EINVAL, fd; >> - u64 offset = dso->data.frame_offset; >> + u64 offset = dso->data.eh_frame_hdr_offset; >> >> if (offset == 0) { >> fd = dso__data_fd(dso, machine); >> @@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, >> >> /* Check the .eh_frame section for unwinding info */ >> offset = elf_section_offset(fd, ".eh_frame_hdr"); >> - dso->data.frame_offset = offset; >> + dso->data.eh_frame_hdr_offset = offset; >> } >> >> if (offset) >> @@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, >> struct machine *machine, u64 *offset) >> { >> int fd; >> - u64 ofs = dso->data.frame_offset; >> + u64 ofs = dso->data.debug_frame_offset; >> >> if (ofs == 0) { >> fd = dso__data_fd(dso, machine); >> @@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, >> >> /* Check the .debug_frame section for unwinding info */ >> ofs = elf_section_offset(fd, ".debug_frame"); >> - dso->data.frame_offset = ofs; >> + dso->data.debug_frame_offset = ofs; >> } >> >> *offset = ofs; >> -- >> 1.8.3.4 >> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf callchain: separate eh/debug frame offset cache. 2015-03-19 6:20 ` Wang Nan @ 2015-03-19 14:03 ` Arnaldo Carvalho de Melo 2015-03-19 14:11 ` Jiri Olsa 0 siblings, 1 reply; 6+ messages in thread From: Arnaldo Carvalho de Melo @ 2015-03-19 14:03 UTC (permalink / raw) To: Jiri Olsa Cc: Wang Nan, Ingo Molnar, Namhyung Kim, linux-kernel@vger.kernel.org, Li Zefan Em Thu, Mar 19, 2015 at 02:20:16PM +0800, Wang Nan escreveu: > Hi Ingo, > >> Could you please collect this patch? It fixes a bug which prevent unwind for ARM. Hi Jiri, can I have your Acked-by for this change, since you worked on this unwind code the most? - Arnaldo > > On 2015/3/13 17:44, Namhyung Kim wrote: > > Hi Wang, > > > > On Fri, Mar 13, 2015 at 03:02:56PM +0800, Wang Nan wrote: > >> Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for > >> dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr. > >> Unfortunately, it makes them share a same cache (dso->frame_offset). > >> Which causes unwind failure on ARM: > >> > >> $ perf test unwind > >> Test dwarf unwind: FAILED! > >> > >> The reason is that, if a dso has '.debug_frame' but doesn't have > >> '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset > >> of '.debug_frame' during the first time calling of find_proc_info() -> > >> read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when > >> the second time calling of find_proc_info() -> > >> read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to > >> '.debug_frame'. > >> > >> This patch solves the problem by creating two cache fields for > >> '.eh_frame_hdr' and '.debug_frame'. > >> > >> Signed-off-by: Wang Nan <wangnan0@huawei.com> > > > > Acked-by: Namhyung Kim <namhyung@kernel.org> > > > > Thanks, > > Namhyung > > > > > >> --- > >> tools/perf/util/dso.h | 3 ++- > >> tools/perf/util/unwind-libunwind.c | 8 ++++---- > >> 2 files changed, 6 insertions(+), 5 deletions(-) > >> > >> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h > >> index ced9284..408c65f 100644 > >> --- a/tools/perf/util/dso.h > >> +++ b/tools/perf/util/dso.h > >> @@ -139,7 +139,8 @@ struct dso { > >> u32 status_seen; > >> size_t file_size; > >> struct list_head open_entry; > >> - u64 frame_offset; > >> + u64 debug_frame_offset; > >> + u64 eh_frame_hdr_offset; > >> } data; > >> > >> union { /* Tool specific area */ > >> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c > >> index e3c40a5..7b09a44 100644 > >> --- a/tools/perf/util/unwind-libunwind.c > >> +++ b/tools/perf/util/unwind-libunwind.c > >> @@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, > >> u64 *fde_count) > >> { > >> int ret = -EINVAL, fd; > >> - u64 offset = dso->data.frame_offset; > >> + u64 offset = dso->data.eh_frame_hdr_offset; > >> > >> if (offset == 0) { > >> fd = dso__data_fd(dso, machine); > >> @@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, > >> > >> /* Check the .eh_frame section for unwinding info */ > >> offset = elf_section_offset(fd, ".eh_frame_hdr"); > >> - dso->data.frame_offset = offset; > >> + dso->data.eh_frame_hdr_offset = offset; > >> } > >> > >> if (offset) > >> @@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, > >> struct machine *machine, u64 *offset) > >> { > >> int fd; > >> - u64 ofs = dso->data.frame_offset; > >> + u64 ofs = dso->data.debug_frame_offset; > >> > >> if (ofs == 0) { > >> fd = dso__data_fd(dso, machine); > >> @@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, > >> > >> /* Check the .debug_frame section for unwinding info */ > >> ofs = elf_section_offset(fd, ".debug_frame"); > >> - dso->data.frame_offset = ofs; > >> + dso->data.debug_frame_offset = ofs; > >> } > >> > >> *offset = ofs; > >> -- > >> 1.8.3.4 > >> > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf callchain: separate eh/debug frame offset cache. 2015-03-19 14:03 ` Arnaldo Carvalho de Melo @ 2015-03-19 14:11 ` Jiri Olsa 0 siblings, 0 replies; 6+ messages in thread From: Jiri Olsa @ 2015-03-19 14:11 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Wang Nan, Ingo Molnar, Namhyung Kim, linux-kernel@vger.kernel.org, Li Zefan On Thu, Mar 19, 2015 at 11:03:52AM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Mar 19, 2015 at 02:20:16PM +0800, Wang Nan escreveu: > > Hi Ingo, > > > >> Could you please collect this patch? It fixes a bug which prevent unwind for ARM. > > Hi Jiri, can I have your Acked-by for this change, since you worked on > this unwind code the most? yep, it's ok Acked-by: Jiri Olsa <jolsa@kernel.org> jirka ^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:perf/core] perf callchain: Separate eh/ debug frame offset cache. 2015-03-13 7:02 [PATCH] perf callchain: separate eh/debug frame offset cache Wang Nan 2015-03-13 9:44 ` Namhyung Kim @ 2015-03-22 10:13 ` tip-bot for Wang Nan 1 sibling, 0 replies; 6+ messages in thread From: tip-bot for Wang Nan @ 2015-03-22 10:13 UTC (permalink / raw) To: linux-tip-commits Cc: namhyung, linux-kernel, tglx, wangnan0, acme, lizefan, jolsa, mingo, hpa Commit-ID: 303cb89a6d708da9c24f6f3390ff68a2bd822a13 Gitweb: http://git.kernel.org/tip/303cb89a6d708da9c24f6f3390ff68a2bd822a13 Author: Wang Nan <wangnan0@huawei.com> AuthorDate: Fri, 13 Mar 2015 15:02:56 +0800 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Thu, 19 Mar 2015 13:53:27 -0300 perf callchain: Separate eh/debug frame offset cache. Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr. Unfortunately, it makes them share a same cache (dso->frame_offset). Which causes unwind failure on ARM: $ perf test unwind Test dwarf unwind: FAILED! The reason is that, if a dso has '.debug_frame' but doesn't have '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset of '.debug_frame' during the first time calling of find_proc_info() -> read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when the second time calling of find_proc_info() -> read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to '.debug_frame'. This patch solves the problem by creating two cache fields for '.eh_frame_hdr' and '.debug_frame'. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Link: http://lkml.kernel.org/r/55028BA0.1030701@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/dso.h | 3 ++- tools/perf/util/unwind-libunwind.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index ced9284..408c65f 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -139,7 +139,8 @@ struct dso { u32 status_seen; size_t file_size; struct list_head open_entry; - u64 frame_offset; + u64 debug_frame_offset; + u64 eh_frame_hdr_offset; } data; union { /* Tool specific area */ diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index e3c40a5..7b09a44 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c @@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, u64 *fde_count) { int ret = -EINVAL, fd; - u64 offset = dso->data.frame_offset; + u64 offset = dso->data.eh_frame_hdr_offset; if (offset == 0) { fd = dso__data_fd(dso, machine); @@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, /* Check the .eh_frame section for unwinding info */ offset = elf_section_offset(fd, ".eh_frame_hdr"); - dso->data.frame_offset = offset; + dso->data.eh_frame_hdr_offset = offset; } if (offset) @@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, struct machine *machine, u64 *offset) { int fd; - u64 ofs = dso->data.frame_offset; + u64 ofs = dso->data.debug_frame_offset; if (ofs == 0) { fd = dso__data_fd(dso, machine); @@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso, /* Check the .debug_frame section for unwinding info */ ofs = elf_section_offset(fd, ".debug_frame"); - dso->data.frame_offset = ofs; + dso->data.debug_frame_offset = ofs; } *offset = ofs; ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-22 10:13 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-13 7:02 [PATCH] perf callchain: separate eh/debug frame offset cache Wang Nan 2015-03-13 9:44 ` Namhyung Kim 2015-03-19 6:20 ` Wang Nan 2015-03-19 14:03 ` Arnaldo Carvalho de Melo 2015-03-19 14:11 ` Jiri Olsa 2015-03-22 10:13 ` [tip:perf/core] perf callchain: Separate eh/ debug " tip-bot for Wang Nan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox