[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200318144649.GE11531@kernel.org>
Date: Wed, 18 Mar 2020 11:46:49 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Leo Yan <leo.yan@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Kate Stewart <kstewart@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Allison Randal <allison@...utok.net>,
John Garry <john.garry@...wei.com>,
Enrico Weigelt <info@...ux.net>, linux-kernel@...r.kernel.org,
Mike Leach <mike.leach@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Hendrik Brueckner <brueckner@...ux.vnet.ibm.com>,
Thomas Richter <tmricht@...ux.vnet.ibm.com>
Subject: Re: [PATCH v3] perf symbols: Consolidate symbol fixup issue
Em Wed, Mar 18, 2020 at 12:06:59PM +0100, Jiri Olsa escreveu:
> On Fri, Mar 06, 2020 at 09:57:58AM +0800, Leo Yan wrote:
> > After copying Arm64's perf archive with object files and perf.data file
> > to x86 laptop, the x86's perf kernel symbol resolution fails. It
> > outputs 'unknown' for all symbols parsing.
> >
> > This issue is root caused by the function elf__needs_adjust_symbols(),
> > x86 perf tool uses one weak version, Arm64 (and powerpc) has rewritten
> > their own version. elf__needs_adjust_symbols() decides if need to parse
> > symbols with the relative offset address; but x86 building uses the weak
> > function which misses to check for the elf type 'ET_DYN', so that it
> > cannot parse symbols in Arm DSOs due to the wrong result from
> > elf__needs_adjust_symbols().
> >
> > The DSO parsing should not depend on any specific architecture perf
> > building; e.g. x86 perf tool can parse Arm and Arm64 DSOs, vice versa.
> > And confirmed by Naveen N. Rao that powerpc64 kernels are not being
> > built as ET_DYN anymore and change to ET_EXEC.
> >
> > This patch removes the arch specific functions for Arm64 and powerpc and
> > changes elf__needs_adjust_symbols() as a common function.
> >
> > In the common elf__needs_adjust_symbols(), it checks an extra condition
> > 'ET_DYN' for elf header type. With this fixing, the Arm64 DSO can be
> > parsed properly with x86's perf tool.
> >
> > Before:
> >
> > # perf script
> > main 3258 1 branches: 0 [unknown] ([unknown]) => ffff800010c4665c [unknown] ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c46670 [unknown] ([kernel.kallsyms]) => ffff800010c4eaec [unknown] ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eaec [unknown] ([kernel.kallsyms]) => ffff800010c4eb00 [unknown] ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eb08 [unknown] ([kernel.kallsyms]) => ffff800010c4e780 [unknown] ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4e7a0 [unknown] ([kernel.kallsyms]) => ffff800010c4eeac [unknown] ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eebc [unknown] ([kernel.kallsyms]) => ffff800010c4ed80 [unknown] ([kernel.kallsyms])
> >
> > After:
> >
> > # perf script
> > main 3258 1 branches: 0 [unknown] ([unknown]) => ffff800010c4665c coresight_timeout+0x54 ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c46670 coresight_timeout+0x68 ([kernel.kallsyms]) => ffff800010c4eaec etm4_enable_hw+0x3cc ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eaec etm4_enable_hw+0x3cc ([kernel.kallsyms]) => ffff800010c4eb00 etm4_enable_hw+0x3e0 ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eb08 etm4_enable_hw+0x3e8 ([kernel.kallsyms]) => ffff800010c4e780 etm4_enable_hw+0x60 ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4e7a0 etm4_enable_hw+0x80 ([kernel.kallsyms]) => ffff800010c4eeac etm4_enable+0x2d4 ([kernel.kallsyms])
> > main 3258 1 branches: ffff800010c4eebc etm4_enable+0x2e4 ([kernel.kallsyms]) => ffff800010c4ed80 etm4_enable+0x1a8 ([kernel.kallsyms])
> >
> > v3: Changed to check for ET_DYN across all architectures.
> >
> > v2: Fixed Arm64 and powerpc native building.
> >
> > Reported-by: Mike Leach <mike.leach@...aro.org>
> > Signed-off-by: Leo Yan <leo.yan@...aro.org>
> > Reviewed-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
>
> Acked-by: Jiri Olsa <jolsa@...hat.com>
Thanks, applied.
- Arnaldo
Powered by blists - more mailing lists