This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC PATCH 3/6] kprobes: remove global kprobe_lock - ia64 changes


IA64 specific changes. Compile tested only.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

 arch/ia64/kernel/kprobes.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

Index: linux-2.6.13-rc3/arch/ia64/kernel/kprobes.c
===================================================================
--- linux-2.6.13-rc3.orig/arch/ia64/kernel/kprobes.c	2005-07-29 13:05:16.000000000 -0400
+++ linux-2.6.13-rc3/arch/ia64/kernel/kprobes.c	2005-07-29 13:06:03.000000000 -0400
@@ -26,7 +26,6 @@
 #include <linux/config.h>
 #include <linux/kprobes.h>
 #include <linux/ptrace.h>
-#include <linux/spinlock.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/preempt.h>
@@ -352,6 +351,7 @@ int __kprobes trampoline_probe_handler(s
 	unsigned long trampoline_address =
 		((struct fnptr *)kretprobe_trampoline)->ip;
 
+	spin_lock(&kretprobe_lock);
         head = kretprobe_inst_table_head(current);
 
 	/*
@@ -390,7 +390,8 @@ int __kprobes trampoline_probe_handler(s
 	BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address));
 	regs->cr_iip = orig_ret_address;
 
-	unlock_kprobes();
+	spin_unlock(&kretprobe_lock);
+	read_unlock(&kprobe_lock);
 
         /*
          * By returning a non-zero value, we are telling
@@ -400,6 +401,7 @@ int __kprobes trampoline_probe_handler(s
         return 1;
 }
 
+/* Called with kretprobe_lock held */
 void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
 				      struct pt_regs *regs)
 {
@@ -610,7 +612,7 @@ static int __kprobes pre_kprobes_handler
 		p = get_kprobe(addr);
 		if (p) {
 			if (kcb->kprobe_status == KPROBE_HIT_SS) {
-				unlock_kprobes();
+				read_unlock(&kprobe_lock);
 				goto no_kprobe;
 			}
 			/* We have reentered the pre_kprobe_handler(), since
@@ -639,10 +641,10 @@ static int __kprobes pre_kprobes_handler
 		}
 	}
 
-	lock_kprobes();
+	read_lock(&kprobe_lock);
 	p = get_kprobe(addr);
 	if (!p) {
-		unlock_kprobes();
+		read_unlock(&kprobe_lock);
 		if (!is_ia64_break_inst(regs)) {
 			/*
 			 * The breakpoint instruction was removed right
@@ -706,7 +708,7 @@ static int __kprobes post_kprobes_handle
 		goto out;
 	}
 	reset_current_kprobe();
-	unlock_kprobes();
+	read_unlock(&kprobe_lock);
 
 out:
 	preempt_enable_no_resched();
@@ -727,7 +729,7 @@ static int __kprobes kprobes_fault_handl
 	if (kcb->kprobe_status & KPROBE_HIT_SS) {
 		resume_execution(cur, regs);
 		reset_current_kprobe();
-		unlock_kprobes();
+		read_unlock(&kprobe_lock);
 		preempt_enable_no_resched();
 	}
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]