1. 09 9月, 2017 1 次提交
  2. 09 12月, 2016 2 次提交
    • S
      tracing/fgraph: Have wakeup and irqsoff tracers ignore graph functions too · 1a414428
      Steven Rostedt (Red Hat) 提交于
      Currently both the wakeup and irqsoff traces do not handle set_graph_notrace
      well. The ftrace infrastructure will ignore the return paths of all
      functions leaving them hanging without an end:
      
        # echo '*spin*' > set_graph_notrace
        # cat trace
        [...]
                _raw_spin_lock() {
                  preempt_count_add() {
                  do_raw_spin_lock() {
                update_rq_clock();
      
      Where the '*spin*' functions should have looked like this:
      
                _raw_spin_lock() {
                  preempt_count_add();
                  do_raw_spin_lock();
                }
                update_rq_clock();
      
      Instead, have the wakeup and irqsoff tracers ignore the functions that are
      set by the set_graph_notrace like the function_graph tracer does. Move
      the logic in the function_graph tracer into a header to allow wakeup and
      irqsoff tracers to use it as well.
      
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      1a414428
    • S
      fgraph: Handle a case where a tracer ignores set_graph_notrace · 794de08a
      Steven Rostedt (Red Hat) 提交于
      Both the wakeup and irqsoff tracers can use the function graph tracer when
      the display-graph option is set. The problem is that they ignore the notrace
      file, and record the entry of functions that would be ignored by the
      function_graph tracer. This causes the trace->depth to be recorded into the
      ring buffer. The set_graph_notrace uses a trick by adding a large negative
      number to the trace->depth when a graph function is to be ignored.
      
      On trace output, the graph function uses the depth to record a stack of
      functions. But since the depth is negative, it accesses the array with a
      negative number and causes an out of bounds access that can cause a kernel
      oops or corrupt data.
      
      Have the print functions handle cases where a tracer still records functions
      even when they are in set_graph_notrace.
      
      Also add warnings if the depth is below zero before accessing the array.
      
      Note, the function graph logic will still prevent the return of these
      functions from being recorded, which means that they will be left hanging
      without a return. For example:
      
         # echo '*spin*' > set_graph_notrace
         # echo 1 > options/display-graph
         # echo wakeup > current_tracer
         # cat trace
         [...]
            _raw_spin_lock() {
              preempt_count_add() {
              do_raw_spin_lock() {
            update_rq_clock();
      
      Where it should look like:
      
            _raw_spin_lock() {
              preempt_count_add();
              do_raw_spin_lock();
            }
            update_rq_clock();
      
      Cc: stable@vger.kernel.org
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Fixes: 29ad23b0 ("ftrace: Add set_graph_notrace filter")
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      794de08a
  3. 24 11月, 2016 1 次提交
  4. 02 9月, 2016 1 次提交
  5. 01 9月, 2016 1 次提交
    • N
      function_graph: Handle TRACE_BPUTS in print_graph_comment · 613dccdf
      Namhyung Kim 提交于
      It missed to handle TRACE_BPUTS so messages recorded by trace_bputs()
      will be shown with symbol info unnecessarily.
      
      You can see it with the trace_printk sample code:
      
        # cd /sys/kernel/tracing/
        # echo sys_sync > set_graph_function
        # echo 1 > options/sym-offset
        # echo function_graph > current_tracer
      
      Note that the sys_sync filter was there to prevent recording other
      functions and the sym-offset option was needed since the first message
      was called from a module init function so kallsyms doesn't have the
      symbol and omitted in the output.
      
        # cd ~/build/kernel
        # insmod samples/trace_printk/trace-printk.ko
      
        # cd -
        # head trace
      
      Before:
      
        # tracer: function_graph
        #
        # CPU  DURATION                  FUNCTION CALLS
        # |     |   |                     |   |   |   |
         1)               |  /* 0xffffffffa0002000: This is a static string that will use trace_bputs */
         1)               |  /* This is a dynamic string that will use trace_puts */
         1)               |  /* trace_printk_irq_work+0x5/0x7b [trace_printk]: (irq) This is a static string that will use trace_bputs */
         1)               |  /* (irq) This is a dynamic string that will use trace_puts */
         1)               |  /* (irq) This is a static string that will use trace_bprintk() */
         1)               |  /* (irq) This is a dynamic string that will use trace_printk */
      
      After:
      
        # tracer: function_graph
        #
        # CPU  DURATION                  FUNCTION CALLS
        # |     |   |                     |   |   |   |
         1)               |  /* This is a static string that will use trace_bputs */
         1)               |  /* This is a dynamic string that will use trace_puts */
         1)               |  /* (irq) This is a static string that will use trace_bputs */
         1)               |  /* (irq) This is a dynamic string that will use trace_puts */
         1)               |  /* (irq) This is a static string that will use trace_bprintk() */
         1)               |  /* (irq) This is a dynamic string that will use trace_printk */
      
      Link: http://lkml.kernel.org/r/20160901024354.13720-1-namhyung@kernel.orgSigned-off-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      613dccdf
  6. 24 8月, 2016 4 次提交
  7. 28 6月, 2016 1 次提交
  8. 20 6月, 2016 1 次提交
  9. 26 3月, 2016 1 次提交
  10. 23 3月, 2016 1 次提交
  11. 08 11月, 2015 1 次提交
  12. 01 10月, 2015 2 次提交
    • S
      tracing: Move trace_flags from global to a trace_array field · 983f938a
      Steven Rostedt (Red Hat) 提交于
      In preparation to make trace options per instance, the global trace_flags
      needs to be moved from being a global variable to a field within the trace
      instance trace_array structure.
      
      There's still more work to do, as there's some functions that use
      trace_flags without passing in a way to get to the current_trace array. For
      those, the global_trace is used directly (from trace.c). This includes
      setting and clearing the trace_flags. This means that when a new instance is
      created, it just gets the trace_flags of the global_trace and will not be
      able to modify them. Depending on the functions that have access to the
      trace_array, the flags of an instance may not affect parts of its trace,
      where the global_trace is used. These will be fixed in future changes.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      983f938a
    • S
      tracing: Move sleep-time and graph-time options out of the core trace_flags · 55577204
      Steven Rostedt (Red Hat) 提交于
      The sleep-time and graph-time options are only for the function graph tracer
      and are not used by anything else. As tracer options are now visible when
      the tracer is not activated, its better to move the function graph specific
      tracer options into the function graph tracer.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      55577204
  13. 21 7月, 2015 1 次提交
  14. 14 5月, 2015 2 次提交
  15. 16 4月, 2015 1 次提交
    • R
      tracing: Handle ftrace_dump() atomic context in graph_trace_open() · ef99b88b
      Rabin Vincent 提交于
      graph_trace_open() can be called in atomic context from ftrace_dump().
      Use GFP_ATOMIC for the memory allocations when that's the case, in order
      to avoid the following splat.
      
       BUG: sleeping function called from invalid context at mm/slab.c:2849
       in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0
       Backtrace:
       ..
       [<8004dc94>] (__might_sleep) from [<801371f4>] (kmem_cache_alloc_trace+0x160/0x238)
        r7:87800040 r6:000080d0 r5:810d16e8 r4:000080d0
       [<80137094>] (kmem_cache_alloc_trace) from [<800cbd60>] (graph_trace_open+0x30/0xd0)
        r10:00000100 r9:809171a8 r8:00008e28 r7:810d16f0 r6:00000001 r5:810d16e8
        r4:810d16f0
       [<800cbd30>] (graph_trace_open) from [<800c79c4>] (trace_init_global_iter+0x50/0x9c)
        r8:00008e28 r7:808c853c r6:00000001 r5:810d16e8 r4:810d16f0 r3:800cbd30
       [<800c7974>] (trace_init_global_iter) from [<800c7aa0>] (ftrace_dump+0x90/0x2ec)
        r4:810d2580 r3:00000000
       [<800c7a10>] (ftrace_dump) from [<80414b2c>] (sysrq_ftrace_dump+0x1c/0x20)
        r10:00000100 r9:809171a8 r8:808f6e7c r7:00000001 r6:00000007 r5:0000007a
        r4:808d5394
       [<80414b10>] (sysrq_ftrace_dump) from [<800169b8>] (return_to_handler+0x0/0x18)
       [<80415498>] (__handle_sysrq) from [<800169b8>] (return_to_handler+0x0/0x18)
        r8:808c8100 r7:808c8444 r6:00000101 r5:00000010 r4:84eb3210
       [<80415668>] (handle_sysrq) from [<800169b8>] (return_to_handler+0x0/0x18)
       [<8042a760>] (pl011_int) from [<800169b8>] (return_to_handler+0x0/0x18)
        r10:809171bc r9:809171a8 r8:00000001 r7:00000026 r6:808c6000 r5:84f01e60
        r4:8454fe00
       [<8007782c>] (handle_irq_event_percpu) from [<80077b44>] (handle_irq_event+0x4c/0x6c)
        r10:808c7ef0 r9:87283e00 r8:00000001 r7:00000000 r6:8454fe00 r5:84f01e60
        r4:84f01e00
       [<80077af8>] (handle_irq_event) from [<8007aa28>] (handle_fasteoi_irq+0xf0/0x1ac)
        r6:808f52a4 r5:84f01e60 r4:84f01e00 r3:00000000
       [<8007a938>] (handle_fasteoi_irq) from [<80076dc0>] (generic_handle_irq+0x3c/0x4c)
        r6:00000026 r5:00000000 r4:00000026 r3:8007a938
       [<80076d84>] (generic_handle_irq) from [<80077128>] (__handle_domain_irq+0x8c/0xfc)
        r4:808c1e38 r3:0000002e
       [<8007709c>] (__handle_domain_irq) from [<800087b8>] (gic_handle_irq+0x34/0x6c)
        r10:80917748 r9:00000001 r8:88802100 r7:808c7ef0 r6:808c8fb0 r5:00000015
        r4:8880210c r3:808c7ef0
       [<80008784>] (gic_handle_irq) from [<80014044>] (__irq_svc+0x44/0x7c)
      
      Link: http://lkml.kernel.org/r/1428953721-31349-1-git-send-email-rabin@rab.in
      Link: http://lkml.kernel.org/r/1428957012-2319-1-git-send-email-rabin@rab.in
      
      Cc: stable@vger.kernel.org # 3.13+
      Signed-off-by: NRabin Vincent <rabin@rab.in>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      ef99b88b
  16. 04 2月, 2015 1 次提交
    • S
      tracing: Convert the tracing facility over to use tracefs · 8434dc93
      Steven Rostedt (Red Hat) 提交于
      debugfs was fine for the tracing facility as a quick way to get
      an interface. Now that tracing has matured, it should separate itself
      from debugfs such that it can be mounted separately without needing
      to mount all of debugfs with it. That is, users resist using tracing
      because it requires mounting debugfs. Having tracing have its own file
      system lets users get the features of tracing without needing to bring
      in the rest of the kernel's debug infrastructure.
      
      Another reason for tracefs is that debubfs does not support mkdir.
      Currently, to create instances, one does a mkdir in the tracing/instance
      directory. This is implemented via a hack that forces debugfs to do
      something it is not intended on doing. By converting over to tracefs, this
      hack can be removed and mkdir can be properly implemented. This patch does
      not address this yet, but it lays the ground work for that to be done.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8434dc93
  17. 23 1月, 2015 1 次提交
  18. 04 12月, 2014 1 次提交
    • B
      tracing: Add additional marks to signal very large time deltas · 8e1e1df2
      Byungchul Park 提交于
      Currently, function graph tracer prints "!" or "+" just before
      function execution time to signal a function overhead, depending
      on the time. And some tracers tracing latency also print "!" or
      "+" just after time to signal overhead, depending on the interval
      between events. Even it is usually enough to do that, we sometimes
      need to signal for bigger execution time than 100 micro seconds.
      
      For example, I used function graph tracer to detect if there is
      any case that exit_mm() takes too much time. I did following steps
      in /sys/kernel/debug/tracing. It was easier to detect very large
      excution time with patched kernel than with original kernel.
      
      $ echo exit_mm > set_graph_function
      $ echo function_graph > current_tracer
      $ echo > trace
      $ cat trace_pipe > $LOGFILE
       ... (do something and terminate logging)
      $ grep "\\$" $LOGFILE
       3) $ 22082032 us |                      } /* kernel_map_pages */
       3) $ 22082040 us |                    } /* free_pages_prepare */
       3) $ 22082113 us |                  } /* free_hot_cold_page */
       3) $ 22083455 us |                } /* free_hot_cold_page_list */
       3) $ 22083895 us |              } /* release_pages */
       3) $ 22177873 us |            } /* free_pages_and_swap_cache */
       3) $ 22178929 us |          } /* unmap_single_vma */
       3) $ 22198885 us |        } /* unmap_vmas */
       3) $ 22206949 us |      } /* exit_mmap */
       3) $ 22207659 us |    } /* mmput */
       3) $ 22207793 us |  } /* exit_mm */
      
      And then, it was easy to find out that a schedule-out occured by
      sub_preempt_count() within kernel_map_pages().
      
      To detect very large function exection time caused by either problematic
      function implementation or scheduling issues, this patch can be useful.
      
      Link: http://lkml.kernel.org/r/1416789259-24038-1-git-send-email-byungchul.park@lge.comSigned-off-by: NByungchul Park <byungchul.park@lge.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8e1e1df2
  19. 20 11月, 2014 3 次提交
  20. 14 11月, 2014 4 次提交
  21. 19 7月, 2014 3 次提交
  22. 17 7月, 2014 1 次提交
    • S
      ftrace-graph: Remove dependency of ftrace_stop() from ftrace_graph_stop() · 1b2f121c
      Steven Rostedt (Red Hat) 提交于
      ftrace_stop() is going away as it disables parts of function tracing
      that affects users that should not be affected. But ftrace_graph_stop()
      is built on ftrace_stop(). Here's another example of killing all of
      function tracing because something went wrong with function graph
      tracing.
      
      Instead of disabling all users of function tracing on function graph
      error, disable only function graph tracing.
      
      A new function is created called ftrace_graph_is_dead(). This is called
      in strategic paths to prevent function graph from doing more harm and
      allowing at least a warning to be printed before the system crashes.
      
      NOTE: ftrace_stop() is still used until all the archs are converted over
      to use ftrace_graph_is_dead(). After that, ftrace_stop() will be removed.
      Reviewed-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      1b2f121c
  23. 21 5月, 2014 2 次提交
  24. 30 4月, 2014 1 次提交
  25. 21 2月, 2014 1 次提交
  26. 07 11月, 2013 1 次提交
    • S
      tracing: Do not use signed enums with unsigned long long in fgragh output · 6fc84ea7
      Steven Rostedt (Red Hat) 提交于
      The duration field of print_graph_duration() can also be used
      to do the space filling by passing an enum in it:
      
        DURATION_FILL_FULL
        DURATION_FILL_START
        DURATION_FILL_END
      
      The problem is that these are enums and defined as negative,
      but the duration field is unsigned long long. Most archs are
      fine with this but blackfin fails to compile because of it:
      
      kernel/built-in.o: In function `print_graph_duration':
      kernel/trace/trace_functions_graph.c:782: undefined reference to `__ucmpdi2'
      
      Overloading a unsigned long long with an signed enum is just
      bad in principle. We can accomplish the same thing by using
      part of the flags field instead.
      
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      6fc84ea7