lkml.org 
[lkml]   [2020]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V7 09/15] perf kcore_copy: Fix module map when there are no modules loaded
Em Tue, May 12, 2020 at 03:19:16PM +0300, Adrian Hunter escreveu:
> In the absence of any modules, no "modules" map is created, but there are
> other executable pages to map, due to eBPF JIT, kprobe or ftrace. Map them
> by recognizing that the first "module" symbol is not necessarily from a
> module, and adjust the map accordingly.

Applied,

- Arnaldo

> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/util/symbol-elf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index be5b493f8284..5e43054bffea 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -1458,6 +1458,7 @@ struct kcore_copy_info {
> u64 first_symbol;
> u64 last_symbol;
> u64 first_module;
> + u64 first_module_symbol;
> u64 last_module_symbol;
> size_t phnum;
> struct list_head phdrs;
> @@ -1534,6 +1535,8 @@ static int kcore_copy__process_kallsyms(void *arg, const char *name, char type,
> return 0;
>
> if (strchr(name, '[')) {
> + if (!kci->first_module_symbol || start < kci->first_module_symbol)
> + kci->first_module_symbol = start;
> if (start > kci->last_module_symbol)
> kci->last_module_symbol = start;
> return 0;
> @@ -1731,6 +1734,10 @@ static int kcore_copy__calc_maps(struct kcore_copy_info *kci, const char *dir,
> kci->etext += page_size;
> }
>
> + if (kci->first_module_symbol &&
> + (!kci->first_module || kci->first_module_symbol < kci->first_module))
> + kci->first_module = kci->first_module_symbol;
> +
> kci->first_module = round_down(kci->first_module, page_size);
>
> if (kci->last_module_symbol) {
> --
> 2.17.1
>

--

- Arnaldo

\
 
 \ /
  Last update: 2020-05-27 17:45    [W:0.254 / U:2.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site