Re: [PATCH bpf-next v7] selftests/bpf: trace_helpers.c: optimize kallsyms cache
From: Rong Tao
Date: Sat Aug 26 2023 - 10:52:55 EST
> perhaps we could fix that with 2 sets of functions:
>
> - load_kallsyms
> ksym_search
> ksym_get_addr
>
> that work like now on global syms pointer, perhaps we should
> initialize it before we run tests or use mutex for init
>
> - struct ksym *load_kallsyms_local()
> ksym_search_local(struct ksym *syms, ...)
> ksym_get_addr_local(struct ksym *syms, ...)
>
> that work on local ksyms cache and the test frees it at the end,
> it would be used in all tests that need updated kallsyms data and
> use load_kallsyms_refresh for that
Hi, jirka
How about keeping only one type of interface to avoid confusion about use
and mutex locks. Like:
struct ksyms *load_kallsyms(void);
struct ksyms *load_kallsyms_refresh(struct ksyms *ksyms);
void free_kallsyms(struct ksyms *ksyms);
struct ksym *ksym_search(struct ksyms *ksyms, long key);
long ksym_get_addr(struct ksyms *ksyms, const char *name);
I just submit v8 [0], please review.
[0] https://lore.kernel.org/lkml/tencent_6D23FE187408D965E95DFAA858BC7E8C760A@xxxxxx/