From: Steven Rostedt <rostedt@goodmis.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
Donglin Peng <dolinux.peng@gmail.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Sven Schnelle <svens@linux.ibm.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>, Guo Ren <guoren@kernel.org>,
Zheng Yejian <zhengyejian@huaweicloud.com>,
bpf@vger.kernel.org
Subject: Re: [PATCH v2 1/4] ftrace: Add print_function_args()
Date: Wed, 8 Jan 2025 10:24:43 -0500 [thread overview]
Message-ID: <20250108102443.415495e1@gandalf.local.home> (raw)
In-Reply-To: <41a44111-fa49-460a-afa3-2bad7758c60e@oracle.com>
On Wed, 8 Jan 2025 11:19:11 +0000
Alan Maguire <alan.maguire@oracle.com> wrote:
> >>> + trace_seq_printf(s, "(");
> >>> +
> >>> + if (!args)
> >>> + goto out;
> >>> + if (lookup_symbol_name(func, name))
> >>> + goto out;
> >>> +
> >>> + btf = bpf_get_btf_vmlinux();
> >>> + if (IS_ERR_OR_NULL(btf))
> >>> + goto out;
> >>
> >>
> >> There is no need to the retrieve the BTF of vmlinux, as btf_find_func_proto
> >> will return the correct BTF via its second parameter.
> >
> > Good catch! The second parameter of btf_find_func_proto() is output.
> >
>
> One thought here - with btf_find_func_proto(), we will try kernel BTF
> and then proceed to module BTF, iterating over all modules to find the
> function prototype. So where we are tracing module functions this could
> get expensive if such a function is frequently encountered, and it also
> opens up the risk that we end up using the wrong function prototype from
> the wrong module that just happens to match on function name.
>
> So I wonder if we could use the function address to do a more guided
> lookup. Perhaps we could use kallsyms_lookup(), retrieving the
> (potential) module name. Then maybe modify the signature of
> btf_find_func_proto() to take an optional module name parameter to avoid
> iteration? None of this is strictly needed, but it may speed things up a
> bit and give us more accurate parameter info for those few cases with
> name clashes, so could be done as a follow-up if needed. Thanks!
Well, every place this is called, we first get the function name from
kallsyms. Perhaps I can modify the code to get the module name as well, and
if it exists, we can pass that too?
-- Steve
next prev parent reply other threads:[~2025-01-08 15:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 20:13 [PATCH v2 0/4] ftrace: Add function arguments to function tracers Steven Rostedt
2024-12-23 20:13 ` [PATCH v2 1/4] ftrace: Add print_function_args() Steven Rostedt
2024-12-23 21:36 ` Steven Rostedt
2024-12-25 13:15 ` Masami Hiramatsu
2024-12-25 21:59 ` Steven Rostedt
[not found] ` <CAErzpms4g8=3486Uv-PPxiA0GSkNQQm1Ez67eo-H3LtAhTAJCA@mail.gmail.com>
2025-01-08 4:52 ` Masami Hiramatsu
2025-01-08 11:19 ` Alan Maguire
2025-01-08 15:24 ` Steven Rostedt [this message]
2025-01-08 15:39 ` Alan Maguire
2024-12-23 20:13 ` [PATCH v2 2/4] ftrace: Add support for function argument to graph tracer Steven Rostedt
2024-12-25 15:41 ` Masami Hiramatsu
2024-12-25 22:02 ` Steven Rostedt
2024-12-23 20:13 ` [PATCH v2 3/4] ftrace: Have funcgraph-args take affect during tracing Steven Rostedt
2024-12-25 14:23 ` Masami Hiramatsu
2024-12-23 20:13 ` [PATCH v2 4/4] ftrace: Add arguments to function tracer Steven Rostedt
2024-12-25 14:21 ` Masami Hiramatsu
2024-12-25 21:40 ` [PATCH v2 0/4] ftrace: Add function arguments to function tracers Jiri Olsa
2024-12-25 21:56 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250108102443.415495e1@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=alan.maguire@oracle.com \
--cc=aou@eecs.berkeley.edu \
--cc=bpf@vger.kernel.org \
--cc=dolinux.peng@gmail.com \
--cc=guoren@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=svens@linux.ibm.com \
--cc=zhengyejian@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox