* [PATCH v2] perf: unwind: Fix symfs with libdw
@ 2023-06-30 9:11 Vincent Whitchurch
2023-07-01 18:13 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Whitchurch @ 2023-06-30 9:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Ian Rogers, Adrian Hunter
Cc: linux-perf-users, linux-kernel, kernel, Vincent Whitchurch
Pass the full path including the symfs (if any) to libdw. Without this
unwinding fails with errors like this when a symfs is used:
unwind: failed with 'No such file or directory'"
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
I posted this last year but didn't receive any comments. This patch is
still needed in current mainline so here is a rebased version, fixing
some merge conflicts.
Changes in v2:
- Rebased to v6.4.
- Link to v1: https://lore.kernel.org/lkml/20221125112743.2285759-1-vincent.whitchurch@axis.com/
---
tools/perf/util/unwind-libdw.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index bdccfc511b7e2..30a63d819d74e 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -66,9 +66,13 @@ static int __report_module(struct addr_location *al, u64 ip,
mod = 0;
}
- if (!mod)
- mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1,
+ if (!mod) {
+ char filename[PATH_MAX];
+
+ __symbol__join_symfs(filename, sizeof(filename), dso->long_name);
+ mod = dwfl_report_elf(ui->dwfl, dso->short_name, filename, -1,
map__start(al->map) - map__pgoff(al->map), false);
+ }
if (!mod) {
char filename[PATH_MAX];
---
base-commit: 6995e2de6891c724bfeb2db33d7b87775f913ad1
change-id: 20230630-perf-libdw-symfs-9adb29f4df7d
Best regards,
--
Vincent Whitchurch <vincent.whitchurch@axis.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] perf: unwind: Fix symfs with libdw
2023-06-30 9:11 [PATCH v2] perf: unwind: Fix symfs with libdw Vincent Whitchurch
@ 2023-07-01 18:13 ` Namhyung Kim
2023-07-02 1:03 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2023-07-01 18:13 UTC (permalink / raw)
To: Vincent Whitchurch
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, linux-perf-users, linux-kernel, kernel
Hello,
On Fri, Jun 30, 2023 at 2:11 AM Vincent Whitchurch
<vincent.whitchurch@axis.com> wrote:
>
> Pass the full path including the symfs (if any) to libdw. Without this
> unwinding fails with errors like this when a symfs is used:
>
> unwind: failed with 'No such file or directory'"
>
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
> I posted this last year but didn't receive any comments. This patch is
> still needed in current mainline so here is a rebased version, fixing
> some merge conflicts.
Sorry that you didn't get any feedback. Looks like a real problem.
>
> Changes in v2:
> - Rebased to v6.4.
> - Link to v1: https://lore.kernel.org/lkml/20221125112743.2285759-1-vincent.whitchurch@axis.com/
In general, you'd better base your perf tools changes on the
perf/perf-tools (for fixes) or perf/perf-tools-next (for new features)
in git.kernel.org. But it seems this change applies cleanly.
> ---
> tools/perf/util/unwind-libdw.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
> index bdccfc511b7e2..30a63d819d74e 100644
> --- a/tools/perf/util/unwind-libdw.c
> +++ b/tools/perf/util/unwind-libdw.c
> @@ -66,9 +66,13 @@ static int __report_module(struct addr_location *al, u64 ip,
> mod = 0;
> }
>
> - if (!mod)
> - mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1,
> + if (!mod) {
> + char filename[PATH_MAX];
> +
> + __symbol__join_symfs(filename, sizeof(filename), dso->long_name);
As __symbol__join_symfs() will have dso->long_name when symfs
is not set, I don't think it changes the behavior, so
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> + mod = dwfl_report_elf(ui->dwfl, dso->short_name, filename, -1,
> map__start(al->map) - map__pgoff(al->map), false);
> + }
> if (!mod) {
> char filename[PATH_MAX];
>
>
> ---
> base-commit: 6995e2de6891c724bfeb2db33d7b87775f913ad1
> change-id: 20230630-perf-libdw-symfs-9adb29f4df7d
>
> Best regards,
> --
> Vincent Whitchurch <vincent.whitchurch@axis.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] perf: unwind: Fix symfs with libdw
2023-07-01 18:13 ` Namhyung Kim
@ 2023-07-02 1:03 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2023-07-02 1:03 UTC (permalink / raw)
To: Vincent Whitchurch
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, linux-perf-users, linux-kernel, kernel
On Sat, Jul 1, 2023 at 11:13 AM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hello,
>
> On Fri, Jun 30, 2023 at 2:11 AM Vincent Whitchurch
> <vincent.whitchurch@axis.com> wrote:
> >
> > Pass the full path including the symfs (if any) to libdw. Without this
> > unwinding fails with errors like this when a symfs is used:
> >
> > unwind: failed with 'No such file or directory'"
> >
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Applied to perf-tools-next, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-02 1:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-30 9:11 [PATCH v2] perf: unwind: Fix symfs with libdw Vincent Whitchurch
2023-07-01 18:13 ` Namhyung Kim
2023-07-02 1:03 ` Namhyung Kim
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).