[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+khW7h80NeCvUneKw1Sscpqt6xHhfV-pA8R_ygEBNharXnRSA@mail.gmail.com>
Date: Fri, 8 Jul 2022 16:17:10 -0700
From: Hao Luo <haoluo@...gle.com>
To: Alan Maguire <alan.maguire@...cle.com>
Cc: ast@...nel.org, andrii@...nel.org, daniel@...earbox.net,
kafai@...com, songliubraving@...com, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org, jolsa@...nel.org,
mhiramat@...nel.org, akpm@...ux-foundation.org, void@...ifault.com,
swboyd@...omium.org, ndesaulniers@...gle.com,
9erthalion6@...il.com, kennyyu@...com, geliang.tang@...e.com,
kuniyu@...zon.co.jp, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 bpf-next 1/2] bpf: add a ksym BPF iterator
Hi Alan,
On Wed, Jul 6, 2022 at 6:17 AM Alan Maguire <alan.maguire@...cle.com> 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@...il.com>
> Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
> Acked-by: Yonghong Song <yhs@...com>
> ---
> 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
>
Powered by blists - more mailing lists