OSDN Git Service

perf tests vmlinux-kallsyms: Update is_ignored_symbol function to match the kernel...
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Wed, 28 Sep 2022 04:52:18 +0000 (10:22 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 Sep 2022 14:11:33 +0000 (11:11 -0300)
commit506442439317153c1aa646fcb35f8678d42efce9
tree9d017512c4701f88f61bf6156824996015b648d5
parentf4a2aade6809c6573f420c6fc1031797dfe8a4d2
perf tests vmlinux-kallsyms: Update is_ignored_symbol function to match the kernel ignored list

The testcase “vmlinux-kallsyms.c” fails in powerpc.

vmlinux symtab matches kallsyms: FAILED!

This test look at the symbols in the vmlinux DSO and check if we find
all of them in the kallsyms dso.

But from the powerpc logs , observed that the failure happens for:

ERR : 0xc0000000000fe9c8: .Lmfspr_table not on kallsyms
ERR : 0xc0000000001009c8: .Lmtspr_table not on kallsyms

These are labels ( with .L) in the source code and has to be ignored.
Reference code with .Lmtspr_table: arch/powerpc/xmon/spr_access.S

The testcases invokes is_ignored_symbol() function to ignore hidden
symbols in the dso like local symbols. This function is adapted from
is_ignored_symbol() kernel function in code: scripts/kallsyms.c . The
kernel function got some updates which is not reflected in the testcase
function and the new updates also handles ignoring "labels".

Below is the changes that went in the kernel function.

 /* Symbol names that begin with the following are ignored.*/
 static const char * const ignored_prefixes[] = {
  "$", /* local symbols for ARM, MIPS, etc. */
- ".LASANPC", /* s390 kasan local symbols */
+ ".L", /* local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. */
  "__crc_", /* modversions */
  "__efistub_", /* arm64 EFI stub namespace */
- "__kvm_nvhe_", /* arm64 non-VHE KVM namespace */
+ "__kvm_nvhe_$", /* arm64 local symbols in non-VHE KVM namespace */
+ "__kvm_nvhe_.L", /* arm64 local symbols in non-VHE KVM namespace */
  "__AArch64ADRPThunk_", /* arm64 lld */
  "__ARMV5PILongThunk_", /* arm lld */
  "__ARMV7PILongThunk_",

This change is part of below commits and will handle the
symbols with “.L”

commit d4c858643263 ("kallsyms: ignore all local labels prefixed by '.L'")
commit 6ccf9cb557bd ("KVM: arm64: Symbolize the nVHE HYP addresses")

Update the testcase function to include the new changes.

Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20220928045218.37322-1-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/vmlinux-kallsyms.c