public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails.
       [not found] <20100121125113.152043766@mars.in.ibm.com>
@ 2010-01-21 12:55 ` Mahesh Salgaonkar
  2010-01-21 13:12   ` Frederic Weisbecker
  2010-01-29  9:24   ` [tip:perf/core] hw_breakpoints: " tip-bot for Mahesh Salgaonkar
  0 siblings, 2 replies; 3+ messages in thread
From: Mahesh Salgaonkar @ 2010-01-21 12:55 UTC (permalink / raw)
  To: linux-kernel, fweisbec
  Cc: Ingo Molnar, Ananth N Mavinakayanahalli, prasad,
	Mahesh Salgaonkar, maneesh

[-- Attachment #1: hwbkpt_common_code_fix.patch --]
[-- Type: text/plain, Size: 1060 bytes --]


On a given architecture, when hardware breakpoint registration fails due
to un-supported access type (read/write/execute), we loose the bp slot since
register_perf_hw_breakpoint() does not release the bp slot on failure.
Hence, any subsequent hardware breakpoint registration starts failing
with 'no space left on device' error.

This patch introduces error handling in register_perf_hw_breakpoint()
function and releases bp slot on error.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
---

 kernel/hw_breakpoint.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 50dbd59..c030ae6 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -296,6 +296,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp)
 	if (!bp->attr.disabled || !bp->overflow_handler)
 		ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
+	/* if arch_validate_hwbkpt_settings() fails then release bp slot */
+	if (ret)
+		release_bp_slot(bp);
+
 	return ret;
 }
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails.
  2010-01-21 12:55 ` [patch] HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails Mahesh Salgaonkar
@ 2010-01-21 13:12   ` Frederic Weisbecker
  2010-01-29  9:24   ` [tip:perf/core] hw_breakpoints: " tip-bot for Mahesh Salgaonkar
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-01-21 13:12 UTC (permalink / raw)
  To: Mahesh Salgaonkar
  Cc: linux-kernel, Ingo Molnar, Ananth N Mavinakayanahalli, prasad,
	maneesh

On Thu, Jan 21, 2010 at 06:25:16PM +0530, Mahesh Salgaonkar wrote:
> 
> On a given architecture, when hardware breakpoint registration fails due
> to un-supported access type (read/write/execute), we loose the bp slot since
> register_perf_hw_breakpoint() does not release the bp slot on failure.
> Hence, any subsequent hardware breakpoint registration starts failing
> with 'no space left on device' error.
> 
> This patch introduces error handling in register_perf_hw_breakpoint()
> function and releases bp slot on error.
> 
> Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>


Thanks. I'm queuing it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/core] hw_breakpoints: Release the bp slot if arch_validate_hwbkpt_settings() fails.
  2010-01-21 12:55 ` [patch] HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails Mahesh Salgaonkar
  2010-01-21 13:12   ` Frederic Weisbecker
@ 2010-01-29  9:24   ` tip-bot for Mahesh Salgaonkar
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Mahesh Salgaonkar @ 2010-01-29  9:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, maneesh, hpa, mingo, mahesh, ananth, fweisbec, tglx,
	prasad

Commit-ID:  b23ff0e9330e4b11e18af984d50573598e10e7f9
Gitweb:     http://git.kernel.org/tip/b23ff0e9330e4b11e18af984d50573598e10e7f9
Author:     Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
AuthorDate: Thu, 21 Jan 2010 18:25:16 +0530
Committer:  Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Thu, 28 Jan 2010 14:15:51 +0100

hw_breakpoints: Release the bp slot if arch_validate_hwbkpt_settings() fails.

On a given architecture, when hardware breakpoint registration fails
due to un-supported access type (read/write/execute), we lose the bp
slot since register_perf_hw_breakpoint() does not release the bp slot
on failure.
Hence, any subsequent hardware breakpoint registration starts failing
with 'no space left on device' error.

This patch introduces error handling in register_perf_hw_breakpoint()
function and releases bp slot on error.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: K. Prasad <prasad@linux.vnet.ibm.com>
Cc: Maneesh Soni <maneesh@in.ibm.com>
LKML-Reference: <20100121125516.GA32521@in.ibm.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/hw_breakpoint.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 50dbd59..c030ae6 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -296,6 +296,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp)
 	if (!bp->attr.disabled || !bp->overflow_handler)
 		ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
+	/* if arch_validate_hwbkpt_settings() fails then release bp slot */
+	if (ret)
+		release_bp_slot(bp);
+
 	return ret;
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-29  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100121125113.152043766@mars.in.ibm.com>
2010-01-21 12:55 ` [patch] HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails Mahesh Salgaonkar
2010-01-21 13:12   ` Frederic Weisbecker
2010-01-29  9:24   ` [tip:perf/core] hw_breakpoints: " tip-bot for Mahesh Salgaonkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox