From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Benjamin Herrenschmidt <benh@au1.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
maneesh@linux.vnet.ibm.com, Roland McGrath <roland@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [Patch 00/11] Hardware Breakpoint interfaces
Date: Tue, 7 Apr 2009 13:52:53 +0530 [thread overview]
Message-ID: <20090407082253.GB22500@in.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0904011216460.3736-100000@iolanthe.rowland.org>
On Wed, Apr 01, 2009 at 12:22:08PM -0400, Alan Stern wrote:
> On Sat, 28 Mar 2009, K.Prasad wrote:
>
> > On Wed, Mar 25, 2009 at 03:48:31PM -0400, Alan Stern wrote:
> > > > +
> > > > +/*
> > > > + * Handle debug exception notifications.
> > > > + */
> > > > +int __kprobes hw_breakpoint_handler(struct die_args *args)
> > > > +{
> > > > + int i, rc = NOTIFY_DONE;
> > > > + struct hw_breakpoint *bp;
> > > > + /* The DR6 value is stored in args->err */
> > > > + unsigned long dr7, dr6 = args->err;
> > >
> > > Please change this. (I should have changed it long ago, but I never
> > > got around to it.) Instead of passing the DR6 value in args->err,
> > > pass a pointer to the dr6 variable in do_debug(). That way the
> > > handler routines can turn off bits in that variable and do_debug() can
> > > see which bits remain set at the end.
> > >
> > > Of course, this will require a corresponding change to the
> > > post_kprobe_handler() routine.
> > >
> >
> > As I looked at the code with an intention of changing it, I don't find a
> > place - in hw_breakpoint_handler() and in functions called by
> > kprobe_exceptions_notify() where bits in dr6 are written into.
>
> That's because such writes wouldn't do any good in the old code! :-)
>
> > The thread-specific thread->debugreg6 is updated with causative bits in
> > ptrace_triggered() to help send signals to the user-space. I don't see a
> > user for the change you propose.
>
> For each breakpoint where we decide it's a case of lazy DR switching or
> we invoke a "triggered" callback, the corresponding bit in dr6 should
> be cleared. This is a way of indicating to do_debug() that the handler
> has taken care of these causes of the exception.
>
> Similarly, the kprobe routine should clear the single-step bit in dr6
> when it handles a single-step exception. When the notifier chain
> completes, the only bits remaining in dr6 should be for events that
> still need to be handled.
>
> Alan Stern
>
This does sound like good design, but unfortunately there are pieces in
do_debug() which rely upon bits in dr6 being set even after the actual
breakpoint is handled (the get_si_code() is one such example).
Do we go about changing them to use thread->debugreg6 instead of dr6? If
yes, wouldn't that be better done outside the HW Breakpoint patches as a
part of some cleanup initiative?
Thanks,
K.Prasad
next prev parent reply other threads:[~2009-04-07 8:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 15:24 K.Prasad
2009-03-25 19:48 ` Alan Stern
2009-03-27 22:06 ` K.Prasad
2009-04-01 16:16 ` Alan Stern
2009-04-07 8:22 ` K.Prasad
2009-04-09 20:50 ` Alan Stern
2009-03-28 8:46 ` K.Prasad
2009-04-01 16:22 ` Alan Stern
2009-04-07 8:22 ` K.Prasad [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-04-07 6:34 K.Prasad
2009-04-16 21:19 ` Alan Stern
2009-04-17 3:12 ` K.Prasad
2009-04-17 14:37 ` Alan Stern
2009-04-24 5:56 ` K.Prasad
2009-04-24 14:16 ` Alan Stern
2009-04-24 15:57 ` K.Prasad
2009-04-24 16:16 ` Alan Stern
2009-03-07 5:04 [Patch 00/11] Hardware Breakpoint Interfaces prasad
2009-03-05 4:37 [patch 00/11] Hardware Breakpoint interfaces prasad
2009-03-10 13:46 ` Ingo Molnar
2009-03-11 12:11 ` K.Prasad
2009-03-11 16:34 ` Alan Stern
2009-03-11 17:25 ` K.Prasad
2009-03-11 17:30 ` Ingo Molnar
2009-03-10 13:51 ` Ingo Molnar
2009-03-10 14:24 ` Alan Stern
2009-03-10 14:54 ` Ingo Molnar
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=20090407082253.GB22500@in.ibm.com \
--to=prasad@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=benh@au1.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@linux.vnet.ibm.com \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=rostedt@goodmis.org \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®