From: Masami Hiramatsu <mhiramat@kernel.org>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Anju T Sudhakar <anju@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
ananth@in.ibm.com, mahesh@linux.vnet.ibm.com, paulus@samba.org,
mhiramat@kernel.org, srikar@linux.vnet.ibm.com
Subject: Re: [PATCH V3 3/4] arch/powerpc: Implement Optprobes
Date: Tue, 7 Feb 2017 10:05:41 +0900 [thread overview]
Message-ID: <20170207100541.7860e846f3def13a628bb05d@kernel.org> (raw)
In-Reply-To: <20170203193949.GD4090@naverao1-tp.localdomain>
On Sat, 4 Feb 2017 01:09:49 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> Hi Michael,
> Thanks for the review! I'll defer to Anju on most of the aspects, but...
>
> On 2017/02/01 09:53PM, Michael Ellerman wrote:
> > Anju T Sudhakar <anju@linux.vnet.ibm.com> writes:
> >
> > > +static void optimized_callback(struct optimized_kprobe *op,
> > > + struct pt_regs *regs)
> > > +{
> > > + struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
> > > + unsigned long flags;
> > > +
> > > + /* This is possible if op is under delayed unoptimizing */
> > > + if (kprobe_disabled(&op->kp))
> > > + return;
> > > +
> > > + local_irq_save(flags);
> >
> > What is that protecting against? Because on powerpc it doesn't actually
> > disable interrupts, it just masks some of them, the perf interrupt for
> > example can still run.
>
> That's an excellent catch, as always! :)
>
> This is meant to prevent us from missing kprobe hits while processing
> interrupts that arrive when this optprobe is being handled. And you are
> totally right -- we would miss kprobe hits during PMI handling with the
> current approach. We need a hard_irq_disable() there.
One note: it depends on the arch implementation of kprobes, since this
is only for "emulating" the int3 behavior on x86 for compatibility.
On x86, int3 is disabling interrupt automatically, so all the kprobes
user handlers will be run under irq-disabled. This means that user may
write their code to run as such condition. They even can not know
that is optimized or not at programming timing, because the kprobe
will be optimized after a while from enabled it.
So the important point is that you have to keep it compatible of
unoptimized kprobes.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2017-02-07 1:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 13:18 [PATCH V3 0/4] OPTPROBES for powerpc Anju T Sudhakar
2016-12-19 13:18 ` [PATCH V3 3/4] arch/powerpc: Implement Optprobes Anju T Sudhakar
2016-12-25 2:54 ` Masami Hiramatsu
2017-01-04 10:25 ` Naveen N. Rao
2017-01-30 20:43 ` Michael Ellerman
2017-01-31 7:55 ` Naveen N. Rao
2017-01-31 7:59 ` [PATCH] powerpc: kprobes: fixes for kprobe_lookup_name on BE Naveen N. Rao
2017-02-01 10:53 ` [PATCH V3 3/4] arch/powerpc: Implement Optprobes Michael Ellerman
2017-02-03 19:39 ` Naveen N. Rao
2017-02-07 1:05 ` Masami Hiramatsu [this message]
2017-02-07 7:51 ` Naveen N. Rao
2017-02-08 5:37 ` Anju T Sudhakar
2016-12-19 13:18 ` [PATCH V3 4/4] arch/powerpc: Optimize kprobe in kretprobe_trampoline Anju T Sudhakar
2016-12-19 13:18 ` [PATCH V3 1/4] powerpc: asm/ppc-opcode.h: introduce __PPC_SH64() Anju T Sudhakar
2016-12-19 13:18 ` [PATCH V3 2/4] powerpc: add helper to check if offset is within rel branch range Anju T Sudhakar
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=20170207100541.7860e846f3def13a628bb05d@kernel.org \
--to=mhiramat@kernel.org \
--cc=ananth@in.ibm.com \
--cc=anju@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=srikar@linux.vnet.ibm.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).