[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    x86,kgdb: Fix hw breakpoint regression
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2010-07-29 3:59:10
Message-ID: 201007290359.o6T3xAAL020983 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/ba773f7c510c0b252145933926c636c439889207
Commit:     ba773f7c510c0b252145933926c636c439889207
Parent:     fc0f5ac8fe693d1b05f5a928cc48135d1c8b7f2e
Author:     Jason Wessel <jason.wessel@windriver.com>
AuthorDate: Wed Jul 28 19:10:30 2010 -0500
Committer:  Jason Wessel <jason.wessel@windriver.com>
CommitDate: Wed Jul 28 19:10:30 2010 -0500

    x86,kgdb: Fix hw breakpoint regression
    
    HW breakpoints events stopped working correctly with kgdb
    as a result of commit: 018cbffe6819f6f8db20a0a3acd9bab9bfd667e4
    (Merge commit 'v2.6.33' into perf/core).
    
    The regression occurred because the behavior changed for setting
    NOTIFY_STOP as the return value to the die notifier if the breakpoint
    was known to the HW breakpoint API.  Because kgdb is using the HW
    breakpoint API to register HW breakpoints slots, it must also now
    implement the overflow_handler call back else kgdb does not get to see
    the events from the die notifier.
    
    The kgdb_ll_trap function will be changed to be general purpose code
    which can allow an easy way to implement the hw_breakpoint API
    overflow call back.
    
    Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
    Acked-by: Dongdong Deng <dongdong.deng@windriver.com>
    Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 arch/x86/kernel/kgdb.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 4f4af75..01ab17a 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -572,7 +572,6 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
 	return NOTIFY_STOP;
 }
 
-#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
 int kgdb_ll_trap(int cmd, const char *str,
 		 struct pt_regs *regs, long err, int trap, int sig)
 {
@@ -590,7 +589,6 @@ int kgdb_ll_trap(int cmd, const char *str,
 
 	return __kgdb_notify(&args, cmd);
 }
-#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
 
 static int
 kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
@@ -625,6 +623,12 @@ int kgdb_arch_init(void)
 	return register_die_notifier(&kgdb_notifier);
 }
 
+static void kgdb_hw_overflow_handler(struct perf_event *event, int nmi,
+		struct perf_sample_data *data, struct pt_regs *regs)
+{
+	kgdb_ll_trap(DIE_DEBUG, "debug", regs, 0, 0, SIGTRAP);
+}
+
 void kgdb_arch_late(void)
 {
 	int i, cpu;
@@ -655,6 +659,7 @@ void kgdb_arch_late(void)
 		for_each_online_cpu(cpu) {
 			pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
 			pevent[0]->hw.sample_period = 1;
+			pevent[0]->overflow_handler = kgdb_hw_overflow_handler;
 			if (pevent[0]->destroy != NULL) {
 				pevent[0]->destroy = NULL;
 				release_bp_slot(*pevent);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic