Re: [PATCHv11 2.6.36-rc2-tip 0/15] 0: Uprobes Patches

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Srikar Dronamraju
Date: Friday, October 29, 2010 - 3:48 am

> It's been a while since the last posting.  Did you make any progress on

Thanks for checking, I discussed with Peter offline and ironed out most
of the issues. I am thankful for Peter for all the suggestions

I am still getting the inode based uprobes to shape. 
Here is the brief summary of the discussion.

Significant differences from the previous patchset are:

- All probes would be maintained in a global rbtree sorted by inode and
  offset.
- There can be one or more consumers per probe. With each consumer there
  will be one handler and one (optional) filter.
- Filter restricts the processes/tasks that the handler is active.
- uprobe structure is dynamically created when the first consumer
  registers to the probe. It gets deallocated when all consumers
  unregisters from the probe.
- While registering a probe, we walk thro the list of vmas that are
  mapped to the inode, check if the consumer wants to probe the task
  corresponding to the vma and inserts the breakpoint.
- unregistering a probe also does something similar except for deleting
  the probe.
- There will be a hook in mmap/unmap to install probes as and when the
  vma gets loaded into process address space. This hook would walk thro
  the tree of probes for that inode and for each probe, walk thro the
  list of consumers and insert/delete breakpoints accordingly.
- There will be a hook in fork to install probes in newly created
  processes. This hook would walk thro the tree of probes for that inode
  and for each probe, walk thro the list of consumers and insert/delete
  breakpoints accordingly.
- Slots will still hang-out of mm_struct.
- Instead of the per-probe slot, we would have to use a per-thread slot.
  (This slot is for single stepping out of line). On every probehit, the
  slot has to be refreshed with the correct contents. 
- Since probe information is stored as inode:offset, probe
  identification on a breakpoint hit can only happen in task context.

Current issues: Given a vma; finding all tasks that have this vma
mapped. The current solution seems to walk thro all tasks in the system
and check if each task's mm field. But this could be inefficient
especially if the vma is part of all processes like libc etc.
I dont think we can use mm->owner to walk thro all the tasks that map to
this mm_struct.

Slot allocation delays: Using a per-thread slot instead of a per-probe
slot leads to a 3.5X degradation in performance. If we need to use
per-probe slots, we would have to have maintain metadata, i.e the slot
to virtual address mapping per process. However Peter prefers that we
reduce such metadata.

If a sigtrap occurs not because of a uprobe, we queue the signal only in
the task context. This is because we cannot identify the cause for trap
in interrupt context. If we use per-probe slots, we could avoid this.

Uprobes may not be able to trace a long-time running process if its
mapped a file that got updated after the process started. This assumes
the probes were placed after the process was started.

To cover the race where a breakpoint is hit while the probe is being
deleted, Paul has agreed to enhance srcu to work in interrupt context.

From a perf/ftrace perspective:

Assuming 3551 as pid 
0x0000000000446420 as the vaddr of the probe for zfree
0x0000000000046420 as the offset of zfree from start of text address.
130904 as the inode number for the /bin/zsh

ftrace interface:
Previously:

# echo 'p 3551:0x0000000000446420 %ip %ax' > uprobe_events
# cat uprobe_events
p:uprobes/p_3551_0x0000000000446420 3551:0x0000000000446420 %ip=%ip %ax=%ax

Now:

# echo 'p /path-to-/file:0x0000000000046420 %ip %ax' > uprobe_events
# cat uprobe_events
p:uprobes/p_file_0x0000000000446420 130904:0x0000000000046420 %ip=%ip %ax=%ax


perf interface:
Previously:

# perf probe -p 3551 zfree@zsh
Added new event:
  probe_3551:zfree                       (on 0x446420)
# perf probe --list
probe_3551:zfree                       (on 3551:0x0000000000446420)

Now: 

# perf probe zfree@zsh
Added new event:
  probe_zsh:zfree                      (on 130904:0x46420)
# perf probe --list
probe_zsh:zfree                       (on 130904:0x0000000000046420)

JFYI: v11 patchset code that I last posted to LKML is available at:
git://git.kernel.org/pub/scm/linux/kernel/git/srikar/linux-uprobes.git
 branch : uprobes_v11_patchset 

Peter knows the details/trade-offs of both the designs.(v11 and the
inode based probes)

-- 
Thanks and Regards
Srikar
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv11 2.6.36-rc2-tip 0/15] 0: Uprobes Patches, Srikar Dronamraju, (Wed Aug 25, 6:41 am)
[PATCHv11 2.6.36-rc2-tip 1/15] 1: mm: Move replace_page() ..., Srikar Dronamraju, (Wed Aug 25, 6:41 am)
[PATCHv11 2.6.36-rc2-tip 2/15] 2: uprobes: Breakpoint ins ..., Srikar Dronamraju, (Wed Aug 25, 6:41 am)
[PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot allocatio ..., Srikar Dronamraju, (Wed Aug 25, 6:41 am)
[PATCHv11 2.6.36-rc2-tip 4/15] 4: uprobes: x86 specific f ..., Srikar Dronamraju, (Wed Aug 25, 6:42 am)
[PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (un)re ..., Srikar Dronamraju, (Wed Aug 25, 6:42 am)
[PATCHv11 2.6.36-rc2-tip 6/15] 6: uprobes: X86 support fo ..., Srikar Dronamraju, (Wed Aug 25, 6:42 am)
[PATCHv11 2.6.36-rc2-tip 7/15] 7: uprobes: Uprobes Docume ..., Srikar Dronamraju, (Wed Aug 25, 6:42 am)
[PATCHv11 2.6.36-rc2-tip 8/15] 8: tracing: Extract out co ..., Srikar Dronamraju, (Wed Aug 25, 6:42 am)
[PATCHv11 2.6.36-rc2-tip 9/15] 9: tracing: uprobes trace_ ..., Srikar Dronamraju, (Wed Aug 25, 6:43 am)
[PATCHv11 2.6.36-rc2-tip 10/15] 10: tracing: config option ..., Srikar Dronamraju, (Wed Aug 25, 6:43 am)
[PATCHv11 2.6.36-rc2-tip 11/15] 11: perf: list symbols in ..., Srikar Dronamraju, (Wed Aug 25, 6:43 am)
[PATCHv11 2.6.36-rc2-tip 12/15] 12: perf: show possible pr ..., Srikar Dronamraju, (Wed Aug 25, 6:43 am)
[PATCHv11 2.6.36-rc2-tip 13/15] 13: perf: Loop thro each o ..., Srikar Dronamraju, (Wed Aug 25, 6:43 am)
[PATCHv11 2.6.36-rc2-tip 14/15] 14: perf: perf interface f ..., Srikar Dronamraju, (Wed Aug 25, 6:44 am)
[PATCHv11 2.6.36-rc2-tip 15/15] 15: perf: Show Potential p ..., Srikar Dronamraju, (Wed Aug 25, 6:44 am)
Re: [PATCHv11 2.6.36-rc2-tip 11/15] 11: perf: list symbols ..., Arnaldo Carvalho de Melo, (Wed Aug 25, 4:21 pm)
Re: [PATCHv11 2.6.36-rc2-tip 11/15] 11: perf: list symbols ..., Srikar Dronamraju, (Wed Aug 25, 9:32 pm)
Re: [PATCHv11 2.6.36-rc2-tip 10/15] 10: tracing: config op ..., Masami Hiramatsu, (Wed Aug 25, 11:02 pm)
Re: [PATCHv11 2.6.36-rc2-tip 10/15] 10: tracing: config op ..., Srikar Dronamraju, (Fri Aug 27, 2:31 am)
Re: [PATCHv11 2.6.36-rc2-tip 10/15] 10: tracing: config op ..., Srikar Dronamraju, (Fri Aug 27, 5:17 am)
[PATCHv11a 2.6.36-rc2-tip 10/15] 10: tracing: config optio ..., Srikar Dronamraju, (Fri Aug 27, 7:10 am)
[PATCHv11a 2.6.36-rc2-tip 12/15] 12: perf: show possible p ..., Srikar Dronamraju, (Fri Aug 27, 7:21 am)
[tip:perf/core] perf symbols: List symbols in a dso in asc ..., tip-bot for Srikar D ..., (Mon Aug 30, 1:35 am)
Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot alloc ..., Srikar Dronamraju, (Thu Sep 2, 10:47 am)
Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot alloc ..., Srikar Dronamraju, (Fri Sep 3, 9:40 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Srikar Dronamraju, (Fri Sep 3, 9:42 am)
Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot alloc ..., Srikar Dronamraju, (Fri Sep 3, 10:26 am)
Re: [PATCHv11 2.6.36-rc2-tip 4/15] 4: uprobes: x86 specif ..., Srikar Dronamraju, (Fri Sep 3, 10:48 am)
Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot alloc ..., Srikar Dronamraju, (Sun Sep 5, 10:38 pm)
Re: [PATCHv11 2.6.36-rc2-tip 4/15] 4: uprobes: x86 specif ..., Srikar Dronamraju, (Mon Sep 6, 6:44 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Srikar Dronamraju, (Mon Sep 6, 10:46 am)
Re: [PATCHv11 2.6.36-rc2-tip 3/15] 3: uprobes: Slot alloc ..., Srikar Dronamraju, (Mon Sep 6, 10:59 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Mathieu Desnoyers, (Mon Sep 6, 11:25 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Christoph Hellwig, (Mon Sep 6, 1:40 pm)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Christoph Hellwig, (Mon Sep 6, 2:12 pm)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Srikar Dronamraju, (Mon Sep 6, 11:48 pm)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Srikar Dronamraju, (Tue Sep 7, 4:51 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Srikar Dronamraju, (Tue Sep 7, 5:02 am)
Re: [PATCHv11 2.6.36-rc2-tip 5/15] 5: uprobes: Uprobes (u ..., Mathieu Desnoyers, (Tue Sep 7, 9:47 am)
Re: [PATCHv11 2.6.36-rc2-tip 0/15] 0: Uprobes Patches, Christoph Hellwig, (Fri Oct 29, 2:23 am)
Re: [PATCHv11 2.6.36-rc2-tip 0/15] 0: Uprobes Patches, Srikar Dronamraju, (Fri Oct 29, 3:48 am)
Re: [PATCHv11 2.6.36-rc2-tip 0/15] 0: Uprobes Patches, Christoph Hellwig, (Thu Nov 4, 11:45 am)