[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230611225407.3e9b8ad2@gandalf.local.home>
Date: Sun, 11 Jun 2023 22:54:07 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Yonghong Song <yhs@...a.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Andrii Nakryiko <andrii@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Jackie Liu <liu.yun@...ux.dev>
Subject: Re: [PATCHv2] ftrace: Show all functions with addresses in
available_filter_functions_addrs
On Sun, 11 Jun 2023 17:22:29 -0700
Yonghong Song <yhs@...a.com> wrote:
> > Note displayed address is the patch-site address and can differ from
> > /proc/kallsyms address.
>
> Could you explain how these addresses will be used in kernel, esp.
> since these addresses are different from kallsyms addresses?
These are the addresses that will be patched by the ftrace infrastructure.
It's more efficient to use these addresses when setting a function filter
with ftrace_set_filter_ip(), as it doesn't need to call into the kallsyms
infrastructure to look to see if the passed in ip lands on a function. That
is, if rec->ip matches the ip, it uses it. If you look at ftrace_location()
(which is used to find the record to be patched), it first does a search of
these addresses. If it doesn't find it, it then has to call into kallsyms
to find the start and end of the function, and do another search into that
range.
>
> Also, if there are multiple same static functions with
> different addresses, user space might need to check dwarf or
> proposed BTF_KIND_KFUNC (which encode kallsyms addresses)
> to find whether entry in available_filter_functions_addrs
> to be used. But addresses may not match. How this issue could
> be resolved?
Easy, you use the address between two other addresses in kallsyms. The
address is still in the function. The addresses in kallsyms is the starting
address, but there's cases that the patch location is not at the start.
-- Steve
Powered by blists - more mailing lists