Thread (40 messages) 40 messages, 5 authors, 2023-07-25

Re: [PATCH v2 2/9] bpf/btf: tracing: Move finding func-proto API and getting func-param API to BTF

From: Donglin Peng <hidden>
Date: 2023-07-19 02:10:10
Also in: bpf, lkml

On Wed, Jul 19, 2023 at 7:03 AM Masami Hiramatsu [off-list ref] wrote:
On Tue, 18 Jul 2023 10:11:01 -0700
Alexei Starovoitov [off-list ref] wrote:
quoted
On Tue, Jul 18, 2023 at 6:56 AM Masami Hiramatsu [off-list ref] wrote:
quoted
On Tue, 18 Jul 2023 19:44:31 +0900
Masami Hiramatsu (Google) [off-list ref] wrote:
quoted
quoted
quoted
 static const struct btf_param *find_btf_func_param(const char *funcname, s32 *nr,
                                                   bool tracepoint)
 {
+       struct btf *btf = traceprobe_get_btf();
I found that traceprobe_get_btf() only returns the vmlinux's btf. But
if the function is
defined in a kernel module, we should get the module's btf.
Good catch! That should be a separated fix (or improvement?)
I think it's better to use btf_get() and btf_put(), and pass btf via
traceprobe_parse_context.
Hmm, it seems that there is no exposed API to get the module's btf.
Should I use btf_idr and btf_idr_lock directly to find the corresponding
btf? If there isn't yet, I will add it too.
There is bpf_find_btf_id.
Probably drop 'static' from it and use it.
Thanks! BTW, that API seems to search BTF type info by name. If user want to
specify a module name, do we need a new API? (Or expand the function to parse
a module name in given name?)
btf_get_module_btf can be used to get a module's btf, but we have to use
find_module to get the module by its name firstly.
Thank you,
--
Masami Hiramatsu (Google) [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help