From: Frederic Weisbecker <fweisbec@gmail.com>
To: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
Benjamin Herrenschmidt <benh@au1.ibm.com>,
maneesh@linux.vnet.ibm.com, Roland McGrath <roland@redhat.com>,
Masami Hiramatsu <mhiramat@redhat.com>
Subject: Re: [Patch 02/12] Introducing generic hardware breakpoint handler interfaces
Date: Tue, 26 May 2009 12:19:18 +0200 [thread overview]
Message-ID: <20090526101914.GA5988@nowhere> (raw)
In-Reply-To: <20090526032252.GA7466@in.ibm.com>
On Tue, May 26, 2009 at 08:52:52AM +0530, K.Prasad wrote:
> On Mon, May 25, 2009 at 08:36:36PM +0200, Frederic Weisbecker wrote:
> > On Sat, May 16, 2009 at 05:55:52AM +0530, K.Prasad wrote:
> > > This patch introduces the generic Hardware Breakpoint interfaces for both user
> > > and kernel space requests.
> > >
> > > Original-patch-by: Alan Stern <stern@rowland.harvard.edu>
> > > Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> > > Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
> > > ---
> > > arch/Kconfig | 4
> > > kernel/Makefile | 1
> > > kernel/hw_breakpoint.c | 369 +++++++++++++++++++++++++++++++++++++++++++++++++
> > > 3 files changed, 374 insertions(+)
> > >
> > > +/**
> > > + * register_kernel_hw_breakpoint - register a hardware breakpoint for kernel space
> > > + * @bp: the breakpoint structure to register
> > > + *
> > > + * @bp.info->name or @bp.info->address, @bp.info->len, @bp.info->type and
> > > + * @bp->triggered must be set properly before invocation
> > > + *
> > > + */
> > > +int register_kernel_hw_breakpoint(struct hw_breakpoint *bp)
> > > +{
> > > + int rc;
> > > +
> > > + rc = arch_validate_hwbkpt_settings(bp, NULL);
> > > + if (rc)
> > > + return rc;
> > > +
> > > + spin_lock_bh(&hw_breakpoint_lock);
> > > +
> > > + rc = -EINVAL;
> > > + /* Check if we are over-committing */
> > > + if ((hbp_kernel_pos > 0) && (!hbp_user_refcount[hbp_kernel_pos-1])) {
> >
> >
> >
> > If hbp_kernel_pos == 0, shouldn't it return -ENOSPC ?
> > If several kernel users try to register a breakpoint, and there is no
> > more room for one of them, then we know it has failed not because
> > of an error in the breakpoint instance but because of a lack of
> > resources.
> >
> > Frederic.
> >
>
> Agreed. It's done correctly in the case of register_user_hw_breakpoint()
> but not here. Here's a tiny patch that corrects it.
Thanks. I will apply this one too.
Frederic.
>
>
> Modify the return code in register_kernel_hw_breakpoint()
>
> Modify the return code in register_kernel_hw_breakpoint() to return -ENOSPC
> if we are error-returning due to lack of free HW breakpoint registers.
>
> Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
> ---
> kernel/hw_breakpoint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6-tip.hbkpt/kernel/hw_breakpoint.c
> ===================================================================
> --- linux-2.6-tip.hbkpt.orig/kernel/hw_breakpoint.c
> +++ linux-2.6-tip.hbkpt/kernel/hw_breakpoint.c
> @@ -312,7 +312,7 @@ int register_kernel_hw_breakpoint(struct
>
> spin_lock_bh(&hw_breakpoint_lock);
>
> - rc = -EINVAL;
> + rc = -ENOSPC;
> /* Check if we are over-committing */
> if ((hbp_kernel_pos > 0) && (!hbp_user_refcount[hbp_kernel_pos-1])) {
> hbp_kernel_pos--;
next prev parent reply other threads:[~2009-05-26 10:19 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090515105133.629980476@prasadkr_t60p.in.ibm.com>
2009-05-15 10:55 ` [Patch 01/12] Prepare the code for Hardware Breakpoint interfaces K.Prasad
2009-05-15 10:56 ` [Patch 02/12] Introducing generic hardware breakpoint handler interfaces K.Prasad
2009-05-15 10:56 ` [Patch 03/12] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2009-05-15 10:57 ` [Patch 04/12] Modifying generic debug exception to use thread-specific debug registers K.Prasad
2009-05-15 10:57 ` [Patch 05/12] Use wrapper routines around debug registers in processor related functions K.Prasad
2009-05-15 10:58 ` [Patch 06/12] Use the new wrapper routines to access debug registers in process/thread code K.Prasad
2009-05-15 10:58 ` [Patch 07/12] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2009-05-15 10:59 ` [Patch 08/12] Modify Ptrace routines to access breakpoint registers K.Prasad
2009-05-15 10:59 ` [Patch 09/12] Cleanup HW Breakpoint registers before kexec K.Prasad
2009-05-15 10:59 ` [Patch 10/12] Sample HW breakpoint over kernel data address K.Prasad
2009-05-15 11:00 ` [Patch 11/12] ftrace plugin for kernel symbol tracing using HW Breakpoint interfaces - v5 K.Prasad
2009-05-15 11:00 ` [Patch 12/12] Reset bits in dr6 after the corresponding exception is handled K.Prasad
2009-05-16 0:24 ` [Patch 01/12] Prepare the code for Hardware Breakpoint interfaces K.Prasad
2009-05-16 0:25 ` [Patch 02/12] Introducing generic hardware breakpoint handler interfaces K.Prasad
2009-05-25 18:36 ` Frederic Weisbecker
2009-05-26 3:22 ` K.Prasad
2009-05-26 10:19 ` Frederic Weisbecker [this message]
2009-05-16 0:27 ` [Patch 03/12] x86 architecture implementation of Hardware Breakpoint interfaces K.Prasad
2009-05-16 0:28 ` [Patch 04/12] Modifying generic debug exception to use thread-specific debug registers K.Prasad
2009-05-16 0:28 ` [Patch 05/12] Use wrapper routines around debug registers in processor related functions K.Prasad
2009-05-16 0:29 ` [Patch 06/12] Use the new wrapper routines to access debug registers in process/thread code K.Prasad
2009-05-16 0:29 ` [Patch 07/12] Modify signal handling code to refrain from re-enabling HW Breakpoints K.Prasad
2009-05-16 0:30 ` [Patch 08/12] Modify Ptrace routines to access breakpoint registers K.Prasad
2009-05-16 0:30 ` [Patch 09/12] Cleanup HW Breakpoint registers before kexec K.Prasad
2009-05-16 0:30 ` [Patch 10/12] Sample HW breakpoint over kernel data address K.Prasad
2009-05-16 0:31 ` [Patch 11/12] ftrace plugin for kernel symbol tracing using HW Breakpoint interfaces - v5 K.Prasad
2009-05-16 0:31 ` [Patch 12/12] Reset bits in dr6 after the corresponding exception is handled K.Prasad
[not found] <20090601180605.799735829@prasadkr_t60p.in.ibm.com>
2009-06-01 18:13 ` [Patch 02/12] Introducing generic hardware breakpoint handler interfaces K.Prasad
[not found] <20090530103857.715014561@prasadkr_t60p.in.ibm.com>
2009-05-30 10:49 ` K.Prasad
[not found] <20090521095613.834622717@prasadkr_t60p.in.ibm.com>
2009-05-21 14:01 ` K.Prasad
[not found] <20090513160546.592373797@prasadkr_t60p.in.ibm.com>
2009-05-13 16:13 ` K.Prasad
[not found] <20090511114422.133566343@prasadkr_t60p.in.ibm.com>
2009-05-11 11:52 ` K.Prasad
2009-05-11 12:12 ` Bharata B Rao
2009-05-11 12:16 ` K.Prasad
2009-05-28 6:15 ` David Gibson
2009-05-28 11:55 ` K.Prasad
2009-05-29 2:59 ` David Gibson
[not found] <20090424055710.764502564@prasadkr_t60p.in.ibm.com>
2009-04-24 6:15 ` 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=20090526101914.GA5988@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=benh@au1.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@linux.vnet.ibm.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=prasad@linux.vnet.ibm.com \
--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