On Sun, 11 Jun 2023 17:22:29 -0700 Yonghong Song <yhs@xxxxxxxx> 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