1. 30 Nov, 2018 1 commit
    • Steven Rostedt (VMware)'s avatar
      tracing/fgraph: Fix set_graph_function from showing interrupts · 5cf99a0f
      Steven Rostedt (VMware) authored
      The tracefs file set_graph_function is used to only function graph functions
      that are listed in that file (or all functions if the file is empty). The
      way this is implemented is that the function graph tracer looks at every
      function, and if the current depth is zero and the function matches
      something in the file then it will trace that function. When other functions
      are called, the depth will be greater than zero (because the original
      function will be at depth zero), and all functions will be traced where the
      depth is greater than zero.
      
      The issue is that when a function is first entered, and the handler that
      checks this logic is called, the depth is set to zero. If an interrupt comes
      in and a function in the interrupt handler is traced, its depth will be
      greater than zero and it will automatically be traced, even if the original
      function was not. But because the logic only looks at depth it may trace
      interrupts when it should not be.
      
      The recent design change of the function graph tracer to fix other bugs
      caused the depth to be zero while the function graph callback handler is
      being called for a longer time, widening the race of this happening. This
      bug was actually there for a longer time, but because the race window was so
      small it seldom happened. The Fixes tag below is for the commit that widen
      the race window, because that commit belongs to a series that will also help
      fix the original bug.
      
      Cc: stable@kernel.org
      Fixes: 39eb456d ("function_graph: Use new curr_ret_depth to manage depth instead of curr_ret_stack")
      Reported-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Tested-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      5cf99a0f
  2. 16 Aug, 2018 1 commit
  3. 10 Aug, 2018 1 commit
  4. 01 Aug, 2018 1 commit
  5. 26 Jul, 2018 2 commits
  6. 03 Jul, 2018 1 commit
  7. 29 May, 2018 4 commits
    • Steven Rostedt (VMware)'s avatar
      tracing: Add trigger file for trace_markers tracefs/ftrace/print · 3dd80953
      Steven Rostedt (VMware) authored
      Allow writing to the trace_markers file initiate triggers defined in
      tracefs/ftrace/print/trigger file. This will allow of user space to trigger
      the same type of triggers (including histograms) that the trace events use.
      
      Had to create a ftrace_event_register() function that will become the
      trace_marker print event's reg() function. This is required because of how
      triggers are enabled:
      
        event_trigger_write() {
          event_trigger_regex_write() {
            trigger_process_regex() {
              for p in trigger_commands {
                p->func(); /* trigger_snapshot_cmd->func */
                  event_trigger_callback() {
                    cmd_ops->reg() /* register_trigger() */ {
                      trace_event_trigger_enable_disable() {
                        trace_event_enable_disable() {
                          call->class->reg();
      
      Without the reg() function, the trigger code will call a NULL pointer and
      crash the system.
      
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Karim Yaghmour <karim.yaghmour@opersys.com>
      Cc: Brendan Gregg <bgregg@netflix.com>
      Suggested-by: default avatarJoel Fernandes <joelaf@google.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      3dd80953
    • Steven Rostedt (VMware)'s avatar
      tracing: Have event_trace_init() called by trace_init_tracefs() · 58b92547
      Steven Rostedt (VMware) authored
      Instead of having both trace_init_tracefs() and event_trace_init() be called
      by fs_initcall() routines, have event_trace_init() called directly by
      trace_init_tracefs(). This will guarantee order of how the events are
      created with respect to the rest of the ftrace infrastructure. This is
      needed to be able to assoctiate event files with ftrace internal events,
      such as the trace_marker.
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      58b92547
    • Steven Rostedt (VMware)'s avatar
      tracing: Add __find_event_file() to find event files without restrictions · 3c96529c
      Steven Rostedt (VMware) authored
      By adding the function __find_event_file() that can search for files without
      restrictions, such as if the event associated with the file has a reg
      function, or if it has the "ignore" flag set, the files that are associated
      to ftrace internal events (like trace_marker and function events) can be
      found and used.
      
      find_event_file() still returns a "filtered" file, as most callers need a
      valid trace event file. One created by the trace_events.h macros and not one
      created for parsing ftrace specific events.
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      3c96529c
    • Steven Rostedt (VMware)'s avatar
      tracing: Do not reference event data in post call triggers · c94e45bc
      Steven Rostedt (VMware) authored
      Trace event triggers can be called before or after the event has been
      committed. If it has been called after the commit, there's a possibility
      that the event no longer exists. Currently, the two post callers is the
      trigger to disable tracing (traceoff) and the one that will record a stack
      dump (stacktrace). Neither of them reference the trace event entry record,
      as that would lead to a race condition that could pass in corrupted data.
      
      To prevent any other users of the post data triggers from using the trace
      event record, pass in NULL to the post call trigger functions for the event
      record, as they should never need to use them in the first place.
      
      This does not fix any bug, but prevents bugs from happening by new post call
      trigger users.
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      c94e45bc
  8. 28 May, 2018 1 commit
    • Steven Rostedt (VMware)'s avatar
      tracing: Make the snapshot trigger work with instances · 2824f503
      Steven Rostedt (VMware) authored
      The snapshot trigger currently only affects the main ring buffer, even when
      it is used by the instances. This can be confusing as the snapshot trigger
      is listed in the instance.
      
       > # cd /sys/kernel/tracing
       > # mkdir instances/foo
       > # echo snapshot > instances/foo/events/syscalls/sys_enter_fchownat/trigger
       > # echo top buffer > trace_marker
       > # echo foo buffer > instances/foo/trace_marker
       > # touch /tmp/bar
       > # chown rostedt /tmp/bar
       > # cat instances/foo/snapshot
       # tracer: nop
       #
       #
       # * Snapshot is freed *
       #
       # Snapshot commands:
       # echo 0 > snapshot : Clears and frees snapshot buffer
       # echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
       #                      Takes a snapshot of the main buffer.
       # echo 2 > snapshot : Clears snapshot buffer (but does not allocate or free)
       #                      (Doesn't have to be '2' works with any number that
       #                       is not a '0' or '1')
      
       > # cat snapshot
       # tracer: nop
       #
       #                              _-----=> irqs-off
       #                             / _----=> need-resched
       #                            | / _---=> hardirq/softirq
       #                            || / _--=> preempt-depth
       #                            ||| /     delay
       #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
       #              | |       |   ||||       |         |
                   bash-1189  [000] ....   111.488323: tracing_mark_write: top buffer
      
      Not only did the snapshot occur in the top level buffer, but the instance
      snapshot buffer should have been allocated, and it is still free.
      
      Cc: stable@vger.kernel.org
      Fixes: 85f2b082 ("tracing: Add basic event trigger framework")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2824f503
  9. 14 Mar, 2018 1 commit
    • Steven Rostedt (VMware)'s avatar
      tracing: Rewrite filter logic to be simpler and faster · 80765597
      Steven Rostedt (VMware) authored
      Al Viro reviewed the filter logic of ftrace trace events and found it to be
      very troubling. It creates a binary tree based on the logic operators and
      walks it during tracing. He sent myself and Tom Zanussi a long explanation
      (and formal proof) of how to do the string parsing better and end up with a
      program array that can be simply iterated to come up with the correct
      results.
      
      I took his ideas and his pseudo code and rewrote the filter logic based on
      them. In doing so, I was able to remove a lot of code, and have a much more
      condensed filter logic in the process. I wrote a very long comment
      describing the methadology that Al proposed in my own words. For more info
      on how this works, read the comment above predicate_parse().
      Suggested-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      80765597
  10. 10 Mar, 2018 5 commits
  11. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 25 Oct, 2017 1 commit
    • Mark Rutland's avatar
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns... · 6aa7de05
      Mark Rutland authored
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
      
      Please do not apply this to mainline directly, instead please re-run the
      coccinelle script shown below and apply its output.
      
      For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
      preference to ACCESS_ONCE(), and new code is expected to use one of the
      former. So far, there's been no reason to change most existing uses of
      ACCESS_ONCE(), as these aren't harmful, and changing them results in
      churn.
      
      However, for some features, the read/write distinction is critical to
      correct operation. To distinguish these cases, separate read/write
      accessors must be used. This patch migrates (most) remaining
      ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
      coccinelle script:
      
      ----
      // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
      // WRITE_ONCE()
      
      // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
      
      virtual patch
      
      @ depends on patch @
      expression E1, E2;
      @@
      
      - ACCESS_ONCE(E1) = E2
      + WRITE_ONCE(E1, E2)
      
      @ depends on patch @
      expression E;
      @@
      
      - ACCESS_ONCE(E)
      + READ_ONCE(E)
      ----
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: davem@davemloft.net
      Cc: linux-arch@vger.kernel.org
      Cc: mpe@ellerman.id.au
      Cc: shuah@kernel.org
      Cc: snitzer@redhat.com
      Cc: thor.thayer@linux.intel.com
      Cc: tj@kernel.org
      Cc: viro@zeniv.linux.org.uk
      Cc: will.deacon@arm.com
      Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.comSigned-off-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
      6aa7de05
  13. 04 Oct, 2017 2 commits
  14. 19 Sep, 2017 1 commit
  15. 31 Aug, 2017 1 commit
    • Steven Rostedt (VMware)'s avatar
      tracing: Only have rmmod clear buffers that its events were active in · 065e63f9
      Steven Rostedt (VMware) authored
      Currently, when a module event is enabled, when that module is removed, it
      clears all ring buffers. This is to prevent another module from being loaded
      and having one of its trace event IDs from reusing a trace event ID of the
      removed module. This could cause undesirable effects as the trace event of
      the new module would be using its own processing algorithms to process raw
      data of another event. To prevent this, when a module is loaded, if any of
      its events have been used (signified by the WAS_ENABLED event call flag,
      which is never cleared), all ring buffers are cleared, just in case any one
      of them contains event data of the removed event.
      
      The problem is, there's no reason to clear all ring buffers if only one (or
      less than all of them) uses one of the events. Instead, only clear the ring
      buffers that recorded the events of a module that is being removed.
      
      To do this, instead of keeping the WAS_ENABLED flag with the trace event
      call, move it to the per instance (per ring buffer) event file descriptor.
      The event file descriptor maps each event to a separate ring buffer
      instance. Then when the module is removed, only the ring buffers that
      activated one of the module's events get cleared. The rest are not touched.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      065e63f9
  16. 20 Jul, 2017 1 commit
  17. 27 Jun, 2017 1 commit
    • Joel Fernandes's avatar
      tracing: Add support for recording tgid of tasks · d914ba37
      Joel Fernandes authored
      Inorder to support recording of tgid, the following changes are made:
      
      * Introduce a new API (tracing_record_taskinfo) to additionally record the tgid
        along with the task's comm at the same time. This has has the benefit of not
        setting trace_cmdline_save before all the information for a task is saved.
      * Add a new API tracing_record_taskinfo_sched_switch to record task information
        for 2 tasks at a time (previous and next) and use it from sched_switch probe.
      * Preserve the old API (tracing_record_cmdline) and create it as a wrapper
        around the new one so that existing callers aren't affected.
      * Reuse the existing sched_switch and sched_wakeup probes to record tgid
        information and add a new option 'record-tgid' to enable recording of tgid
      
      When record-tgid option isn't enabled to being with, we take care to make sure
      that there's isn't memory or runtime overhead.
      
      Link: http://lkml.kernel.org/r/20170627020155.5139-1-joelaf@google.com
      
      Cc: kernel-team@android.com
      Cc: Ingo Molnar <mingo@redhat.com>
      Tested-by: default avatarMichael Sartain <mikesart@gmail.com>
      Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      d914ba37
  18. 26 Jun, 2017 2 commits
    • Steven Rostedt (VMware)'s avatar
      ftrace: Have cached module filters be an active filter · 8c08f0d5
      Steven Rostedt (VMware) authored
      When a module filter is added to set_ftrace_filter, if the module is not
      loaded, it is cached. This should be considered an active filter, and
      function tracing should be filtered by this. That is, if a cached module
      filter is the only filter set, then no function tracing should be happening,
      as all the functions available will be filtered out.
      
      This makes sense, as the reason to add a cached module filter, is to trace
      the module when you load it. There shouldn't be any other tracing happening
      until then.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8c08f0d5
    • Steven Rostedt (VMware)'s avatar
      ftrace: Add :mod: caching infrastructure to trace_array · 673feb9d
      Steven Rostedt (VMware) authored
      This is the start of the infrastructure work to allow for tracing module
      functions before it is loaded.
      
      Currently the following command:
      
        # echo :mod:some-mod > set_ftrace_filter
      
      will enable tracing of all functions within the module "some-mod" if it is
      loaded. What we want, is if the module is not loaded, that line will be
      saved. When the module is loaded, then the "some-mod" will have that line
      executed on it, so that the functions within it starts being traced.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      673feb9d
  19. 13 Jun, 2017 2 commits
  20. 18 May, 2017 2 commits
    • Steven Rostedt (VMware)'s avatar
      ftrace: Remove #ifdef from code and add clear_ftrace_function_probes() stub · 8a49f3e0
      Steven Rostedt (VMware) authored
      No need to add ugly #ifdefs in the code. Having a standard stub file is much
      prettier.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8a49f3e0
    • Naveen N. Rao's avatar
      ftrace/instances: Clear function triggers when removing instances · a0e6369e
      Naveen N. Rao authored
      If instance directories are deleted while there are registered function
      triggers:
      
        # cd /sys/kernel/debug/tracing/instances
        # mkdir test
        # echo "schedule:enable_event:sched:sched_switch" > test/set_ftrace_filter
        # rmdir test
        Unable to handle kernel paging request for data at address 0x00000008
        Unable to handle kernel paging request for data at address 0x00000008
        Faulting instruction address: 0xc0000000021edde8
        Oops: Kernel access of bad area, sig: 11 [#1]
        SMP NR_CPUS=2048
        NUMA
        pSeries
        Modules linked in: iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc kvm iptable_filter fuse binfmt_misc pseries_rng rng_core vmx_crypto ib_iser rdma_cm iw_cm ib_cm ib_core libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c multipath virtio_net virtio_blk virtio_pci crc32c_vpmsum virtio_ring virtio
        CPU: 8 PID: 8694 Comm: rmdir Not tainted 4.11.0-nnr+ #113
        task: c0000000bab52800 task.stack: c0000000baba0000
        NIP: c0000000021edde8 LR: c0000000021f0590 CTR: c000000002119620
        REGS: c0000000baba3870 TRAP: 0300   Not tainted  (4.11.0-nnr+)
        MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>
          CR: 22002422  XER: 20000000
        CFAR: 00007fffabb725a8 DAR: 0000000000000008 DSISR: 40000000 SOFTE: 0
        GPR00: c00000000220f750 c0000000baba3af0 c000000003157e00 0000000000000000
        GPR04: 0000000000000040 00000000000000eb 0000000000000040 0000000000000000
        GPR08: 0000000000000000 0000000000000113 0000000000000000 c00000000305db98
        GPR12: c000000002119620 c00000000fd42c00 0000000000000000 0000000000000000
        GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
        GPR20: 0000000000000000 0000000000000000 c0000000bab52e90 0000000000000000
        GPR24: 0000000000000000 00000000000000eb 0000000000000040 c0000000baba3bb0
        GPR28: c00000009cb06eb0 c0000000bab52800 c00000009cb06eb0 c0000000baba3bb0
        NIP [c0000000021edde8] ring_buffer_lock_reserve+0x8/0x4e0
        LR [c0000000021f0590] trace_event_buffer_lock_reserve+0xe0/0x1a0
        Call Trace:
        [c0000000baba3af0] [c0000000021f96c8] trace_event_buffer_commit+0x1b8/0x280 (unreliable)
        [c0000000baba3b60] [c00000000220f750] trace_event_buffer_reserve+0x80/0xd0
        [c0000000baba3b90] [c0000000021196b8] trace_event_raw_event_sched_switch+0x98/0x180
        [c0000000baba3c10] [c0000000029d9980] __schedule+0x6e0/0xab0
        [c0000000baba3ce0] [c000000002122230] do_task_dead+0x70/0xc0
        [c0000000baba3d10] [c0000000020ea9c8] do_exit+0x828/0xd00
        [c0000000baba3dd0] [c0000000020eaf70] do_group_exit+0x60/0x100
        [c0000000baba3e10] [c0000000020eb034] SyS_exit_group+0x24/0x30
        [c0000000baba3e30] [c00000000200bcec] system_call+0x38/0x54
        Instruction dump:
        60000000 60420000 7d244b78 7f63db78 4bffaa09 393efff8 793e0020 39200000
        4bfffecc 60420000 3c4c00f7 3842a020 <81230008> 2f890000 409e02f0 a14d0008
        ---[ end trace b917b8985d0e650b ]---
        Unable to handle kernel paging request for data at address 0x00000008
        Faulting instruction address: 0xc0000000021edde8
        Unable to handle kernel paging request for data at address 0x00000008
        Faulting instruction address: 0xc0000000021edde8
        Faulting instruction address: 0xc0000000021edde8
      
      To address this, let's clear all registered function probes before
      deleting the ftrace instance.
      
      Link: http://lkml.kernel.org/r/c5f1ca624043690bd94642bb6bffd3f2fc504035.1494956770.git.naveen.n.rao@linux.vnet.ibm.comReported-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      a0e6369e
  21. 21 Apr, 2017 8 commits
    • Steven Rostedt (VMware)'s avatar
      tracing/ftrace: Allow for the traceonoff probe be unique to instances · 2290f2c5
      Steven Rostedt (VMware) authored
      Have the traceon/off function probe triggers affect only the instance they
      are set in. This required making the trace_on/off accessible for other files
      in the tracing directory.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2290f2c5
    • Steven Rostedt (VMware)'s avatar
      tracing/ftrace: Add a better way to pass data via the probe functions · 6e444319
      Steven Rostedt (VMware) authored
      With the redesign of the registration and execution of the function probes
      (triggers), data can now be passed from the setup of the probe to the probe
      callers that are specific to the trace_array it is on. Although, all probes
      still only affect the toplevel trace array, this change will allow for
      instances to have their own probes separated from other instances and the
      top array.
      
      That is, something like the stacktrace probe can be set to trace only in an
      instance and not the toplevel trace array. This isn't implement yet, but
      this change sets the ground work for the change.
      
      When a probe callback is triggered (someone writes the probe format into
      set_ftrace_filter), it calls register_ftrace_function_probe() passing in
      init_data that will be used to initialize the probe. Then for every matching
      function, register_ftrace_function_probe() will call the probe_ops->init()
      function with the init data that was passed to it, as well as an address to
      a place holder that is associated with the probe and the instance. The first
      occurrence will have a NULL in the pointer. The init() function will then
      initialize it. If other probes are added, or more functions are part of the
      probe, the place holder will be passed to the init() function with the place
      holder data that it was initialized to the last time.
      
      Then this place_holder is passed to each of the other probe_ops functions,
      where it can be used in the function callback. When the probe_ops free()
      function is called, it can be called either with the rip of the function
      that is being removed from the probe, or zero, indicating that there are no
      more functions attached to the probe, and the place holder is about to be
      freed. This gives the probe_ops a way to free the data it assigned to the
      place holder if it was allocade during the first init call.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6e444319
    • Steven Rostedt (VMware)'s avatar
      ftrace: Dynamically create the probe ftrace_ops for the trace_array · 7b60f3d8
      Steven Rostedt (VMware) authored
      In order to eventually have each trace_array instance have its own unique
      set of function probes (triggers), the trace array needs to hold the ops and
      the filters for the probes.
      
      This is the first step to accomplish this. Instead of having the private
      data of the probe ops point to the trace_array, create a separate list that
      the trace_array holds. There's only one private_data for a probe, we need
      one per trace_array. The probe ftrace_ops will be dynamically created for
      each instance, instead of being static.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      7b60f3d8
    • Steven Rostedt (VMware)'s avatar
      tracing: Pass the trace_array into ftrace_probe_ops functions · b5f081b5
      Steven Rostedt (VMware) authored
      Pass the trace_array associated to a ftrace_probe_ops into the probe_ops
      func(), init() and free() functions. The trace_array is the descriptor that
      describes a tracing instance. This will help create the infrastructure that
      will allow having function probes unique to tracing instances.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      b5f081b5
    • Steven Rostedt (VMware)'s avatar
      tracing: Have the trace_array hold the list of registered func probes · 04ec7bb6
      Steven Rostedt (VMware) authored
      Add a link list to the trace_array to hold func probes that are registered.
      Currently, all function probes are the same for all instances as it was
      before, that is, only the top level trace_array holds the function probes.
      But this lays the ground work to have function probes be attached to
      individual instances, and having the event trigger only affect events in the
      given instance. But that work is still to be done.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      04ec7bb6
    • Steven Rostedt (VMware)'s avatar
      ftrace: Have the function probes call their own function · eee8ded1
      Steven Rostedt (VMware) authored
      Now that the function probes have their own ftrace_ops, there's no reason to
      continue using the ftrace_func_hash to find which probe to call in the
      function callback. The ops that is passed in to the function callback is
      part of the probe_ops to call.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      eee8ded1
    • Steven Rostedt (VMware)'s avatar
      ftrace: Have each function probe use its own ftrace_ops · 1ec3a81a
      Steven Rostedt (VMware) authored
      Have the function probes have their own ftrace_ops, and remove the
      trace_probe_ops. This simplifies some of the ftrace infrastructure code.
      
      Individual entries for each function is still allocated for the use of the
      output for set_ftrace_filter, but they will be removed soon too.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      1ec3a81a
    • Steven Rostedt (VMware)'s avatar
      ftrace: Have unregister_ftrace_function_probe_func() return a value · d3d532d7
      Steven Rostedt (VMware) authored
      Currently unregister_ftrace_function_probe_func() is a void function. It
      does not give any feedback if an error occurred or no item was found to
      remove and nothing was done.
      
      Change it to return status and success if it removed something. Also update
      the callers to return that feedback to the user.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      d3d532d7