]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf symbol: Pass is_kallsyms to symbols__fixup_end()
authorNamhyung Kim <namhyung@kernel.org>
Sat, 16 Apr 2022 00:40:46 +0000 (17:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:05:07 +0000 (09:05 +0200)
commit 838425f2defe5262906b698752d28fd2fca1aac2 upstream.

The symbol fixup is necessary for symbols in kallsyms since they don't
have size info.  So we use the next symbol's address to calculate the
size.  Now it's also used for user binaries because sometimes they miss
size for hand-written asm functions.

There's a arch-specific function to handle kallsyms differently but
currently it cannot distinguish kallsyms from others.  Pass this
information explicitly to handle it properly.  Note that those arch
functions will be moved to the generic function so I didn't added it to
the arch-functions.

Fixes: 3cf6a32f3f2a4594 ("perf symbols: Fix symbol size calculation condition")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-s390@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20220416004048.1514900-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/perf/util/symbol-elf.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h

index 7356eb398b32a1dad3cc93e6cf2d0386fa501bf4..94809aed8b447c6ffd71f7e553ff6cf2581f26d2 100644 (file)
@@ -1245,7 +1245,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
         * For misannotated, zeroed, ASM function sizes.
         */
        if (nr > 0) {
-               symbols__fixup_end(&dso->symbols);
+               symbols__fixup_end(&dso->symbols, false);
                symbols__fixup_duplicate(&dso->symbols);
                if (kmap) {
                        /*
index 3609da7cce0abb781889f39887dbf4b2a73915e0..cd4991b514b868f7b8b4f59910126f111b34ac7f 100644 (file)
@@ -217,7 +217,8 @@ again:
        }
 }
 
-void symbols__fixup_end(struct rb_root_cached *symbols)
+void symbols__fixup_end(struct rb_root_cached *symbols,
+                       bool is_kallsyms __maybe_unused)
 {
        struct rb_node *nd, *prevnd = rb_first_cached(symbols);
        struct symbol *curr, *prev;
@@ -1456,7 +1457,7 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
        if (kallsyms__delta(kmap, filename, &delta))
                return -1;
 
-       symbols__fixup_end(&dso->symbols);
+       symbols__fixup_end(&dso->symbols, true);
        symbols__fixup_duplicate(&dso->symbols);
 
        if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
@@ -1651,7 +1652,7 @@ int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
 #undef bfd_asymbol_section
 #endif
 
-       symbols__fixup_end(&dso->symbols);
+       symbols__fixup_end(&dso->symbols, false);
        symbols__fixup_duplicate(&dso->symbols);
        dso->adjust_symbols = 1;
 
index 954d6a049ee2386fba1b648065e01117d6284b3c..66d5b732bb7adbbee73b2f43468e3a20813a9efc 100644 (file)
@@ -192,7 +192,7 @@ void __symbols__insert(struct rb_root_cached *symbols, struct symbol *sym,
                       bool kernel);
 void symbols__insert(struct rb_root_cached *symbols, struct symbol *sym);
 void symbols__fixup_duplicate(struct rb_root_cached *symbols);
-void symbols__fixup_end(struct rb_root_cached *symbols);
+void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kallsyms);
 void maps__fixup_end(struct maps *maps);
 
 typedef int (*mapfn_t)(u64 start, u64 len, u64 pgoff, void *data);