From: Masami Hiramatsu <mhiramat@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linux-kernel@vger.kernel.org, anil.s.keshavamurthy@intel.com,
clang-built-linux@googlegroups.com,
Paul Mackerras <paulus@samba.org>,
mhiramat@kernel.org, naveen.n.rao@linux.ibm.com,
linuxppc-dev@lists.ozlabs.org, davem@davemloft.net
Subject: Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation
Date: Thu, 13 May 2021 08:43:31 +0900 [thread overview]
Message-ID: <20210513084331.58371b520af4aae914518552@kernel.org> (raw)
In-Reply-To: <472c597cc8cc8f74f037acf971f7799fb381a647.1620829724.git.christophe.leroy@csgroup.eu>
On Wed, 12 May 2021 14:29:26 +0000 (UTC)
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> Some architectures like powerpc require a non standard
> allocation of optinsn page, because module pages are
> too far from the kernel for direct branches.
>
> Define weak alloc_optinsn_page() and free_optinsn_page(), that
> fall back on alloc_insn_page() and free_insn_page() when not
> overriden by the architecture.
>
Looks good to me :)
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> kernel/kprobes.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 745f08fdd7a6..8c0a6fdef771 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -321,11 +321,21 @@ int kprobe_cache_get_kallsym(struct kprobe_insn_cache *c, unsigned int *symnum,
> }
>
> #ifdef CONFIG_OPTPROBES
> +void __weak *alloc_optinsn_page(void)
> +{
> + return alloc_insn_page();
> +}
> +
> +void __weak free_optinsn_page(void *page)
> +{
> + free_insn_page(page);
> +}
> +
> /* For optimized_kprobe buffer */
> struct kprobe_insn_cache kprobe_optinsn_slots = {
> .mutex = __MUTEX_INITIALIZER(kprobe_optinsn_slots.mutex),
> - .alloc = alloc_insn_page,
> - .free = free_insn_page,
> + .alloc = alloc_optinsn_page,
> + .free = free_optinsn_page,
> .sym = KPROBE_OPTINSN_PAGE_SYM,
> .pages = LIST_HEAD_INIT(kprobe_optinsn_slots.pages),
> /* .insn_size is initialized later */
> --
> 2.25.0
>
--
Masami Hiramatsu <mhiramat@kernel.org>
WARNING: multiple messages have this Message-ID (diff)
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com,
davem@davemloft.net, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
clang-built-linux@googlegroups.com
Subject: Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation
Date: Thu, 13 May 2021 08:43:31 +0900 [thread overview]
Message-ID: <20210513084331.58371b520af4aae914518552@kernel.org> (raw)
In-Reply-To: <472c597cc8cc8f74f037acf971f7799fb381a647.1620829724.git.christophe.leroy@csgroup.eu>
On Wed, 12 May 2021 14:29:26 +0000 (UTC)
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> Some architectures like powerpc require a non standard
> allocation of optinsn page, because module pages are
> too far from the kernel for direct branches.
>
> Define weak alloc_optinsn_page() and free_optinsn_page(), that
> fall back on alloc_insn_page() and free_insn_page() when not
> overriden by the architecture.
>
Looks good to me :)
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> kernel/kprobes.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 745f08fdd7a6..8c0a6fdef771 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -321,11 +321,21 @@ int kprobe_cache_get_kallsym(struct kprobe_insn_cache *c, unsigned int *symnum,
> }
>
> #ifdef CONFIG_OPTPROBES
> +void __weak *alloc_optinsn_page(void)
> +{
> + return alloc_insn_page();
> +}
> +
> +void __weak free_optinsn_page(void *page)
> +{
> + free_insn_page(page);
> +}
> +
> /* For optimized_kprobe buffer */
> struct kprobe_insn_cache kprobe_optinsn_slots = {
> .mutex = __MUTEX_INITIALIZER(kprobe_optinsn_slots.mutex),
> - .alloc = alloc_insn_page,
> - .free = free_insn_page,
> + .alloc = alloc_optinsn_page,
> + .free = free_optinsn_page,
> .sym = KPROBE_OPTINSN_PAGE_SYM,
> .pages = LIST_HEAD_INIT(kprobe_optinsn_slots.pages),
> /* .insn_size is initialized later */
> --
> 2.25.0
>
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2021-05-12 23:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-12 14:29 [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation Christophe Leroy
2021-05-12 14:29 ` Christophe Leroy
2021-05-12 14:29 ` [PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn Christophe Leroy
2021-05-12 14:29 ` Christophe Leroy
2021-05-12 17:29 ` kernel test robot
2021-05-12 17:29 ` kernel test robot
2021-05-12 17:29 ` kernel test robot
2021-05-12 20:11 ` kernel test robot
2021-05-12 20:11 ` kernel test robot
2021-05-12 20:11 ` kernel test robot
2021-05-12 23:44 ` Masami Hiramatsu
2021-05-12 23:44 ` Masami Hiramatsu
2021-05-12 19:04 ` [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation kernel test robot
2021-05-12 19:04 ` kernel test robot
2021-05-12 19:04 ` kernel test robot
2021-05-13 0:33 ` Masami Hiramatsu
2021-05-13 0:33 ` Masami Hiramatsu
2021-05-13 0:33 ` Masami Hiramatsu
2021-05-12 23:43 ` Masami Hiramatsu [this message]
2021-05-12 23:43 ` Masami Hiramatsu
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=20210513084331.58371b520af4aae914518552@kernel.org \
--to=mhiramat@kernel.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=christophe.leroy@csgroup.eu \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=paulus@samba.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.