From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>,
akpm@linux-foundation.org, mingo@elte.hu,
jason.wessel@windriver.com, avi@qumranet.com,
richardj_moore@uk.ibm.com
Subject: Re: [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces
Date: Tue, 7 Oct 2008 22:53:01 +0530 [thread overview]
Message-ID: <20081007172301.GC4130@in.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0810071122460.2591-100000@iolanthe.rowland.org>
On Tue, Oct 07, 2008 at 11:36:30AM -0400, Alan Stern wrote:
> On Tue, 7 Oct 2008, K.Prasad wrote:
>
> > This patch introduces two new files named hw_breakpoint.[ch] inside x86 specific
> > directories. They contain functions which help validate and serve requests for
> > using Hardware Breakpoint registers on x86 processors.
>
> > --- /dev/null
> > +++ linux-bkpt-lkml-27-rc9/arch/x86/kernel/hw_breakpoint.c
> > @@ -0,0 +1,684 @@
>
> ...
> > +int pre_handler_allowed(unsigned type)
> > +{
> > + if (type == HW_BREAKPOINT_EXECUTE)
> > + return 1;
> > + else
> > + return -EINVAL;
> > +}
>
> The routine's name should match the name in the header file. "allowed"
> isn't right: You're _allowed_ to have pre_handlers -- they just won't
> get invoked. "supported" would be better.
pre_handler_supported() definitely sounds better. I will change them.
>
> Also, the comment in the header file should explain the meaning of the
> return value -- you should return 0 if a pre_handler is not supported,
> not -EINVAL. Better yet, define the function (both here and in the
> header file) as returning bool rather than int.
>
I will change them to boolean.
> > +
> > +int post_handler_allowed(unsigned type)
> > +{
> > + /* We can have a post handler for all types of breakpoints */
> > + return 1;
> > +}
>
> Same comments as above.
>
> Also, in this initial version I would prefer to avoid the complications
> of single-stepping. It can always be added later. So for now, the x86
> implementation should not support post_handlers for execution
> breakpoints.
>
There's been a perceivable inclination to let the user learn the
limitations/features of the underlying processor's breakpointing ability
(since the previous email mail thread on this topic) and the routines
pre_ and post_handler_allowed() are just a step towards that.
I can nullify the post_handler for x86-instruction breakpoint for now,
but it wouldn't simplify things very extensively (but for a few lines of
code in hw_breakpoint_handler() and the flag 'sstep_reason'). It also
benefits the code by bringing an understanding that there can be
multiple users of processor single-stepping (and therefore the need to
de-multiplex the exception and invoke the appropriate handler).
Left to me, I would like to retain the post_handler routine, unless you
strongly feel otherwise.
> ...
> > +/*
> > + * Validate the arch-specific HW Breakpoint register settings
> > + */
> > +static int arch_validate_hwbkpt_settings(struct hw_breakpoint *bp,
> > + unsigned long address, unsigned len, unsigned int type,
> > + unsigned int *align)
>
> Why did you move this routine into the arch-specific code?
>
> ...
> > +/*
> > + * Handle debug exception notifications.
> > + */
> > +
> > +static void switch_to_none_hw_breakpoint(void);
> > +struct hw_breakpoint *last_hit_bp;
> > +struct thread_hw_breakpoint *last_hit_thbi;
>
> Shouldn't these variables be static? Although if they're needed only for
> single-stepping, they can be removed entirely for now...
>
Agreed. Will make them static.
Thanks,
K.Prasad
next prev parent reply other threads:[~2008-10-07 17:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 11:38 [RFC Patch 0/9] Hardware Breakpoint interfaces K.Prasad
2008-10-07 11:40 ` [RFC Patch 1/9] Introducing generic hardware breakpoint handler interfaces K.Prasad
2008-10-07 15:21 ` Alan Stern
2008-10-07 16:49 ` K.Prasad
2008-10-07 11:41 ` [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2008-10-07 15:36 ` Alan Stern
2008-10-07 17:23 ` K.Prasad [this message]
2008-10-07 17:38 ` Alan Stern
2008-10-07 17:28 ` K.Prasad
2008-10-07 11:42 ` [RFC Patch 3/9] Modifying generic debug exception to use virtual debug registers K.Prasad
2008-10-07 11:43 ` [RFC Patch 4/9] Modify kprobe exception handler to recognise single-stepping by HW Breakpoint handler K.Prasad
2008-10-07 11:44 ` [RFC Patch 5/9] Use wrapper routines around debug registers in processor related functions K.Prasad
2008-10-07 11:44 ` [RFC Patch 6/9] Use virtual debug registers in process/thread handling code K.Prasad
2008-10-07 15:40 ` Alan Stern
2008-10-07 17:48 ` K.Prasad
2008-10-07 11:45 ` [RFC Patch 7/9] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2008-10-07 11:46 ` [RFC Patch 8/9] Modify Ptrace to use wrapper routines to access breakpoint registers K.Prasad
2008-10-07 11:46 ` [RFC Patch 9/9] Cleanup HW Breakpoint registers before kexec K.Prasad
2008-10-07 12:29 ` [RFC Patch 0/9] Hardware Breakpoint interfaces Avi Kivity
2008-10-07 14:32 ` K.Prasad
2008-10-07 14:36 ` Avi Kivity
2008-10-07 16:45 ` K.Prasad
2008-10-07 16:52 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2008-10-08 19:20 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-10-08 19:23 ` [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2008-10-16 2:57 ` Roland McGrath
2008-12-04 19:08 [RFC Patch 0/9] Hardware Breakpoint interfaces - v2 K.Prasad
2008-12-04 19:11 ` [RFC Patch 2/9] x86 architecture implementation of Hardware Breakpoint interfaces 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=20081007172301.GC4130@in.ibm.com \
--to=prasad@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=avi@qumranet.com \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=richardj_moore@uk.ibm.com \
--cc=roland@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).