Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack Traces: TNG #450

Merged
merged 5 commits into from
Mar 27, 2016
Merged

Stack Traces: TNG #450

merged 5 commits into from
Mar 27, 2016

Commits on Mar 26, 2016

  1. memleak: Resolve stacks with a StackTrace table

    Instead of manually walking the (kernel) stack inside the eBPF code,
    create a `BPF_STACK_TRACE` table and store the stack IDs in the alloc
    info struct.
    
    This greatly simplifies the leak detection code: instead of storing the
    full stack trace as a string to de-duplicate the allocation point for
    the different allocations, we can store the `stack_id`. Since we're
    creating stack IDs with `BPF_F_REUSE_STACKID`, the kernel will take care
    of deduplication for us.
    
    Additionally, the `StackDecoder` class has been specialized into a
    `UStackDecoder` and `KStackDecoder` (for userland and kernel stacks,
    respectively). This lets us pass the decode class directly to
    `stack_traces.walk()` to automate symbol resolution.
    
    A new class, `Allocation` has been created to encapsulate what
    previously was a 2-element tuple of `(count, size)`. This
    vmg committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    e25ae03 View commit details
    Browse the repository at this point in the history
  2. offcputime: Resolve stacks using a StackTrace table

    The manual walking for kernel stacks in the eBPF code has been replaced
    with a `BPF_STACK_TRACE` table; the stack ID is now stored as an integer
    in the main key.
    
    Thanks to the `StackTrace.walk` iterator, the printing code can also be
    significantly simplified for both folded and full stack modes.
    vmg committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    e82fb1b View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2016

  1. BPF: better format for ksymaddr

    The offset is now returned after a `+` symbol, instead of directly
    attached to the symbol name (which made reading the output very
    confusing)
    
    Before:
        tick_do_update_jiffies64a0
    
    After:
        tick_do_update_jiffies64+0xa0
    vmg committed Mar 27, 2016
    Configuration menu
    Copy the full SHA
    3a137db View commit details
    Browse the repository at this point in the history
  2. stacksnoop: Resolve stacks using a StackTrace table

    Instead of manually walking the stack and printing each frame to the
    trace log, we can use a BPF_STACK_TRACE table to store the stack traces,
    and print to the trace log their IDs every time they are traced.
    
    The output of the tool has been slightly modified: we no longer prefix
    each line of the stack trace with the timestamp and the other headers,
    since the whole stack trace is fetched in one go from the table and the
    information would be highly redundant.
    
    The man page and the examples have been updated to reflect the new
    output.
    vmg committed Mar 27, 2016
    Configuration menu
    Copy the full SHA
    592414e View commit details
    Browse the repository at this point in the history
  3. stackcount: Resolve stacks using a StackTrace table

    The changes for this script are minimal: the inline C probe has been
    _significantly_ simplified, and should now perform better since the
    stack walk happens in native code inside the kernel thanks to the
    BPF_STACK_TRACE table.
    
    The output of the tool should be virtually identical, so the man page
    and included examples have essentially no changes.
    vmg committed Mar 27, 2016
    Configuration menu
    Copy the full SHA
    b4ebed0 View commit details
    Browse the repository at this point in the history