public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug kprobes/2452] New: kretprobe spinlock recursive remove
@ 2006-03-13  6:23 bibo dot mao at intel dot com
  2006-03-13  8:28 ` [Bug kprobes/2452] " yanmin dot zhang at intel dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bibo dot mao at intel dot com @ 2006-03-13  6:23 UTC (permalink / raw)
  To: systemtap

In new linux kernel version, kretprobe in IA32 is implemented in
kretprobe_trampoline. And probepoint is removed from kretprobe_trampoline,
instead   trampoline_handler is called directly.
Currently if kretprobe hander hit one trap which causes another kretprobe, there
will be SPINLOCK recursive bug. This patch fixes this, and will skip trap during
kretprobe handler execution. 
And the test case is the same in
http://sourceware.org/bugzilla/show_bug.cgi?id=2071.

--- 2.6.16-rc6-mm1.org/arch/i386/kernel/kprobes.c	2006-03-13 12:25:15.000000000
+0800
+++ 2.6.16-rc6-mm1/arch/i386/kernel/kprobes.c	2006-03-13 11:38:26.000000000 +0800
@@ -389,9 +389,11 @@ fastcall void *__kprobes trampoline_hand
 			/* another task is sharing our hash bucket */
                         continue;
 
-		if (ri->rp && ri->rp->handler)
+		if (ri->rp && ri->rp->handler){
+			__get_cpu_var(current_kprobe) = &ri->rp->kp;
 			ri->rp->handler(ri, regs);
-
+			__get_cpu_var(current_kprobe) = NULL;
+		}
 		orig_ret_address = (unsigned long)ri->ret_addr;
 		recycle_rp_inst(ri);

-- 
           Summary: kretprobe spinlock recursive remove
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: kprobes
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: bibo dot mao at intel dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2452

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug kprobes/2452] kretprobe spinlock recursive remove
  2006-03-13  6:23 [Bug kprobes/2452] New: kretprobe spinlock recursive remove bibo dot mao at intel dot com
@ 2006-03-13  8:28 ` yanmin dot zhang at intel dot com
  2006-03-13  8:49 ` yanmin dot zhang at intel dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: yanmin dot zhang at intel dot com @ 2006-03-13  8:28 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From yanmin dot zhang at intel dot com  2006-03-13 08:28 -------
The patch looks like a hack and disables kprobe within the kret handler.

A thorough approach is to change kretprobe_inst table as a list per 
task_struct and delete the spin lock in trampoline_handler, then estimate if 
it's a reentrancy for current task. This approach has better scalability and  
also solve this issue.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2452

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug kprobes/2452] kretprobe spinlock recursive remove
  2006-03-13  6:23 [Bug kprobes/2452] New: kretprobe spinlock recursive remove bibo dot mao at intel dot com
  2006-03-13  8:28 ` [Bug kprobes/2452] " yanmin dot zhang at intel dot com
@ 2006-03-13  8:49 ` yanmin dot zhang at intel dot com
  2006-03-13  9:11 ` yanmin dot zhang at intel dot com
  2006-03-16 21:52 ` jkenisto at us dot ibm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: yanmin dot zhang at intel dot com @ 2006-03-13  8:49 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From yanmin dot zhang at intel dot com  2006-03-13 08:49 -------
Another approach is to use a new per cpu data to record current in 
trampoline_handler and compare if it's a reentrancy of current task. It's 
simpler than the first approach.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2452

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug kprobes/2452] kretprobe spinlock recursive remove
  2006-03-13  6:23 [Bug kprobes/2452] New: kretprobe spinlock recursive remove bibo dot mao at intel dot com
  2006-03-13  8:28 ` [Bug kprobes/2452] " yanmin dot zhang at intel dot com
  2006-03-13  8:49 ` yanmin dot zhang at intel dot com
@ 2006-03-13  9:11 ` yanmin dot zhang at intel dot com
  2006-03-16 21:52 ` jkenisto at us dot ibm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: yanmin dot zhang at intel dot com @ 2006-03-13  9:11 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From yanmin dot zhang at intel dot com  2006-03-13 09:10 -------
Sorry, the second approach has a problem. When trampline_handler is entered, 
it must execute the corresponding kret handler.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2452

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug kprobes/2452] kretprobe spinlock recursive remove
  2006-03-13  6:23 [Bug kprobes/2452] New: kretprobe spinlock recursive remove bibo dot mao at intel dot com
                   ` (2 preceding siblings ...)
  2006-03-13  9:11 ` yanmin dot zhang at intel dot com
@ 2006-03-16 21:52 ` jkenisto at us dot ibm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jkenisto at us dot ibm dot com @ 2006-03-16 21:52 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jkenisto at us dot ibm dot com  2006-03-16 21:52 -------
My understanding is that Bibo has fixed this.  Please append an update, Bibo. 
Thanks.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jkenisto at us dot ibm dot
                   |                            |com
         AssignedTo|systemtap at sources dot    |bibo dot mao at intel dot
                   |redhat dot com              |com
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=2452

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-16 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13  6:23 [Bug kprobes/2452] New: kretprobe spinlock recursive remove bibo dot mao at intel dot com
2006-03-13  8:28 ` [Bug kprobes/2452] " yanmin dot zhang at intel dot com
2006-03-13  8:49 ` yanmin dot zhang at intel dot com
2006-03-13  9:11 ` yanmin dot zhang at intel dot com
2006-03-16 21:52 ` jkenisto at us dot ibm dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).