From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Christoph Hellwig <hch@lst.de>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
lkml <linux-kernel@vger.kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCHv4 bpf-next 1/5] kallsyms: Fully export kallsyms_on_each_symbol function
Date: Fri, 29 Apr 2022 23:51:45 +0900 [thread overview]
Message-ID: <20220429235145.f2feede9555d587c32fca328@kernel.org> (raw)
In-Reply-To: <20220428201207.954552-2-jolsa@kernel.org>
On Thu, 28 Apr 2022 22:12:03 +0200
Jiri Olsa <jolsa@kernel.org> wrote:
> Fully exporting kallsyms_on_each_symbol function, so it can be used
> in following changes.
>
> Rather than adding another ifdef option let's export the function
> completely (when CONFIG_KALLSYMS option is defined).
>
This looks good to me.
Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org>
Thanks!
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> include/linux/kallsyms.h | 7 ++++++-
> kernel/kallsyms.c | 2 --
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
> index ce1bd2fbf23e..89f063651192 100644
> --- a/include/linux/kallsyms.h
> +++ b/include/linux/kallsyms.h
> @@ -65,11 +65,11 @@ static inline void *dereference_symbol_descriptor(void *ptr)
> return ptr;
> }
>
> +#ifdef CONFIG_KALLSYMS
> int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
> unsigned long),
> void *data);
>
> -#ifdef CONFIG_KALLSYMS
> /* Lookup the address for a symbol. Returns 0 if not found. */
> unsigned long kallsyms_lookup_name(const char *name);
>
> @@ -163,6 +163,11 @@ static inline bool kallsyms_show_value(const struct cred *cred)
> return false;
> }
>
> +static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, unsigned long),
> + void *data)
> +{
> + return -EOPNOTSUPP;
> +}
> #endif /*CONFIG_KALLSYMS*/
>
> static inline void print_ip_sym(const char *loglvl, unsigned long ip)
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index 79f2eb617a62..fdfd308bebc4 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -228,7 +228,6 @@ unsigned long kallsyms_lookup_name(const char *name)
> return module_kallsyms_lookup_name(name);
> }
>
> -#ifdef CONFIG_LIVEPATCH
> /*
> * Iterate over all symbols in vmlinux. For symbols from modules use
> * module_kallsyms_on_each_symbol instead.
> @@ -251,7 +250,6 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
> }
> return 0;
> }
> -#endif /* CONFIG_LIVEPATCH */
>
> static unsigned long get_symbol_pos(unsigned long addr,
> unsigned long *symbolsize,
> --
> 2.35.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2022-04-29 14:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 20:12 [PATCHv4 bpf-next 0/5] bpf: Speed up symbol resolving in kprobe multi link Jiri Olsa
2022-04-28 20:12 ` [PATCHv4 bpf-next 1/5] kallsyms: Fully export kallsyms_on_each_symbol function Jiri Olsa
2022-04-29 14:51 ` Masami Hiramatsu [this message]
2022-04-28 20:12 ` [PATCHv4 bpf-next 2/5] ftrace: Add ftrace_lookup_symbols function Jiri Olsa
2022-04-29 14:56 ` Masami Hiramatsu
2022-04-28 20:12 ` [PATCHv4 bpf-next 3/5] fprobe: Resolve symbols with ftrace_lookup_symbols Jiri Olsa
2022-04-29 14:54 ` Masami Hiramatsu
2022-04-28 20:12 ` [PATCHv4 bpf-next 4/5] bpf: Resolve symbols with ftrace_lookup_symbols for kprobe multi link Jiri Olsa
2022-04-28 20:12 ` [PATCHv4 bpf-next 5/5] selftests/bpf: Add attach bench test Jiri Olsa
2022-04-29 14:28 ` [PATCHv4 bpf-next 0/5] bpf: Speed up symbol resolving in kprobe multi link Andrii Nakryiko
2022-04-30 12:14 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220429235145.f2feede9555d587c32fca328@kernel.org \
--to=mhiramat@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hch@lst.de \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).