From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@elte.hu>, Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Alan Stern <stern@rowland.harvard.edu>,
Andrew Morton <akpm@linux-foundation.org>,
"K.Prasad" <prasad@linux.vnet.ibm.com>
Subject: [RFC Patch 3/4] Bugfix HW-BKPT: Fix traceback seen when resuming after suspend-to-ram
Date: Tue, 27 Oct 2009 02:49:55 +0530 [thread overview]
Message-ID: <20091026211955.GD15529@in.ibm.com> (raw)
In-Reply-To: 20091026211225.214925175@xyz
[-- Attachment #1: s2r_patch.txt --]
[-- Type: text/plain, Size: 2062 bytes --]
Load the debug registers (when a CPU turns online) through a tasklet. This
helps to keep routines (using protected hw-breakpoint data) to be invoked
only from non-interrupt context, thus making the spin_lock_bh() locking
sufficient.
Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
---
kernel/hw_breakpoint.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
Index: linux-2.6-tip.perf_hbkpt/kernel/hw_breakpoint.c
===================================================================
--- linux-2.6-tip.perf_hbkpt.orig/kernel/hw_breakpoint.c
+++ linux-2.6-tip.perf_hbkpt/kernel/hw_breakpoint.c
@@ -23,6 +23,7 @@
* This file contains the arch-independent routines.
*/
+#include <linux/interrupt.h>
#include <linux/irqflags.h>
#include <linux/kallsyms.h>
#include <linux/notifier.h>
@@ -69,20 +70,19 @@ unsigned int hbp_user_refcount[HBP_NUM];
static DEFINE_PER_CPU(int, hbp_consumed);
/*
- * Load the debug registers during startup of a CPU.
+ * A tasklet to populate the debug register's values from the
+ * breakpoint structure
*/
-void load_debug_registers(void)
+static struct tasklet_struct hbp_tasklet;
+
+/* Tasklet function that populates the debug registers */
+void hbp_tasklet_function(unsigned long unused)
{
- unsigned long flags;
struct task_struct *tsk = current;
spin_lock_bh(&hw_breakpoint_lock);
- /* Prevent IPIs for new kernel breakpoint updates */
- local_irq_save(flags);
arch_update_kernel_hw_breakpoint(NULL);
- local_irq_restore(flags);
-
if (test_tsk_thread_flag(tsk, TIF_DEBUG))
arch_install_thread_hw_breakpoint(tsk);
@@ -90,6 +90,18 @@ void load_debug_registers(void)
}
/*
+ * Load the debug registers during startup of a CPU.
+ */
+void load_debug_registers(void)
+{
+ unsigned long flags;
+
+ if (!hbp_tasklet.func)
+ tasklet_init(&hbp_tasklet, &hbp_tasklet_function, 0UL);
+ tasklet_schedule(&hbp_tasklet);
+}
+
+/*
* Erase all the hardware breakpoint info associated with a thread.
*
* If tsk != current then tsk must not be usable (for example, a
next prev parent reply other threads:[~2009-10-26 21:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20091026211225.214925175@xyz>
2009-10-26 21:17 ` [RFC Patch 1/4] Allow kernel-space hw-breakpoints to be restricted only for a subset of CPUs using a cpumask field in struct hw_breakpoint K.Prasad
2009-10-26 21:19 ` [RFC Patch 2/4] Allow breakpoints to be enabled/disabled without yielding the breakpoint request through new APIs - <enable><disable>_hw_breakpoint() K.Prasad
2009-10-28 20:31 ` Steven Rostedt
2009-10-29 21:34 ` K.Prasad
2009-10-26 21:19 ` K.Prasad [this message]
2009-10-26 21:20 ` [RFC Patch 4/4] Enable perf-events to use hw-breakpoints 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=20091026211955.GD15529@in.ibm.com \
--to=prasad@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.