Hi Alan, On Wed, Jul 6, 2022 at 6:17 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote: > > add a "ksym" iterator which provides access to a "struct kallsym_iter" > for each symbol. Intent is to support more flexible symbol parsing > as discussed in [1]. > > [1] https://lore.kernel.org/all/YjRPZj6Z8vuLeEZo@krava/ > > Suggested-by: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > Acked-by: Yonghong Song <yhs@xxxxxx> > --- > kernel/kallsyms.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 95 insertions(+) > [...] > + > +static struct bpf_iter_reg ksym_iter_reg_info = { > + .target = "ksym", > + .ctx_arg_info_size = 1, > + .ctx_arg_info = { > + { offsetof(struct bpf_iter__ksym, ksym), > + PTR_TO_BTF_ID_OR_NULL }, > + }, > + .seq_info = &ksym_iter_seq_info, > +}; > + Can we add allow resched here? .feature = BPF_ITER_RESCHED, I think this will improve the responsiveness of the kernel when iterating ksyms. Thanks, Hao > +BTF_ID_LIST(btf_ksym_iter_id) > +BTF_ID(struct, kallsym_iter) > + > +static int __init bpf_ksym_iter_register(void) > +{ > + int ret; > + > + ksym_iter_reg_info.ctx_arg_info[0].btf_id = *btf_ksym_iter_id; > + ret = bpf_iter_reg_target(&ksym_iter_reg_info); > + if (ret) > + pr_warn("Warning: could not register bpf ksym iterator: %d\n", ret); > + return ret; > +} > + > +late_initcall(bpf_ksym_iter_register); > + > +#endif /* CONFIG_BPF_SYSCALL */ > + > static inline int kallsyms_for_perf(void) > { > #ifdef CONFIG_PERF_EVENTS > -- > 1.8.3.1 >