From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] powerpc: kprobes: add support for KPROBES_ON_FTRACE
Date: Fri, 17 Feb 2017 01:19:35 +0530 [thread overview]
Message-ID: <20170216194935.GF4515@naverao1-tp.localdomain> (raw)
In-Reply-To: <20170215161126.104c1db721182e1e75244125@kernel.org>
On 2017/02/15 04:11PM, Masami Hiramatsu wrote:
> Hi Naveen,
>
> On Wed, 15 Feb 2017 00:28:34 +0530
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
>
> > diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c
> > index e51a045f3d3b..a8f414a0b141 100644
> > --- a/arch/powerpc/kernel/optprobes.c
> > +++ b/arch/powerpc/kernel/optprobes.c
> > @@ -70,6 +70,9 @@ static unsigned long can_optimize(struct kprobe *p)
> > struct instruction_op op;
> > unsigned long nip = 0;
> >
> > + if (unlikely(kprobe_ftrace(p)))
> > + return 0;
> > +
>
> Hmm, this should not be checked in arch-depend code, since it may duplicate
> code in each arch. Please try below.
Thanks, Masami!
>
> Thanks,
>
> commit 897bb304974c1b0c19a4274fea220b175b07f353
> Author: Masami Hiramatsu <mhiramat@kernel.org>
> Date: Wed Feb 15 15:48:14 2017 +0900
>
> kprobes: Skip preparing optprobe if the probe is ftrace-based
>
> Skip preparing optprobe if the probe is ftrace-based, since
> anyway, it must not be optimized (or already optimized by
> ftrace).
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
This works for me.
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Regards,
Naveen
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index ebb4dad..546a8b1 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -746,13 +746,20 @@ static void kill_optimized_kprobe(struct kprobe *p)
> arch_remove_optimized_kprobe(op);
> }
>
> +static inline
> +void __prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *p)
> +{
> + if (!kprobe_ftrace(p))
> + arch_prepare_optimized_kprobe(op, p);
> +}
> +
> /* Try to prepare optimized instructions */
> static void prepare_optimized_kprobe(struct kprobe *p)
> {
> struct optimized_kprobe *op;
>
> op = container_of(p, struct optimized_kprobe, kp);
> - arch_prepare_optimized_kprobe(op, p);
> + __prepare_optimized_kprobe(op, p);
> }
>
> /* Allocate new optimized_kprobe and try to prepare optimized instructions */
> @@ -766,7 +773,7 @@ static struct kprobe *alloc_aggr_kprobe(struct kprobe *p)
>
> INIT_LIST_HEAD(&op->list);
> op->kp.addr = p->addr;
> - arch_prepare_optimized_kprobe(op, p);
> + __prepare_optimized_kprobe(op, p);
>
> return &op->kp;
> }
>
>
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>
>
prev parent reply other threads:[~2017-02-16 19:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 18:58 [PATCH 1/3] powerpc: kprobes: add support for KPROBES_ON_FTRACE Naveen N. Rao
2017-02-14 18:58 ` [PATCH 2/3] powerpc: introduce a new helper to obtain function entry points Naveen N. Rao
2017-02-14 18:58 ` [PATCH 3/3] powerpc: kprobes: prefer ftrace when probing function entry Naveen N. Rao
2017-02-15 4:28 ` [PATCH 1/3] powerpc: kprobes: add support for KPROBES_ON_FTRACE Ananth N Mavinakayanahalli
2017-02-16 19:48 ` Naveen N. Rao
2017-02-15 7:11 ` Masami Hiramatsu
2017-02-16 19:49 ` Naveen N. Rao [this message]
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=20170216194935.GF4515@naverao1-tp.localdomain \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhiramat@kernel.org \
--cc=mpe@ellerman.id.au \
/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).