From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Michael Neuling <mikey@neuling.org>,
Benjamin Herrenschmidt <benh@au1.ibm.com>,
shaggy@linux.vnet.ibm.com,
Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>,
Will Deacon <will.deacon@arm.com>, David Gibson <dwg@au1.ibm.com>,
linuxppc-dev@ozlabs.org, Alan Stern <stern@rowland.harvard.edu>,
paulus@samba.org, Roland McGrath <roland@redhat.com>
Subject: Re: [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64
Date: Tue, 9 Mar 2010 07:44:00 +0530 [thread overview]
Message-ID: <20100309021400.GA3576@in.ibm.com> (raw)
In-Reply-To: <20100226015807.GF5592@nowhere>
On Fri, Feb 26, 2010 at 02:58:12AM +0100, Frederic Weisbecker wrote:
> On Mon, Feb 22, 2010 at 06:47:46PM +0530, K.Prasad wrote:
> > The 'name' field here is actually a legacy inherited from x86 code. It
> > is part of x86's arch-specific hw-breakpoint structure since:
> > - inspired by the kprobe implementation which accepts symbol name as
> > input.
> > - kallsyms_lookup_name() was 'unexported' and a module could not resolve
> > symbol names externally, so the core-infrastructure had to provide
> > such facilities.
> > - I wasn't sure about the discussions behind 'unexporting' of
> > kallsyms_lookup_name(), so did not venture to export them again (which
> > you rightfully did :-)
> >
> > Having said that, I'll be glad to remove this field (along with that in
> > x86),
>
> Cool, I'll integrate the x86 name field removal to the .24 series
>
I've removed the .name field in the latest version of the patch sent
(linuxppc-dev message-id: 20100308181232.GA3406@in.ibm.com).
> > > > +void ptrace_triggered(struct perf_event *bp, int nmi,
> > > > + struct perf_sample_data *data, struct pt_regs *regs)
> > > > +{
> > > > + struct perf_event_attr attr;
> > > > +
> > > > + /*
> > > > + * Disable the breakpoint request here since ptrace has defined a
> > > > + * one-shot behaviour for breakpoint exceptions in PPC64.
> > > > + * The SIGTRAP signal is generated automatically for us in do_dabr().
> > > > + * We don't have to do anything about that here
> > > > + */
> > >
> > >
> > > Oh, why does ptrace use a one-shot behaviour in ppc? Breakpoints
> > > only trigger once?
> > >
> >
> > Yes, ptrace breakpoints on PPC64 are designed to trigger once and this
> > patch retains that behaviour. It is very convenient to use one-shot
> > behaviour on archs where exceptions are triggered-before-execute.
>
> Ah, Why?
>
Because we don't have to create the single_step_dabr_instruction()
function :-)
With one-shot behaviour, the hw_breakpoint_handler() doesn't have to
worry about entering into an infinite-loop (since exceptions are
triggered before instruction execution, and if breakpoints are still
active every attempt to execute the causative instruction raises the
breakpoint exception). To circumvent infinite looping, we temporarily
disable the breakpoints, enable single-stepping (to single-step over
the causative instruction) and re-enable them inside single-step
exception handler. For the one-shot type breakpoint, the pain of
re-registration is left to the end-user.
I've wondered why PowerPC was designed to be 'trigger-before-execute'
when handling the exception can grow complex as this. Perhaps it is
meant to give absolute control over the data value (stored in the target
address) before the instruction gets to see it. For instance,
breakpoints can be used to change the data to a 'desirable' value before
actually being 'seen' by instructions.
Thanks,
K.Prasad
next prev parent reply other threads:[~2010-03-09 2:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 5:56 [Patch 0/1] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver XIII K.Prasad
2010-02-15 5:59 ` [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64 K.Prasad
2010-02-21 1:01 ` Frederic Weisbecker
2010-02-22 13:17 ` K.Prasad
2010-02-23 10:57 ` K.Prasad
2010-02-26 17:52 ` Frederic Weisbecker
2010-02-26 1:58 ` Frederic Weisbecker
2010-03-08 23:57 ` David Gibson
2010-03-09 2:14 ` K.Prasad [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-03-08 18:12 [Patch 0/1] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver XIV K.Prasad
2010-03-08 18:14 ` [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64 K.Prasad
2010-03-12 6:19 ` Benjamin Herrenschmidt
2010-03-15 6:29 ` K.Prasad
2010-04-07 8:03 ` Benjamin Herrenschmidt
2010-04-14 3:53 ` K.Prasad
2010-03-23 5:33 ` Paul Mackerras
2010-03-23 7:28 ` K.Prasad
2010-01-21 8:46 [Patch 0/1] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver XII K.Prasad
2010-01-21 8:49 ` [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64 K.Prasad
2010-01-19 9:12 [Patch 0/1] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver XI K.Prasad
2010-01-19 9:14 ` [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64 K.Prasad
2009-12-11 16:04 K.Prasad
2009-12-14 0:56 ` Roland McGrath
2009-12-14 18:03 ` K.Prasad
2009-12-14 19:26 ` Roland McGrath
2009-12-17 19:03 ` K.Prasad
2010-01-19 9:40 ` K.Prasad
2010-01-19 10:03 ` Roland McGrath
2010-01-22 7:14 ` K.Prasad
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=20100309021400.GA3576@in.ibm.com \
--to=prasad@linux.vnet.ibm.com \
--cc=benh@au1.ibm.com \
--cc=dwg@au1.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=mikey@neuling.org \
--cc=paulus@samba.org \
--cc=roland@redhat.com \
--cc=shaggy@linux.vnet.ibm.com \
--cc=stern@rowland.harvard.edu \
--cc=will.deacon@arm.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).