Skip to contentSkip to conversation

kprobes: kprobe_mutex is no longer a semaphore

PATCH Prasanna S Panchamukhi 2 participants 3 messages Feb 27, 2006 1 message not in the archive

lore
Share & tools
lore

Prasanna S Panchamukhi

author Acked-by
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines · Jesper Juhl

kprobe_mutex used to be a semaphore it is now a mutex, so calling down/up on it is wrong, we should be using mutex_lock/mutex_unlock instead.

gcc was kind enough to warn about this :
arch/i386/kernel/kprobes.c: In function `arch_remove_kprobe':
arch/i386/kernel/kprobes.c:135: warning: passing arg 1 of down' from incompatible pointer type arch/i386/kernel/kprobes.c:137: warning: passing arg 1 of up' from incompatible pointer type

Looks good, this patch depends on the sem2mutex-kprobes.patch in -mm tree.
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc4/2.6.16-rc4-mm2/broken-out/sem2mutex-kprobes.patch

Quoted 21 lines

---

 arch/i386/kernel/kprobes.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/i386/kernel/kprobes.c +2 -2
@@ -132,9 +132,9 @@ void __kprobes arch_disarm_kprobe(struct
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
 {
-	down(&kprobe_mutex);
+	mutex_lock(&kprobe_mutex);
 	free_insn_slot(p->ainsn.insn);
-	up(&kprobe_mutex);
+	mutex_unlock(&kprobe_mutex);
 }
 
 static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
Signature · 5 lines
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Email: [email protected]
Ph: 91-80-51776329
#2 lore raw
Quoted 11 lines · Prasanna S Panchamukhi
Quoted 10 lines · Jesper Juhl

kprobe_mutex used to be a semaphore it is now a mutex, so calling down/up on it is wrong, we should be using mutex_lock/mutex_unlock instead.

gcc was kind enough to warn about this :
arch/i386/kernel/kprobes.c: In function `arch_remove_kprobe':
arch/i386/kernel/kprobes.c:135: warning: passing arg 1 of down' from incompatible pointer type arch/i386/kernel/kprobes.c:137: warning: passing arg 1 of up' from incompatible pointer type

Quoted 9 lines
Quoted 1 line

Looks good, this patch depends on the sem2mutex-kprobes.patch in -mm tree.
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc4/2.6.16-rc4-mm2/broken-out/sem2mutex-kprobes.patch

Thank you.

Are you going to merge it / push it to Andrew or Linus? If not I'll just queue it up with some other patches I have lying around and forward it with those other patches in a week or so.

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html

#3 lore raw
Quoted 19 lines · Jesper Juhl
Quoted 18 lines · Prasanna S Panchamukhi
Quoted 11 lines · Jesper Juhl

kprobe_mutex used to be a semaphore it is now a mutex, so calling down/up on it is wrong, we should be using mutex_lock/mutex_unlock instead.

gcc was kind enough to warn about this :
arch/i386/kernel/kprobes.c: In function `arch_remove_kprobe':
arch/i386/kernel/kprobes.c:135: warning: passing arg 1 of down' from incompatible pointer type arch/i386/kernel/kprobes.c:137: warning: passing arg 1 of up' from incompatible pointer type

Looks good, this patch depends on the sem2mutex-kprobes.patch in -mm tree.
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc4/2.6.16-rc4-mm2/broken-out/sem2mutex-kprobes.patch

Quoted 6 lines
Quoted 2 lines

Thank you.

Are you going to merge it / push it to Andrew or Linus?

Yes.

Quoted 4 lines

If not I'll just queue it up with some other patches I have lying around and forward it with those other patches in a week or so.

Thanks
Prasanna

Quoted 4 lines

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html

Signature · 5 lines
Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Email: [email protected]
Ph: 91-80-51776329