Re: [PATCH 05/12] perf tools: Read also the end of the kernel

Arnaldo Carvalho de Melo
2019-05-24T18:46:15Z

Em Fri, May 24, 2019 at 03:17:17PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, May 24, 2019 at 03:15:06PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, May 08, 2019 at 03:20:03PM +0200, Jiri Olsa escreveu:
> > > We mark the end of kernel based on the first module,
> > > but that could cover some bpf program maps. Reading
> > > _etext symbol if it's present to get precise kernel
> > > map end.
> >
> > Investigating... Have you run 'perf test' before hitting the send
> > button? :-)
>
> <SNIP>
>
> > [root@quaco c]# perf test -v 1
> > 1: vmlinux symtab matches kallsyms :
> <SNIP>
> > --- start ---
> > ERR : 0xffffffff8cc00e41: __indirect_thunk_end not on kallsyms
> <SNIP>
> > test child finished with -1
> > ---- end ----
> > vmlinux symtab matches kallsyms: FAILED!
> > [root@quaco c]#
>
> So...
>
> [root@quaco c]# grep __indirect_thunk_end /proc/kallsyms
> ffffffff8cc00e41 T __indirect_thunk_end
> [root@quaco c]# grep -w _etext /proc/kallsyms
> ffffffff8cc00e41 T _etext
> [root@quaco c]#
>
> [root@quaco c]# grep -w ffffffff8cc00e41 /proc/kallsyms
> ffffffff8cc00e41 T _etext
> ffffffff8cc00e41 T __indirect_thunk_end
> [root@quaco c]#
>
> Lemme try to fix this.

So, I got this right before your patch:

commit 1d1c54c5bbf55256e691bedb47b0d14745043e80
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Fri May 24 15:39:00 2019 -0300

perf test vmlinux-kallsyms: Ignore aliases to _etext when searching on kallsyms

No need to search for aliases for the symbol that marks the end of the
kernel text segment, the following patch will make such symbols not to
be found when searching in the kallsyms maps causing this test to fail.

So as a prep patch to avoid breaking bisection, ignore such symbols.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: https://lkml.kernel.org/n/tip-qfwuih8cvmk9doh7k5k244eq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c
index 7691980b7df1..f101576d1c72 100644
--- a/tools/perf/tests/vmlinux-kallsyms.c
+++ b/tools/perf/tests/vmlinux-kallsyms.c
@@ -161,9 +161,16 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest

continue;
}
- } else
+ } else if (mem_start == kallsyms.vmlinux_map->end) {
+ /*
+ * Ignore aliases to _etext, i.e. to the end of the kernel text area,
+ * such as __indirect_thunk_end.
+ */
+ continue;
+ } else {
pr_debug("ERR : %#" PRIx64 ": %s not on kallsyms\n",
mem_start, sym->name);
+ }

err = -1;
}