15 Jun, 2011

1 commit

  • Current oprofile's x86 callgraph support may trigger page faults
    throwing the BUG_ON(in_nmi()) message below. This patch fixes this by
    using the same nmi-safe copy-from-user code as in perf.

    ------------[ cut here ]------------
    kernel BUG at .../arch/x86/kernel/traps.c:436!
    invalid opcode: 0000 [#1] SMP
    last sysfs file: /sys/devices/pci0000:00/0000:00:0a.0/0000:07:00.0/0000:08:04.0/net/eth0/broadcast
    CPU 5
    Modules linked in:

    Pid: 8611, comm: opcontrol Not tainted 2.6.39-00007-gfe47ae7 #1 Advanced Micro Device Anaheim/Anaheim
    RIP: 0010:[] [] do_nmi+0x22/0x1ee
    RSP: 0000:ffff88042fd47f28 EFLAGS: 00010002
    RAX: ffff88042c0a7fd8 RBX: 0000000000000001 RCX: 00000000c0000101
    RDX: 00000000ffff8804 RSI: ffffffffffffffff RDI: ffff88042fd47f58
    RBP: ffff88042fd47f48 R08: 0000000000000004 R09: 0000000000001484
    R10: 0000000000000001 R11: 0000000000000000 R12: ffff88042fd47f58
    R13: 0000000000000000 R14: ffff88042fd47d98 R15: 0000000000000020
    FS: 00007fca25e56700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000074 CR3: 000000042d28b000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process opcontrol (pid: 8611, threadinfo ffff88042c0a6000, task ffff88042c532310)
    Stack:
    0000000000000000 0000000000000001 ffff88042c0a7fd8 0000000000000000
    ffff88042fd47de8 ffffffff813e897a 0000000000000020 ffff88042fd47d98
    0000000000000000 ffff88042c0a7fd8 ffff88042fd47de8 0000000000000074
    Call Trace:

    [] nmi+0x1a/0x20
    [] ? bad_to_user+0x25/0x771
    <>
    Code: ff 59 5b 41 5c 41 5d c9 c3 55 65 48 8b 04 25 88 b5 00 00 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 f6 80 47 e0 ff ff 04 74 04 0b eb fe 81 80 44 e0 ff ff 00 00 01 04 65 ff 04 25 c4 0f 01
    RIP [] do_nmi+0x22/0x1ee
    RSP
    ---[ end trace ed6752185092104b ]---
    Kernel panic - not syncing: Fatal exception in interrupt
    Pid: 8611, comm: opcontrol Tainted: G D 2.6.39-00007-gfe47ae7 #1
    Call Trace:
    [] panic+0x8c/0x188
    [] oops_end+0x81/0x8e
    [] die+0x55/0x5e
    [] do_trap+0x11c/0x12b
    [] do_invalid_op+0x91/0x9a
    [] ? do_nmi+0x22/0x1ee
    [] ? oprofile_add_sample+0x83/0x95
    [] ? op_amd_check_ctrs+0x4f/0x2cf
    [] invalid_op+0x15/0x20
    [] ? do_nmi+0x22/0x1ee
    [] ? do_nmi+0x67/0x1ee
    [] nmi+0x1a/0x20
    [] ? bad_to_user+0x25/0x771
    <>

    Cc: John Lumby
    Cc: Maynard Johnson
    Cc: # .37+
    Signed-off-by: Robert Richter

    Robert Richter
     

12 May, 2011

1 commit

  • Both warning and warning_symbol are nowhere used.
    Let's get rid of them.

    Signed-off-by: Richard Weinberger
    Cc: Oleg Nesterov
    Cc: Andrew Morton
    Cc: Huang Ying
    Cc: Soeren Sandmann Pedersen
    Cc: Namhyung Kim
    Cc: x86
    Cc: H. Peter Anvin
    Cc: Thomas Gleixner
    Cc: Robert Richter
    Cc: Paul Mundt
    Link: http://lkml.kernel.org/r/1305205872-10321-2-git-send-email-richard@nod.at
    Signed-off-by: Frederic Weisbecker

    Richard Weinberger
     

18 Mar, 2011

1 commit

  • Current stack dump code scans entire stack and check each entry
    contains a pointer to kernel code. If CONFIG_FRAME_POINTER=y it
    could mark whether the pointer is valid or not based on value of
    the frame pointer. Invalid entries could be preceded by '?' sign.

    However this was not going to happen because scan start point
    was always higher than the frame pointer so that they could not
    meet.

    Commit 9c0729dc8062 ("x86: Eliminate bp argument from the stack
    tracing routines") delayed bp acquisition point, so the bp was
    read in lower frame, thus all of the entries were marked
    invalid.

    This patch fixes this by reverting above commit while retaining
    stack_frame() helper as suggested by Frederic Weisbecker.

    End result looks like below:

    before:

    [ 3.508329] Call Trace:
    [ 3.508551] [] ? panic+0x91/0x199
    [ 3.508662] [] ? printk+0x68/0x6a
    [ 3.508770] [] ? mount_block_root+0x257/0x26e
    [ 3.508876] [] ? mount_root+0x56/0x5a
    [ 3.508975] [] ? prepare_namespace+0x170/0x1a9
    [ 3.509216] [] ? kernel_init+0x1d2/0x1e2
    [ 3.509335] [] ? kernel_thread_helper+0x4/0x10
    [ 3.509442] [] ? restore_args+0x0/0x30
    [ 3.509542] [] ? kernel_init+0x0/0x1e2
    [ 3.509641] [] ? kernel_thread_helper+0x0/0x10

    after:

    [ 3.522991] Call Trace:
    [ 3.523351] [] panic+0x91/0x199
    [ 3.523468] [] ? printk+0x68/0x6a
    [ 3.523576] [] mount_block_root+0x257/0x26e
    [ 3.523681] [] mount_root+0x56/0x5a
    [ 3.523780] [] prepare_namespace+0x170/0x1a9
    [ 3.523885] [] kernel_init+0x1d2/0x1e2
    [ 3.523987] [] kernel_thread_helper+0x4/0x10
    [ 3.524228] [] ? restore_args+0x0/0x30
    [ 3.524345] [] ? kernel_init+0x0/0x1e2
    [ 3.524445] [] ? kernel_thread_helper+0x0/0x10

    -v5:
    * fix build breakage with oprofile

    -v4:
    * use 0 instead of regs->bp
    * separate out printk changes

    -v3:
    * apply comment from Frederic
    * add a couple of printk fixes

    Signed-off-by: Namhyung Kim
    Acked-by: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    Cc: Soren Sandmann
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: Robert Richter
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Namhyung Kim
     

18 Nov, 2010

1 commit

  • The various stack tracing routines take a 'bp' argument in which the
    caller is supposed to provide the base pointer to use, or 0 if doesn't
    have one. Since bp is garbage whenever CONFIG_FRAME_POINTER is not
    defined, this means all callers in principle should either always pass
    0, or be conditional on CONFIG_FRAME_POINTER.

    However, there are only really three use cases for stack tracing:

    (a) Trace the current task, including IRQ stack if any
    (b) Trace the current task, but skip IRQ stack
    (c) Trace some other task

    In all cases, if CONFIG_FRAME_POINTER is not defined, bp should just
    be 0. If it _is_ defined, then

    - in case (a) bp should be gotten directly from the CPU's register, so
    the caller should pass NULL for regs,

    - in case (b) the caller should should pass the IRQ registers to
    dump_trace(),

    - in case (c) bp should be gotten from the top of the task's stack, so
    the caller should pass NULL for regs.

    Hence, the bp argument is not necessary because the combination of
    task and regs is sufficient to determine an appropriate value for bp.

    This patch introduces a new inline function stack_frame(task, regs)
    that computes the desired bp. This function is then called from the
    two versions of dump_stack().

    Signed-off-by: Soren Sandmann
    Acked-by: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: H. Peter Anvin
    Cc: Peter Zijlstra
    Cc: Arjan van de Ven ,
    Cc: Frederic Weisbecker ,
    Cc: Arnaldo Carvalho de Melo ,
    LKML-Reference: >
    Signed-off-by: Frederic Weisbecker

    Soeren Sandmann Pedersen
     

01 Oct, 2010

2 commits


17 Dec, 2009

1 commit

  • The current print_context_stack helper that does the stack
    walking job is good for usual stacktraces as it walks through
    all the stack and reports even addresses that look unreliable,
    which is nice when we don't have frame pointers for example.

    But we have users like perf that only require reliable
    stacktraces, and those may want a more adapted stack walker, so
    lets make this function a callback in stacktrace_ops that users
    can tune for their needs.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

12 May, 2009

1 commit

  • Use ®s->sp instead of regs for getting the top of stack in kernel mode.
    (on x86-64, regs->sp always points the top of stack)

    [ Impact: Oprofile decodes only stack for backtracing on i386 ]

    Signed-off-by: Masami Hiramatsu
    [ v2: rename the API to kernel_stack_pointer(), move variable inside ]
    Acked-by: Linus Torvalds
    Cc: systemtap@sources.redhat.com
    Cc: Harvey Harrison
    Cc: Jan Blunck
    Cc: Christoph Hellwig
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

16 Oct, 2008

2 commits


30 Jan, 2008

4 commits

  • Choose a less generic name for such a special case. Add
    a comment explaining the odd use in X86_32.

    Change the one user of stack_pointer.

    Signed-off-by: Harvey Harrison
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Harvey Harrison
     
  • Right now, we take the stack pointer early during the backtrace path, but
    only calculate bp several functions deep later, making it hard to reconcile
    the stack and bp backtraces (as well as showing several internal backtrace
    functions on the stack with bp based backtracing).

    This patch moves the bp taking to the same place we take the stack pointer;
    sadly this ripples through several layers of the back tracing stack,
    but it's not all that bad in the end I hope.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Arjan van de Ven
     
  • For enhancing the 32 bit EBP based backtracer, I need the capability
    for the backtracer to tell it's customer that an entry is either
    reliable or unreliable, and the backtrace printing code then needs to
    print the unreliable ones slightly different.

    This patch adds the basic capability, the next patch will add a user
    of this capability.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Arjan van de Ven
     
  • We have a lot of code which differs only by the naming of specific
    members of structures that contain registers. In order to enable
    additional unifications, this patch drops the e- or r- size prefix
    from the register names in struct pt_regs, and drops the x- prefixes
    for segment registers on the 32-bit side.

    This patch also performs the equivalent renames in some additional
    places that might be candidates for unification in the future.

    Signed-off-by: H. Peter Anvin
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    H. Peter Anvin
     

20 Oct, 2007

2 commits

  • This patch defines frame_pointer() and stack_pointer() similar to the
    already defined instruction_pointer(). Thus the oprofile code can be
    written in a more readable fashion.

    [ tglx: arch/x86 adaptation ]

    Signed-off-by: Jan Blunck
    Signed-off-by: Andi Kleen
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jan Blunck
     
  • This patch improves oprofile callgraphs for i386/x86_64. The old
    backtracing code was unable to produce kernel backtraces if the
    kernel wasn't compiled with framepointers. The code now uses
    dump_trace().

    [ tglx: arch/x86 adaptation ]

    Signed-off-by: Jan Blunck
    Signed-off-by: Andi Kleen
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Jan Blunck
     

11 Oct, 2007

1 commit