1. 10 Dec, 2019 2 commits
  2. 04 Dec, 2019 1 commit
    • Steven Rostedt (VMware)'s avatar
      tracing: Do not create directories if lockdown is in affect · a356646a
      Steven Rostedt (VMware) authored
      If lockdown is disabling tracing on boot up, it prevents the tracing files
      from even bering created. But when that happens, there's several places that
      will give a warning that the files were not created as that is usually a
      sign of a bug.
      
      Add in strategic locations where a check is made to see if tracing is
      disabled by lockdown, and if it is, do not go further, and fail silently
      (but print that tracing is disabled by lockdown, without doing a WARN_ON()).
      
      Cc: Matthew Garrett <mjg59@google.com>
      Fixes: 17911ff3 ("tracing: Add locked_down checks to the open calls of files created for tracefs")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      a356646a
  3. 02 Dec, 2019 1 commit
    • Cong Wang's avatar
      tracing: Introduce trace event injection · 6c3edaf9
      Cong Wang authored
      We have been trying to use rasdaemon to monitor hardware errors like
      correctable memory errors. rasdaemon uses trace events to monitor
      various hardware errors. In order to test it, we have to inject some
      hardware errors, unfortunately not all of them provide error
      injections. MCE does provide a way to inject MCE errors, but errors
      like PCI error and devlink error don't, it is not easy to add error
      injection to each of them. Instead, it is relatively easier to just
      allow users to inject trace events in a generic way so that all trace
      events can be injected.
      
      This patch introduces trace event injection, where a new 'inject' is
      added to each tracepoint directory. Users could write into this file
      with key=value pairs to specify the value of each fields of the trace
      event, all unspecified fields are set to zero values by default.
      
      For example, for the net/net_dev_queue tracepoint, we can inject:
      
        INJECT=/sys/kernel/debug/tracing/events/net/net_dev_queue/inject
        echo "" > $INJECT
        echo "name='test'" > $INJECT
        echo "name='test' len=1024" > $INJECT
        cat /sys/kernel/debug/tracing/trace
        ...
         <...>-614   [000] ....    36.571483: net_dev_queue: dev= skbaddr=00000000fbf338c2 len=0
         <...>-614   [001] ....   136.588252: net_dev_queue: dev=test skbaddr=00000000fbf338c2 len=0
         <...>-614   [001] .N..   208.431878: net_dev_queue: dev=test skbaddr=00000000fbf338c2 len=1024
      
      Triggers could be triggered as usual too:
      
        echo "stacktrace if len == 1025" > /sys/kernel/debug/tracing/events/net/net_dev_queue/trigger
        echo "len=1025" > $INJECT
        cat /sys/kernel/debug/tracing/trace
        ...
            bash-614   [000] ....    36.571483: net_dev_queue: dev= skbaddr=00000000fbf338c2 len=0
            bash-614   [001] ....   136.588252: net_dev_queue: dev=test skbaddr=00000000fbf338c2 len=0
            bash-614   [001] .N..   208.431878: net_dev_queue: dev=test skbaddr=00000000fbf338c2 len=1024
            bash-614   [001] .N.1   284.236349: <stack trace>
       => event_inject_write
       => vfs_write
       => ksys_write
       => do_syscall_64
       => entry_SYSCALL_64_after_hwframe
      
      The only thing that can't be injected is string pointers as they
      require constant string pointers, this can't be done at run time.
      
      Link: http://lkml.kernel.org/r/20191130045218.18979-1-xiyou.wangcong@gmail.com
      
      Cc: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6c3edaf9
  4. 26 Nov, 2019 1 commit
  5. 23 Nov, 2019 7 commits
  6. 20 Nov, 2019 1 commit
  7. 18 Nov, 2019 2 commits
  8. 15 Nov, 2019 8 commits
  9. 14 Nov, 2019 11 commits
  10. 13 Nov, 2019 6 commits
    • Divya Indi's avatar
      tracing: Adding NULL checks for trace_array descriptor pointer · 953ae45a
      Divya Indi authored
      As part of commit f45d1225 ("tracing: Kernel access to Ftrace
      instances") we exported certain functions. Here, we are adding some additional
      NULL checks to ensure safe usage by users of these APIs.
      
      Link: http://lkml.kernel.org/r/1565805327-579-4-git-send-email-divya.indi@oracle.comSigned-off-by: default avatarDivya Indi <divya.indi@oracle.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      953ae45a
    • Divya Indi's avatar
      tracing: Verify if trace array exists before destroying it. · e585e646
      Divya Indi authored
      A trace array can be destroyed from userspace or kernel. Verify if the
      trace array exists before proceeding to destroy/remove it.
      
      Link: http://lkml.kernel.org/r/1565805327-579-3-git-send-email-divya.indi@oracle.comReviewed-by: default avatarAruna Ramakrishna <aruna.ramakrishna@oracle.com>
      Signed-off-by: default avatarDivya Indi <divya.indi@oracle.com>
      [ Removed unneeded braces ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      e585e646
    • Divya Indi's avatar
      tracing: Declare newly exported APIs in include/linux/trace.h · 2d6425af
      Divya Indi authored
      Declare the newly introduced and exported APIs in the header file -
      include/linux/trace.h. Moving previous declarations from
      kernel/trace/trace.h to include/linux/trace.h.
      
      Link: http://lkml.kernel.org/r/1565805327-579-2-git-send-email-divya.indi@oracle.comSigned-off-by: default avatarDivya Indi <divya.indi@oracle.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2d6425af
    • Ben Dooks's avatar
      tracing: Make internal ftrace events static · 6dff4d7d
      Ben Dooks authored
      The event_class_ftrace_##call and event_##call do not seem
      to be used outside of trace_export.c so make them both static
      to avoid a number of sparse warnings:
      
      kernel/trace/trace_entries.h:59:1: warning: symbol 'event_class_ftrace_function' was not declared. Should it be static?
      kernel/trace/trace_entries.h:59:1: warning: symbol '__event_function' was not declared. Should it be static?
      kernel/trace/trace_entries.h:77:1: warning: symbol 'event_class_ftrace_funcgraph_entry' was not declared. Should it be static?
      kernel/trace/trace_entries.h:77:1: warning: symbol '__event_funcgraph_entry' was not declared. Should it be static?
      kernel/trace/trace_entries.h:93:1: warning: symbol 'event_class_ftrace_funcgraph_exit' was not declared. Should it be static?
      kernel/trace/trace_entries.h:93:1: warning: symbol '__event_funcgraph_exit' was not declared. Should it be static?
      kernel/trace/trace_entries.h:129:1: warning: symbol 'event_class_ftrace_context_switch' was not declared. Should it be static?
      kernel/trace/trace_entries.h:129:1: warning: symbol '__event_context_switch' was not declared. Should it be static?
      kernel/trace/trace_entries.h:149:1: warning: symbol 'event_class_ftrace_wakeup' was not declared. Should it be static?
      kernel/trace/trace_entries.h:149:1: warning: symbol '__event_wakeup' was not declared. Should it be static?
      kernel/trace/trace_entries.h:171:1: warning: symbol 'event_class_ftrace_kernel_stack' was not declared. Should it be static?
      kernel/trace/trace_entries.h:171:1: warning: symbol '__event_kernel_stack' was not declared. Should it be static?
      kernel/trace/trace_entries.h:191:1: warning: symbol 'event_class_ftrace_user_stack' was not declared. Should it be static?
      kernel/trace/trace_entries.h:191:1: warning: symbol '__event_user_stack' was not declared. Should it be static?
      kernel/trace/trace_entries.h:214:1: warning: symbol 'event_class_ftrace_bprint' was not declared. Should it be static?
      kernel/trace/trace_entries.h:214:1: warning: symbol '__event_bprint' was not declared. Should it be static?
      kernel/trace/trace_entries.h:230:1: warning: symbol 'event_class_ftrace_print' was not declared. Should it be static?
      kernel/trace/trace_entries.h:230:1: warning: symbol '__event_print' was not declared. Should it be static?
      kernel/trace/trace_entries.h:247:1: warning: symbol 'event_class_ftrace_raw_data' was not declared. Should it be static?
      kernel/trace/trace_entries.h:247:1: warning: symbol '__event_raw_data' was not declared. Should it be static?
      kernel/trace/trace_entries.h:262:1: warning: symbol 'event_class_ftrace_bputs' was not declared. Should it be static?
      kernel/trace/trace_entries.h:262:1: warning: symbol '__event_bputs' was not declared. Should it be static?
      kernel/trace/trace_entries.h:277:1: warning: symbol 'event_class_ftrace_mmiotrace_rw' was not declared. Should it be static?
      kernel/trace/trace_entries.h:277:1: warning: symbol '__event_mmiotrace_rw' was not declared. Should it be static?
      kernel/trace/trace_entries.h:298:1: warning: symbol 'event_class_ftrace_mmiotrace_map' was not declared. Should it be static?
      kernel/trace/trace_entries.h:298:1: warning: symbol '__event_mmiotrace_map' was not declared. Should it be static?
      kernel/trace/trace_entries.h:322:1: warning: symbol 'event_class_ftrace_branch' was not declared. Should it be static?
      kernel/trace/trace_entries.h:322:1: warning: symbol '__event_branch' was not declared. Should it be static?
      kernel/trace/trace_entries.h:343:1: warning: symbol 'event_class_ftrace_hwlat' was not declared. Should it be static?
      kernel/trace/trace_entries.h:343:1: warning: symbol '__event_hwlat' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191015121012.18824-1-ben.dooks@codethink.co.ukSigned-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6dff4d7d
    • Sebastian Andrzej Siewior's avatar
      tracing: Use CONFIG_PREEMPTION · 9c34fc4b
      Sebastian Andrzej Siewior authored
      CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT.
      Both PREEMPT and PREEMPT_RT require the same functionality which today
      depends on CONFIG_PREEMPT.
      
      Add additional header output for PREEMPT_RT.
      Link: http://lkml.kernel.org/r/20191015191821.11479-34-bigeasy@linutronix.de
      
      Cc: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      9c34fc4b
    • Viktor Rosendahl (BMW)'s avatar
      preemptirq_delay_test: Add the burst feature and a sysfs trigger · 79393723
      Viktor Rosendahl (BMW) authored
      This burst feature enables the user to generate a burst of
      preempt/irqsoff latencies. This makes it possible to test whether we
      are able to detect latencies that systematically occur very close to
      each other.
      
      The maximum burst size is 10. We also create 10 identical test
      functions, so that we get 10 different backtraces; this is useful
      when we want to test whether we can detect all the latencies in a
      burst. Otherwise, there would be no easy way of differentiating
      between which latency in a burst was captured by the tracer.
      
      In addition, there is a sysfs trigger, so that it's not necessary to
      reload the module to repeat the test. The trigger will appear as
      /sys/kernel/preemptirq_delay_test/trigger in sysfs.
      
      Link: http://lkml.kernel.org/r/20191008220824.7911-3-viktor.rosendahl@gmail.comReviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarViktor Rosendahl (BMW) <viktor.rosendahl@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      79393723