Skip to content

Commit

Permalink
[PATCH] x86: fix oprofile kernel callgraph regression
Browse files Browse the repository at this point in the history
Fix x86 oprofile regression introduced by:
  commit c34d1b4
  [PATCH] mm: kill check_user_page_readable

That commit reorganized tests for the userspace stack walking moving all
those tests into dump_backtrace(), however, dump_backtrace() was used for
both userspace and kernel stalk walking.  The result is typically no
recorded callgraph information for kernel samples.

Revive the original function as dump_kernel_backtrace() and rename the
other to dump_user_backtrace() to avoid future confusion.

Signed-off-by: Gerald Britton <gbritton@alum.mit.edu>
Apology-from: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Gerald Britton authored and Linus Torvalds committed Feb 14, 2006
1 parent b739db7 commit 3037944
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions arch/i386/oprofile/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ struct frame_head {
} __attribute__((packed));

static struct frame_head *
dump_backtrace(struct frame_head * head)
dump_kernel_backtrace(struct frame_head * head)
{
oprofile_add_trace(head->ret);

/* frame pointers should strictly progress back up the stack
* (towards higher addresses) */
if (head >= head->ebp)
return NULL;

return head->ebp;
}

static struct frame_head *
dump_user_backtrace(struct frame_head * head)
{
struct frame_head bufhead[2];

Expand Down Expand Up @@ -105,10 +118,10 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)

if (!user_mode_vm(regs)) {
while (depth-- && valid_kernel_stack(head, regs))
head = dump_backtrace(head);
head = dump_kernel_backtrace(head);
return;
}

while (depth-- && head)
head = dump_backtrace(head);
head = dump_user_backtrace(head);
}

0 comments on commit 3037944

Please sign in to comment.