From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
lkml <linux-kernel@vger.kernel.org>,
oleg@redhat.com, Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>, Ingo Molnar <mingo@elte.hu>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] [POWERPC] uprobes: powerpc port
Date: Fri, 8 Jun 2012 14:51:04 +0530 [thread overview]
Message-ID: <20120608092104.GF13409@in.ibm.com> (raw)
In-Reply-To: <1339137497.25573.9.camel@concordia>
On Fri, Jun 08, 2012 at 04:38:17PM +1000, Michael Ellerman wrote:
> On Fri, 2012-06-08 at 11:49 +0530, Ananth N Mavinakayanahalli wrote:
> > On Fri, Jun 08, 2012 at 04:17:44PM +1000, Michael Ellerman wrote:
> > > On Fri, 2012-06-08 at 11:31 +0530, Ananth N Mavinakayanahalli wrote:
> > > > On Fri, Jun 08, 2012 at 03:51:54PM +1000, Michael Ellerman wrote:
> > > > > On Fri, 2012-06-08 at 10:06 +0530, Ananth N Mavinakayanahalli wrote:
> > > >
> > > > But MSR_PR=1 and hence emulate_step() will return -1 and hence we will
> > > > end up single-stepping using user_enable_single_step(). Same with rfid.
> > >
> > > Right. But that was exactly Jim's point, you may be asked to emulate
> > > those instructions even though you wouldn't expect to see them in
> > > userspace code, so you need to handle it.
> > >
> > > Luckily it looks like emulate_step() will do the right thing for you.
> > > It'd be good to test it to make 100% sure.
> >
> > Sure. Will add that check and send v2.
>
> Sorry I didn't mean add a test in the code, I meant construct a test
> case to confirm that it works as expected.
Michael,
I just hand-coded the instr to emulate_step() and here are the results:
MSR_PR is set
insn = 7c600124, ret = 0 /* mtmsr */
insn = 7c600164, ret = 0 /* mtmsrd */
insn = 4c000024, ret = -1 /* rfid */
insn = 4c000064, ret = 0 /* rfi */
Also verified that standalone programs with those instructions in inline
asm will die with a SIGILL.
So, for mtmsr, mtmsrd and rfi, we have to single-step them which will
result in a SIGILL in turn.
Ananth
WARNING: multiple messages have this Message-ID (diff)
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
oleg@redhat.com, lkml <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>, Ingo Molnar <mingo@elte.hu>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] [POWERPC] uprobes: powerpc port
Date: Fri, 8 Jun 2012 14:51:04 +0530 [thread overview]
Message-ID: <20120608092104.GF13409@in.ibm.com> (raw)
In-Reply-To: <1339137497.25573.9.camel@concordia>
On Fri, Jun 08, 2012 at 04:38:17PM +1000, Michael Ellerman wrote:
> On Fri, 2012-06-08 at 11:49 +0530, Ananth N Mavinakayanahalli wrote:
> > On Fri, Jun 08, 2012 at 04:17:44PM +1000, Michael Ellerman wrote:
> > > On Fri, 2012-06-08 at 11:31 +0530, Ananth N Mavinakayanahalli wrote:
> > > > On Fri, Jun 08, 2012 at 03:51:54PM +1000, Michael Ellerman wrote:
> > > > > On Fri, 2012-06-08 at 10:06 +0530, Ananth N Mavinakayanahalli wrote:
> > > >
> > > > But MSR_PR=1 and hence emulate_step() will return -1 and hence we will
> > > > end up single-stepping using user_enable_single_step(). Same with rfid.
> > >
> > > Right. But that was exactly Jim's point, you may be asked to emulate
> > > those instructions even though you wouldn't expect to see them in
> > > userspace code, so you need to handle it.
> > >
> > > Luckily it looks like emulate_step() will do the right thing for you.
> > > It'd be good to test it to make 100% sure.
> >
> > Sure. Will add that check and send v2.
>
> Sorry I didn't mean add a test in the code, I meant construct a test
> case to confirm that it works as expected.
Michael,
I just hand-coded the instr to emulate_step() and here are the results:
MSR_PR is set
insn = 7c600124, ret = 0 /* mtmsr */
insn = 7c600164, ret = 0 /* mtmsrd */
insn = 4c000024, ret = -1 /* rfid */
insn = 4c000064, ret = 0 /* rfi */
Also verified that standalone programs with those instructions in inline
asm will die with a SIGILL.
So, for mtmsr, mtmsrd and rfi, we have to single-step them which will
result in a SIGILL in turn.
Ananth
next prev parent reply other threads:[~2012-06-08 9:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 9:19 [PATCH 1/2] uprobes: Pass probed vaddr to arch_uprobe_analyze_insn() Ananth N Mavinakayanahalli
2012-06-06 9:19 ` Ananth N Mavinakayanahalli
2012-06-06 9:21 ` [PATCH 2/2] [POWERPC] uprobes: powerpc port Ananth N Mavinakayanahalli
2012-06-06 9:21 ` Ananth N Mavinakayanahalli
2012-06-06 9:27 ` Peter Zijlstra
2012-06-06 9:27 ` Peter Zijlstra
2012-06-06 9:35 ` Ananth N Mavinakayanahalli
2012-06-06 9:35 ` Ananth N Mavinakayanahalli
2012-06-06 18:08 ` Jim Keniston
2012-06-06 18:08 ` Jim Keniston
2012-06-08 4:36 ` Ananth N Mavinakayanahalli
2012-06-08 4:36 ` Ananth N Mavinakayanahalli
2012-06-08 5:51 ` Michael Ellerman
2012-06-08 5:51 ` Michael Ellerman
2012-06-08 6:01 ` Ananth N Mavinakayanahalli
2012-06-08 6:01 ` Ananth N Mavinakayanahalli
2012-06-08 6:17 ` Michael Ellerman
2012-06-08 6:17 ` Michael Ellerman
2012-06-08 6:19 ` Ananth N Mavinakayanahalli
2012-06-08 6:19 ` Ananth N Mavinakayanahalli
2012-06-08 6:38 ` Michael Ellerman
2012-06-08 6:38 ` Michael Ellerman
2012-06-08 9:21 ` Ananth N Mavinakayanahalli [this message]
2012-06-08 9:21 ` Ananth N Mavinakayanahalli
2012-06-12 4:01 ` Michael Ellerman
2012-06-12 4:01 ` Michael Ellerman
2012-06-12 4:52 ` Ananth N Mavinakayanahalli
2012-06-12 4:52 ` Ananth N Mavinakayanahalli
2012-06-06 9:23 ` [PATCH 1/2] uprobes: Pass probed vaddr to arch_uprobe_analyze_insn() Peter Zijlstra
2012-06-06 9:23 ` Peter Zijlstra
2012-06-06 9:37 ` Ananth N Mavinakayanahalli
2012-06-06 9:37 ` Ananth N Mavinakayanahalli
2012-06-06 9:40 ` Ingo Molnar
2012-06-06 9:40 ` Ingo Molnar
2012-06-06 10:22 ` Ananth N Mavinakayanahalli
2012-06-06 10:22 ` Ananth N Mavinakayanahalli
2012-06-06 11:44 ` Srikar Dronamraju
2012-06-06 11:44 ` Srikar Dronamraju
2012-06-08 4:33 ` Ananth N Mavinakayanahalli
2012-06-08 4:33 ` Ananth N Mavinakayanahalli
2012-06-06 15:08 ` Oleg Nesterov
2012-06-06 15:08 ` Oleg Nesterov
2012-06-06 16:30 ` Srikar Dronamraju
2012-06-06 16:30 ` Srikar Dronamraju
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=20120608092104.GF13409@in.ibm.com \
--to=ananth@in.ibm.com \
--cc=anton@samba.org \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=michael@ellerman.id.au \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.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 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.