This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
[RFC PATCH 4/6] kprobes: remove global kprobe_lock - ppc64 changes
Changes for ppc64 kprobes
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
arch/ppc64/kernel/kprobes.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Index: linux-2.6.13-rc3/arch/ppc64/kernel/kprobes.c
===================================================================
--- linux-2.6.13-rc3.orig/arch/ppc64/kernel/kprobes.c 2005-07-29 13:00:59.000000000 -0400
+++ linux-2.6.13-rc3/arch/ppc64/kernel/kprobes.c 2005-07-29 13:01:58.000000000 -0400
@@ -30,7 +30,6 @@
#include <linux/config.h>
#include <linux/kprobes.h>
#include <linux/ptrace.h>
-#include <linux/spinlock.h>
#include <linux/preempt.h>
#include <asm/cacheflush.h>
#include <asm/kdebug.h>
@@ -141,6 +140,7 @@ static inline void set_current_kprobe(st
kcb->kprobe_saved_msr = regs->msr;
}
+/* Called with kretprobe_lock held */
void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
struct pt_regs *regs)
{
@@ -175,7 +175,7 @@ static inline int kprobe_handler(struct
if (kcb->kprobe_status == KPROBE_HIT_SS) {
regs->msr &= ~MSR_SE;
regs->msr |= kcb->kprobe_saved_msr;
- unlock_kprobes();
+ read_unlock(&kprobe_lock);
goto no_kprobe;
}
/* We have reentered the kprobe_handler(), since
@@ -201,10 +201,10 @@ static inline int kprobe_handler(struct
goto no_kprobe;
}
- lock_kprobes();
+ read_lock(&kprobe_lock);
p = get_kprobe(addr);
if (!p) {
- unlock_kprobes();
+ read_unlock(&kprobe_lock);
if (*addr != BREAKPOINT_INSTRUCTION) {
/*
* PowerPC has multiple variants of the "trap"
@@ -272,6 +272,7 @@ int __kprobes trampoline_probe_handler(s
unsigned long orig_ret_address = 0;
unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
+ spin_lock(&kretprobe_lock);
head = kretprobe_inst_table_head(current);
/*
@@ -310,7 +311,8 @@ int __kprobes trampoline_probe_handler(s
BUG_ON(!orig_ret_address || (orig_ret_address == trampoline_address));
regs->nip = orig_ret_address;
- unlock_kprobes();
+ spin_unlock(&kretprobe_lock);
+ read_unlock(&kprobe_lock);
/*
* By returning a non-zero value, we are telling
@@ -361,7 +363,7 @@ static inline int post_kprobe_handler(st
goto out;
}
reset_current_kprobe();
- unlock_kprobes();
+ read_unlock(&kprobe_lock);
out:
preempt_enable_no_resched();
@@ -391,7 +393,7 @@ static inline int kprobe_fault_handler(s
regs->msr |= kcb->kprobe_saved_msr;
reset_current_kprobe();
- unlock_kprobes();
+ read_unlock(&kprobe_lock);
preempt_enable_no_resched();
}
return 0;