diff options
author | Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 2006-01-09 23:52:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:40 -0500 |
commit | 49a2a1b83ba6fa40c41968d6a28ba16e7ed0c3f7 (patch) | |
tree | f257b535d0f09f9ac2531d40feb732349993665c /arch/x86_64/kernel/kprobes.c | |
parent | 41dead49ccb4d7f0a34d56478f487342a3c3ab2b (diff) |
[PATCH] kprobes: changed from using spinlock to mutex
Since Kprobes runtime exception handlers is now lock free as this code path is
now using RCU to walk through the list, there is no need for the
register/unregister{_kprobe} to use spin_{lock/unlock}_isr{save/restore}. The
serialization during registration/unregistration is now possible using just a
mutex.
In the above process, this patch also fixes a minor memory leak for x86_64 and
powerpc.
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/kprobes.c')
-rw-r--r-- | arch/x86_64/kernel/kprobes.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index afe11f4fbd1d..8b8943bfb89e 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -42,8 +42,8 @@ | |||
42 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
43 | #include <asm/kdebug.h> | 43 | #include <asm/kdebug.h> |
44 | 44 | ||
45 | static DECLARE_MUTEX(kprobe_mutex); | ||
46 | void jprobe_return_end(void); | 45 | void jprobe_return_end(void); |
46 | void __kprobes arch_copy_kprobe(struct kprobe *p); | ||
47 | 47 | ||
48 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 48 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; |
49 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 49 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
@@ -69,12 +69,11 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn) | |||
69 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 69 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
70 | { | 70 | { |
71 | /* insn: must be on special executable page on x86_64. */ | 71 | /* insn: must be on special executable page on x86_64. */ |
72 | down(&kprobe_mutex); | ||
73 | p->ainsn.insn = get_insn_slot(); | 72 | p->ainsn.insn = get_insn_slot(); |
74 | up(&kprobe_mutex); | ||
75 | if (!p->ainsn.insn) { | 73 | if (!p->ainsn.insn) { |
76 | return -ENOMEM; | 74 | return -ENOMEM; |
77 | } | 75 | } |
76 | arch_copy_kprobe(p); | ||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
80 | 79 | ||
@@ -223,9 +222,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
223 | 222 | ||
224 | void __kprobes arch_remove_kprobe(struct kprobe *p) | 223 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
225 | { | 224 | { |
226 | down(&kprobe_mutex); | ||
227 | free_insn_slot(p->ainsn.insn); | 225 | free_insn_slot(p->ainsn.insn); |
228 | up(&kprobe_mutex); | ||
229 | } | 226 | } |
230 | 227 | ||
231 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) | 228 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |