[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQKvtoBkCEBNcwKp1dp9_OPy9CtLD=QqscMQQJdoUf7OkQ@mail.gmail.com>
Date: Tue, 5 Jul 2022 21:19:48 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Alan Maguire <alan.maguire@...cle.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Song Liu <songliubraving@...com>,
Martin KaFai Lau <kafai@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Vernet <void@...ifault.com>, swboyd@...omium.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Dmitrii Dolgov <9erthalion6@...il.com>,
Kenny Yu <kennyyu@...com>,
Geliang Tang <geliang.tang@...e.com>,
Kuniyuki Iwashima <kuniyu@...zon.co.jp>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 bpf-next 1/2] bpf: add a ksym BPF iterator
On Mon, Jul 4, 2022 at 6:55 AM Alan Maguire <alan.maguire@...cle.com> wrote:
> static inline int kallsyms_for_perf(void)
> {
> #ifdef CONFIG_PERF_EVENTS
> @@ -885,6 +967,18 @@ const char *kdb_walk_kallsyms(loff_t *pos)
> static int __init kallsyms_init(void)
> {
> proc_create("kallsyms", 0444, NULL, &kallsyms_proc_ops);
> +#if defined(CONFIG_BPF_SYSCALL)
> + {
> + 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;
> + }
> + }
> +#endif
The ifdef-s inside the function body are not pretty.
I feel the v2 version was cleaner.
static void __init bpf_ksym_iter_register()
were only missing late_initcall(bpf_ksym_iter_register);
to make it single #ifdef CONFIG_BPF_SYSCALL for everything.
wdyt?
Powered by blists - more mailing lists