Re: [PATCHv3 bpf-next 2/5] ftrace: Add ftrace_lookup_symbols function
From: Andrii Nakryiko
Date: Wed Apr 27 2022 - 19:24:34 EST
On Wed, Apr 27, 2022 at 2:04 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> Adding ftrace_lookup_symbols function that resolves array of symbols
> with single pass over kallsyms.
>
> The user provides array of string pointers with count and pointer to
> allocated array for resolved values.
>
> int ftrace_lookup_symbols(const char **sorted_syms, size_t cnt,
> unsigned long *addrs)
>
> It iterates all kalsyms symbols and tries to loop up each in provided
typo: kallsyms
> symbols array with bsearch. The symbols array needs to be sorted by
> name for this reason.
>
> We also check each symbol to pass ftrace_location, because this API
> will be used for fprobe symbols resolving.
>
> Suggested-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
LGTM.
Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> include/linux/ftrace.h | 6 ++++
> kernel/kallsyms.c | 1 +
> kernel/trace/ftrace.c | 62 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 69 insertions(+)
>
[...]