1. 26 Nov, 2008 6 commits
    • Steven Rostedt's avatar
      ftrace: use code patching for ftrace graph tracer · 5a45cfe1
      Steven Rostedt authored
      Impact: more efficient code for ftrace graph tracer
      
      This patch uses the dynamic patching, when available, to patch
      the function graph code into the kernel.
      
      This patch will ease the way for letting both function tracing
      and function graph tracing run together.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5a45cfe1
    • Steven Rostedt's avatar
      ftrace: add function tracing to single thread · df4fc315
      Steven Rostedt authored
      Impact: feature to function trace a single thread
      
      This patch adds the ability to function trace a single thread.
      The file:
      
        /debugfs/tracing/set_ftrace_pid
      
      contains the pid to trace. Valid pids are any positive integer.
      Writing any negative number to this file will disable the pid
      tracing and the function tracer will go back to tracing all of
      threads.
      
      This feature works with both static and dynamic function tracing.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      df4fc315
    • Ingo Molnar's avatar
      tracing: function graph tracer, fix · c2324b69
      Ingo Molnar authored
      fix return-tracer => graph-tracer namespace rename fallout.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c2324b69
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: set a more human readable output · 287b6e68
      Frederic Weisbecker authored
      Impact: feature
      
      This patch sets a C-like output for the function graph tracing.
      For this aim, we now call two handler for each function: one on the entry
      and one other on return. This way we can draw a well-ordered call stack.
      
      The pid of the previous trace is loosely stored to be compared against
      the one of the current trace to see if there were a context switch.
      
      Without this little feature, the call tree would seem broken at
      some locations.
      We could use the sched_tracer to capture these sched_events but this
      way of processing is much more simpler.
      
      2 spaces have been chosen for indentation to fit the screen while deep
      calls. The time of execution in nanosecs is printed just after closed
      braces, it seems more easy this way to find the corresponding function.
      If the time was printed as a first column, it would be not so easy to
      find the corresponding function if it is called on a deep depth.
      
      I plan to output the return value but on 32 bits CPU, the return value
      can be 32 or 64, and its difficult to guess on which case we are.
      I don't know what would be the better solution on X86-32: only print
      eax (low-part) or even edx (high-part).
      
      Actually it's thee same problem when a function return a 8 bits value, the
      high part of eax could contain junk values...
      
      Here is an example of trace:
      
      sys_read() {
        fget_light() {
        } 526
        vfs_read() {
          rw_verify_area() {
            security_file_permission() {
              cap_file_permission() {
              } 519
            } 1564
          } 2640
          do_sync_read() {
            pipe_read() {
              __might_sleep() {
              } 511
              pipe_wait() {
                prepare_to_wait() {
                } 760
                deactivate_task() {
                  dequeue_task() {
                    dequeue_task_fair() {
                      dequeue_entity() {
                        update_curr() {
                          update_min_vruntime() {
                          } 504
                        } 1587
                        clear_buddies() {
                        } 512
                        add_cfs_task_weight() {
                        } 519
                        update_min_vruntime() {
                        } 511
                      } 5602
                      dequeue_entity() {
                        update_curr() {
                          update_min_vruntime() {
                          } 496
                        } 1631
                        clear_buddies() {
                        } 496
                        update_min_vruntime() {
                        } 527
                      } 4580
                      hrtick_update() {
                        hrtick_start_fair() {
                        } 488
                      } 1489
                    } 13700
                  } 14949
                } 16016
                msecs_to_jiffies() {
                } 496
                put_prev_task_fair() {
                } 504
                pick_next_task_fair() {
                } 489
                pick_next_task_rt() {
                } 496
                pick_next_task_fair() {
                } 489
                pick_next_task_idle() {
                } 489
      
      ------------8<---------- thread 4 ------------8<----------
      
      finish_task_switch() {
      } 1203
      do_softirq() {
        __do_softirq() {
          __local_bh_disable() {
          } 669
          rcu_process_callbacks() {
            __rcu_process_callbacks() {
              cpu_quiet() {
                rcu_start_batch() {
                } 503
              } 1647
            } 3128
            __rcu_process_callbacks() {
            } 542
          } 5362
          _local_bh_enable() {
          } 587
        } 8880
      } 9986
      kthread_should_stop() {
      } 669
      deactivate_task() {
        dequeue_task() {
          dequeue_task_fair() {
            dequeue_entity() {
              update_curr() {
                calc_delta_mine() {
                } 511
                update_min_vruntime() {
                } 511
              } 2813
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      287b6e68
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: change the name into function-graph-tracer · fb52607a
      Frederic Weisbecker authored
      Impact: cleanup
      
      This patch changes the name of the "return function tracer" into
      function-graph-tracer which is a more suitable name for a tracing
      which makes one able to retrieve the ordered call stack during
      the code flow.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fb52607a
    • Ingo Molnar's avatar
  2. 25 Nov, 2008 12 commits
  3. 24 Nov, 2008 1 commit
  4. 23 Nov, 2008 21 commits
    • Török Edwin's avatar
      vfs, seqfile: fix comment style on mangle_path · 958086d1
      Török Edwin authored
      Impact: use standard docbook tags
      Reported-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: default avatarTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      958086d1
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: free the return stack on free_task() · 65afa5e6
      Frederic Weisbecker authored
      Impact: avoid losing some traces when a task is freed
      
      do_exit() is not the last function called when a task finishes.
      There are still some functions which are to be called such as
      ree_task().  So we delay the freeing of the return stack to the
      last moment.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      65afa5e6
    • Pekka Paalanen's avatar
      tracing, doc: update mmiotrace documentation · fb91ee6c
      Pekka Paalanen authored
      Impact: update documentation
      
      Update to reflect the current state of the tracing framework:
      
       - "none" tracer has been replaced by "nop" tracer
       - tracing_enabled must be toggled when changing buffer size
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fb91ee6c
    • Pekka Paalanen's avatar
      x86, mmiotrace: fix buffer overrun detection · 7ee1768d
      Pekka Paalanen authored
      Impact: fix mmiotrace overrun tracing
      
      When ftrace framework moved to use the ring buffer facility, the buffer
      overrun detection was broken after 2.6.27 by commit
      
      | commit 3928a8a2
      | Author: Steven Rostedt <rostedt@goodmis.org>
      | Date:   Mon Sep 29 23:02:41 2008 -0400
      |
      |     ftrace: make work with new ring buffer
      |
      |     This patch ports ftrace over to the new ring buffer.
      
      The detection is now fixed by using the ring buffer API.
      
      When mmiotrace detects a buffer overrun, it will report the number of
      lost events. People reading an mmiotrace log must know if something was
      missed, otherwise the data may not make sense.
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7ee1768d
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: don't trace kfree while it frees the return stack · eae849ca
      Frederic Weisbecker authored
      Impact: fix a crash
      
      While I killed the cat process, I got sometimes the following (but rare)
      crash:
      
      [   65.689027] Pid: 2969, comm: cat Not tainted (2.6.28-rc6-tip #83) AMILO Li 2727
      [   65.689027] EIP: 0060:[<00000000>] EFLAGS: 00010082 CPU: 1
      [   65.689027] EIP is at 0x0
      [   65.689027] EAX: 00000000 EBX: f66cd780 ECX: c019a64a EDX: f66cd780
      [   65.689027] ESI: 00000286 EDI: f66cd780 EBP: f630be2c ESP: f630be24
      [   65.689027]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      [   65.689027] Process cat (pid: 2969, ti=f630a000 task=f66cd780 task.ti=f630a000)
      [   65.689027] Stack:
      [   65.689027]  00000012 f630bd54 f630be7c c012c853 00000000 c0133cc9 f66cda54 f630be5c
      [   65.689027]  f630be68 f66cda54 f66cd88c f66cd878 f7070000 00000001 f630be90 c0135dbc
      [   65.689027]  f614a614 f630be68 f630be68 f65ba200 00000002 f630bf10 f630be90 c012cad6
      [   65.689027] Call Trace:
      [   65.689027]  [<c012c853>] ? do_exit+0x603/0x850
      [   65.689027]  [<c0133cc9>] ? next_signal+0x9/0x40
      [   65.689027]  [<c0135dbc>] ? dequeue_signal+0x8c/0x180
      [   65.689027]  [<c012cad6>] ? do_group_exit+0x36/0x90
      [   65.689027]  [<c013709c>] ? get_signal_to_deliver+0x20c/0x390
      [   65.689027]  [<c0102b69>] ? do_notify_resume+0x99/0x8b0
      [   65.689027]  [<c02e6d1a>] ? tty_ldisc_deref+0x5a/0x80
      [   65.689027]  [<c014db9b>] ? trace_hardirqs_on+0xb/0x10
      [   65.689027]  [<c02e6d1a>] ? tty_ldisc_deref+0x5a/0x80
      [   65.689027]  [<c02e39b0>] ? n_tty_write+0x0/0x340
      [   65.689027]  [<c02e1812>] ? redirected_tty_write+0x82/0x90
      [   65.689027]  [<c019ee99>] ? vfs_write+0x99/0xd0
      [   65.689027]  [<c02e1790>] ? redirected_tty_write+0x0/0x90
      [   65.689027]  [<c019f342>] ? sys_write+0x42/0x70
      [   65.689027]  [<c01035ca>] ? work_notifysig+0x13/0x19
      [   65.689027] Code:  Bad EIP value.
      [   65.689027] EIP: [<00000000>] 0x0 SS:ESP 0068:f630be24
      
      This is because on do_exit(), kfree is called to free the return addresses stack
      but kfree is traced and stored its return address in this stack.
      This patch fixes it.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      eae849ca
    • Ingo Molnar's avatar
      Merge branch 'ppc/ftrace' of... · 813b8520
      Ingo Molnar authored
      Merge branch 'ppc/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/powerpc
      813b8520
    • Ian Campbell's avatar
      xen: pin correct PGD on suspend · 86bbc2c2
      Ian Campbell authored
      Impact: fix Xen guest boot failure
      
      commit eefb47f6 ("xen: use
      spin_lock_nest_lock when pinning a pagetable") changed xen_pgd_walk to
      walk over mm->pgd rather than taking pgd as an argument.
      
      This breaks xen_mm_(un)pin_all() because it makes init_mm.pgd readonly
      instead of the pgd we are interested in and therefore the pin subsequently
      fails.
      
      (XEN) mm.c:2280:d15 Bad type (saw 00000000e8000001 != exp 0000000060000000) for mfn bc464 (pfn 21ca7)
      (XEN) mm.c:2665:d15 Error while pinning mfn bc464
      
      [   14.586913] 1 multicall(s) failed: cpu 0
      [   14.586926] Pid: 14, comm: kstop/0 Not tainted 2.6.28-rc5-x86_32p-xenU-00172-gee2f6cc7 #200
      [   14.586940] Call Trace:
      [   14.586955]  [<c030c17a>] ? printk+0x18/0x1e
      [   14.586972]  [<c0103df3>] xen_mc_flush+0x163/0x1d0
      [   14.586986]  [<c0104bc1>] __xen_pgd_pin+0xa1/0x110
      [   14.587000]  [<c015a330>] ? stop_cpu+0x0/0xf0
      [   14.587015]  [<c0104d7b>] xen_mm_pin_all+0x4b/0x70
      [   14.587029]  [<c022bcb9>] xen_suspend+0x39/0xe0
      [   14.587042]  [<c015a330>] ? stop_cpu+0x0/0xf0
      [   14.587054]  [<c015a3cd>] stop_cpu+0x9d/0xf0
      [   14.587067]  [<c01417cd>] run_workqueue+0x8d/0x150
      [   14.587080]  [<c030e4b3>] ? _spin_unlock_irqrestore+0x23/0x40
      [   14.587094]  [<c014558a>] ? prepare_to_wait+0x3a/0x70
      [   14.587107]  [<c0141918>] worker_thread+0x88/0xf0
      [   14.587120]  [<c01453c0>] ? autoremove_wake_function+0x0/0x50
      [   14.587133]  [<c0141890>] ? worker_thread+0x0/0xf0
      [   14.587146]  [<c014509c>] kthread+0x3c/0x70
      [   14.587157]  [<c0145060>] ? kthread+0x0/0x70
      [   14.587170]  [<c0109d1b>] kernel_thread_helper+0x7/0x10
      [   14.587181]   call  1/3: op=14 arg=[c0415000] result=0
      [   14.587192]   call  2/3: op=14 arg=[e1ca2000] result=0
      [   14.587204]   call  3/3: op=26 arg=[c1808860] result=-22
      Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Acked-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      86bbc2c2
    • Török Edwin's avatar
      tracing/stack-tracer: avoid races accessing file · e38da592
      Török Edwin authored
      Impact: fix race
      
      vma->vm_file reference is only stable while holding the mmap_sem,
      so move usage of it to within the critical section.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e38da592
    • Ingo Molnar's avatar
      Merge branch 'oprofile-for-tip' of... · 3d994e10
      Ingo Molnar authored
      Merge branch 'oprofile-for-tip' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile into x86/urgent
      3d994e10
    • Thomas Gleixner's avatar
      x86: revert irq number limitation · a1967d64
      Thomas Gleixner authored
      Impact: fix MSIx not enough irq numbers available regression
      
      The manual revert of the sparse_irq patches missed to bring the number
      of possible irqs back to the .27 status. This resulted in a regression
      when two multichannel network cards were placed in a system with only
      one IO_APIC - causing the networking driver to not have the right
      IRQ and the device not coming up.
      
      Remove the dynamic allocation logic leftovers and simply return
      NR_IRQS in probe_nr_irqs() for now.
      
         Fixes: http://lkml.org/lkml/2008/11/19/354Reported-by: default avatarJesper Dangaard Brouer <hawk@diku.dk>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarJesper Dangaard Brouer <hawk@diku.dk>
      Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a1967d64
    • Török Edwin's avatar
      tracing/stack-tracer: introduce CONFIG_USER_STACKTRACE_SUPPORT · 8d26487f
      Török Edwin authored
      Impact: cleanup
      
      User stack tracing is just implemented for x86, but it is not x86 specific.
      
      Introduce a generic config flag, that is currently enabled only for x86.
      When other arches implement it, they will have to
      SELECT USER_STACKTRACE_SUPPORT.
      Signed-off-by: default avatarTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8d26487f
    • Török Edwin's avatar
      tracing/stack-tracer: fix locking and refcounts · cffa10ae
      Török Edwin authored
      Impact: fix refcounting/object-access bug
      
      Hold mmap_sem while looking up/accessing vma.
      Hold the RCU lock while using the task we looked up.
      Signed-off-by: default avatarTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      cffa10ae
    • Török Edwin's avatar
      tracing/stack-tracer: fix style issues · 8d7c6a96
      Török Edwin authored
      Impact: cleanup
      Signed-off-by: default avatarTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8d7c6a96
    • Steven Rostedt's avatar
      trace: fix compiler warning in branch profiler · 0429149f
      Steven Rostedt authored
      Impact: fix compiler warning
      
      The ftrace_pointers used in the branch profiler are constant values.
      They should never change. But the compiler complains when they are
      passed into the debugfs_create_file as a data pointer, because the
      function discards the qualifier.
      
      This patch typecasts the parameter to debugfs_create_file back to
      a void pointer. To remind the callbacks that they are pointing to
      a constant value, I also modified the callback local pointers to
      be const struct ftrace_pointer * as well.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0429149f
    • Steven Rostedt's avatar
      ftrace: add ftrace_off_permanent · 69bb54ec
      Steven Rostedt authored
      Impact: add new API to disable all of ftrace on anomalies
      
      It case of a serious anomaly being detected (like something caught by
      lockdep) it is a good idea to disable all tracing immediately, without
      grabing any locks.
      
      This patch adds ftrace_off_permanent that disables the tracers, function
      tracing and ring buffers without a way to enable them again. This should
      only be used when something serious has been detected.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      69bb54ec
    • Steven Rostedt's avatar
      ring-buffer: add tracing_off_permanent · 033601a3
      Steven Rostedt authored
      Impact: feature to permanently disable ring buffer
      
      This patch adds a API to the ring buffer code that will permanently
      disable the ring buffer from ever recording. This should only be
      called when some serious anomaly is detected, and the system
      may be in an unstable state. When that happens, shutting down the
      recording to the ring buffers may be appropriate.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      033601a3
    • Jim Radford's avatar
      ftrace: scripts/recordmcount.pl support for ARM · e58918ab
      Jim Radford authored
      Impact: extend scripts/recordmcount.pl to ARM
      
      Arm uses %progbits instead of @progbits and requires only 4 byte alignment.
      
      [ Thanks to Sam Ravnborg for mentioning that ARM uses %progbits ]
      Signed-off-by: default avatarJim Radford <radford@galvanix.com>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e58918ab
    • Matt Fleming's avatar
      ftrace: specify $alignment for sh architecture · 3a3d04ae
      Matt Fleming authored
      Impact: extend scripts/recordmcount.pl with default alignment for SH
      
      Set $alignment=2 for the sh architecture so that a ".align 2" directive
      will be emitted for all __mcount_loc sections. Fix a whitspace error
      while I'm here (converted spaces to tabs).
      Signed-off-by: default avatarMatt Fleming <mjf@gentoo.org>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a3d04ae
    • Steven Rostedt's avatar
      trace: profile all if conditionals · 2bcd521a
      Steven Rostedt authored
      Impact: feature to profile if statements
      
      This patch adds a branch profiler for all if () statements.
      The results will be found in:
      
        /debugfs/tracing/profile_branch
      
      For example:
      
         miss      hit    %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
             0        1 100 x86_64_start_reservations      head64.c             127
             0        1 100 copy_bootdata                  head64.c             69
             1        0   0 x86_64_start_kernel            head64.c             111
            32        0   0 set_intr_gate                  desc.h               319
             1        0   0 reserve_ebda_region            head.c               51
             1        0   0 reserve_ebda_region            head.c               47
             0        1 100 reserve_ebda_region            head.c               42
             0        0   X maxcpus                        main.c               165
      
      Miss means the branch was not taken. Hit means the branch was taken.
      The percent is the percentage the branch was taken.
      
      This adds a significant amount of overhead and should only be used
      by those analyzing their system.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2bcd521a
    • Steven Rostedt's avatar
      trace: branch profiling should not print percent without data · bac28bfe
      Steven Rostedt authored
      Impact: cleanup on output of branch profiler
      
      When a branch has not been taken, it does not make sense to show
      a percentage incorrect or hit. This patch changes the behaviour
      to print out a 'X' when the branch has not been executed yet.
      
      For example:
      
       correct incorrect  %        Function                  File              Line
       ------- ---------  -        --------                  ----              ----
          2096        0   0 do_arch_prctl                  process_64.c         832
             0        0   X do_arch_prctl                  process_64.c         804
          2604        0   0 IS_ERR                         err.h                34
        130228     5765   4 __switch_to                    process_64.c         673
             0        0   X enable_TSC                     process_64.c         448
             0        0   X disable_TSC                    process_64.c         431
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bac28bfe
    • Steven Rostedt's avatar
      trace: consolidate unlikely and likely profiler · 45b79749
      Steven Rostedt authored
      Impact: clean up to make one profiler of like and unlikely tracer
      
      The likely and unlikely profiler prints out the file and line numbers
      of the annotated branches that it is profiling. It shows the number
      of times it was correct or incorrect in its guess. Having two
      different files or sections for that matter to tell us if it was a
      likely or unlikely is pretty pointless. We really only care if
      it was correct or not.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      45b79749