[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3efda195-2d1a-2207-62c1-759a53ece20d@fb.com>
Date: Tue, 5 Jul 2022 23:12:02 -0700
From: Yonghong Song <yhs@...com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>,
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>,
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 7/5/22 9:19 PM, Alexei Starovoitov wrote:
> 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?
Okay, a separate function is good too. Also agree with Alexei
that a separate init call bpf_ksym_iter_register() is needed
since we need late_initcall(...) instead of device_initcall(...)
to be consistent with other bpf_iter's.
Powered by blists - more mailing lists