On Fri, Mar 22, 2024 at 9:07 AM Yonghong Song <yonghong.song@xxxxxxxxx> wrote: > > > On 3/22/24 5:26 AM, Jiri Olsa wrote: > > On Thu, Mar 21, 2024 at 01:01:24PM -0700, Yonghong Song wrote: > >> The current kprobe_multi_bench_attach/kernel test > >> reads sym names from /sys/kernel/tracing/available_filter_functions. > >> Some names do not agree with the corresponding entries in /proc/kallsyms > >> since the corresponding /proc/kallsyms syms have suffix '.llvm.<hash>'. > >> Actually, if we pass symbol names in /proc/kallsyms, > >> kprobe_multi_attach will be okay. > >> > >> This patch added a new subtest where addresses are retrieved from > >> /sys/kernel/tracing/available_filter_functions_addrs, and use the > >> address to consule /proc/kallsyms to get the function name. > > hm, I don't understand the reason for this test.. AFAICS test_kprobe_multi_bench_attach > > is doing that already, just reading available_filter_functions file > > > > both available_filter_functions_addrs and available_filter_functions have the > > same functions, there's just extra addresses in available_filter_functions_addrs > > The goal is to include those kernel functions filtered in patch 4. > But we cannot use the names from available_filter_functions[_addrs], > and we need to get names from /proc/kallsyms. Hence this patch. > This will test if we give names (<name>.llvm.<hash>) to kernel > for kprobe_multi_attach, things will be okay. > for patch #4 it would be good to not skip those *.llvm.* functions, but find the full name using kallsyms. While here we can use address based multi-attachment, while getting addresses from available_filter_functions_addrs? That way we'll have a test that benchmarks both symbol lookup paths in the kernel (where user provides symbol names as strings) and address-based lookup (where user provides raw addresses). > > > >> + *symsp = syms; > >> + *cntp = cnt; > >> + > >> +error: > >> + fclose(f); > >> + hashmap__free(map); > >> + if (err) { > >> + for (i = 0; i < cnt; i++) > >> + free(syms[i]); > >> + free(syms); > >> + } > >> + return err; > >> +} > >> + [...]