Skip to content
  1. Aug 04, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing / histogram: Give calculation hist_fields a size · 2c05caa7
      Steven Rostedt (VMware) authored
      When working on my user space applications, I found a bug in the synthetic
      event code where the automated synthetic event field was not matching the
      event field calculation it was attached to. Looking deeper into it, it was
      because the calculation hist_field was not given a size.
      
      The synthetic event fields are matched to their hist_fields either by
      having the field have an identical string type, or if that does not match,
      then the size and signed values are used to match the fields.
      
      The problem arose when I tried to match a calculation where the fields
      were "unsigned int". My tool created a synthetic event of type "u32". But
      it failed to match. The string was:
      
        diff=field1-field2:onmatch(event).trace(synth,$diff)
      
      Adding debugging into the kernel, I found that the size of "diff" was 0.
      And since it was given "unsigned int" as a type, the histogram fallback
      code used size and signed. The signed matched, but the size of u32 (4) did
      not match zero, and the event failed to be created.
      
      This can be worse if the field you want to match is not one of the
      acceptable fields for a synthetic event. As event fields can have any type
      that is supported in Linux, this can cause an issue. For example, if a
      type is an enum. Then there's no way to use that with any calculations.
      
      Have the calculation field simply take on the size of what it is
      calculating.
      
      Link: https://lkml.kernel.org/r/20210730171951.59c7743f@oasis.local.home
      
      
      
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Fixes: 100719dc ("tracing: Add simple expression support to hist triggers")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2c05caa7
  2. Jul 23, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing/histogram: Rename "cpu" to "common_cpu" · 1e3bac71
      Steven Rostedt (VMware) authored
      Currently the histogram logic allows the user to write "cpu" in as an
      event field, and it will record the CPU that the event happened on.
      
      The problem with this is that there's a lot of events that have "cpu"
      as a real field, and using "cpu" as the CPU it ran on, makes it
      impossible to run histograms on the "cpu" field of events.
      
      For example, if I want to have a histogram on the count of the
      workqueue_queue_work event on its cpu field, running:
      
       ># echo 'hist:keys=cpu' > events/workqueue/workqueue_queue_work/trigger
      
      Gives a misleading and wrong result.
      
      Change the command to "common_cpu" as no event should have "common_*"
      fields as that's a reserved name for fields used by all events. And
      this makes sense here as common_cpu would be a field used by all events.
      
      Now we can even do:
      
       ># echo 'hist:keys=common_cpu,cpu if cpu < 100' > events/workqueue/workqueue_queue_work/trigger
       ># cat events/workqueue/workqueue_queue_work/hist
       # event histogram
       #
       # trigger info: hist:keys=common_cpu,cpu:vals=hitcount:sort=hitcount:size=2048 if cpu < 100 [active]
       #
      
       { common_cpu:          0, cpu:          2 } hitcount:          1
       { common_cpu:          0, cpu:          4 } hitcount:          1
       { common_cpu:          7, cpu:          7 } hitcount:          1
       { common_cpu:          0, cpu:          7 } hitcount:          1
       { common_cpu:          0, cpu:          1 } hitcount:          1
       { common_cpu:          0, cpu:          6 } hitcount:          2
       { common_cpu:          0, cpu:          5 } hitcount:          2
       { common_cpu:          1, cpu:          1 } hitcount:          4
       { common_cpu:          6, cpu:          6 } hitcount:          4
       { common_cpu:          5, cpu:          5 } hitcount:         14
       { common_cpu:          4, cpu:          4 } hitcount:         26
       { common_cpu:          0, cpu:          0 } hitcount:         39
       { common_cpu:          2, cpu:          2 } hitcount:        184
      
      Now for backward compatibility, I added a trick. If "cpu" is used, and
      the field is not found, it will fall back to "common_cpu" and work as
      it did before. This way, it will still work for old programs that use
      "cpu" to get the actual CPU, but if the event has a "cpu" as a field, it
      will get that event's "cpu" field, which is probably what it wants
      anyway.
      
      I updated the tracefs/README to include documentation about both the
      common_timestamp and the common_cpu. This way, if that text is present in
      the README, then an application can know that common_cpu is supported over
      just plain "cpu".
      
      Link: https://lkml.kernel.org/r/20210721110053.26b4f641@oasis.local.home
      
      
      
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Fixes: 8b7622bf ("tracing: Add cpu field for hist triggers")
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      1e3bac71
  3. Jul 15, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing: Do not reference char * as a string in histograms · 704adfb5
      Steven Rostedt (VMware) authored
      The histogram logic was allowing events with char * pointers to be used as
      normal strings. But it was easy to crash the kernel with:
      
       # echo 'hist:keys=filename' > events/syscalls/sys_enter_openat/trigger
      
      And open some files, and boom!
      
       BUG: unable to handle page fault for address: 00007f2ced0c3280
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 1173fa067 P4D 1173fa067 PUD 1171b6067 PMD 1171dd067 PTE 0
       Oops: 0000 [#1] PREEMPT SMP
       CPU: 6 PID: 1810 Comm: cat Not tainted 5.13.0-rc5-test+ #61
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01
      v03.03 07/14/2016
       RIP: 0010:strlen+0x0/0x20
       Code: f6 82 80 2a 0b a9 20 74 11 0f b6 50 01 48 83 c0 01 f6 82 80 2a 0b
      a9 20 75 ef c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 <80> 3f 00 74
      10 48 89 f8 48 83 c0 01 80 38 00 75 f7 48 29 f8 c3
      
       RSP: 0018:ffffbdbf81567b50 EFLAGS: 00010246
       RAX: 0000000000000003 RBX: ffff93815cdb3800 RCX: ffff9382401a22d0
       RDX: 0000000000000100 RSI: 0000000000000000 RDI: 00007f2ced0c3280
       RBP: 0000000000000100 R08: ffff9382409ff074 R09: ffffbdbf81567c98
       R10: ffff9382409ff074 R11: 0000000000000000 R12: ffff9382409ff074
       R13: 0000000000000001 R14: ffff93815a744f00 R15: 00007f2ced0c3280
       FS:  00007f2ced0f8580(0000) GS:ffff93825a800000(0000)
      knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007f2ced0c3280 CR3: 0000000107069005 CR4: 00000000001706e0
       Call Trace:
        event_hist_trigger+0x463/0x5f0
        ? find_held_lock+0x32/0x90
        ? sched_clock_cpu+0xe/0xd0
        ? lock_release+0x155/0x440
        ? kernel_init_free_pages+0x6d/0x90
        ? preempt_count_sub+0x9b/0xd0
        ? kernel_init_free_pages+0x6d/0x90
        ? get_page_from_freelist+0x12c4/0x1680
        ? __rb_reserve_next+0xe5/0x460
        ? ring_buffer_lock_reserve+0x12a/0x3f0
        event_triggers_call+0x52/0xe0
        ftrace_syscall_enter+0x264/0x2c0
        syscall_trace_enter.constprop.0+0x1ee/0x210
        do_syscall_64+0x1c/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Where it triggered a fault on strlen(key) where key was the filename.
      
      The reason is that filename is a char * to user space, and the histogram
      code just blindly dereferenced it, with obvious bad results.
      
      I originally tried to use strncpy_from_user/kernel_nofault() but found
      that there's other places that its dereferenced and not worth the effort.
      
      Just do not allow "char *" to act like strings.
      
      Link: https://lkml.kernel.org/r/20210715000206.025df9d2@rorschach.local.home
      
      
      
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarTom Zanussi <zanussi@kernel.org>
      Fixes: 79e577cb ("tracing: Support string type key properly")
      Fixes: 5967bd5c ("tracing: Let filter_assign_type() detect FILTER_PTR_STRING")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      704adfb5
  4. Jul 07, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing/histograms: Fix parsing of "sym-offset" modifier · 26c56373
      Steven Rostedt (VMware) authored
      With the addition of simple mathematical operations (plus and minus), the
      parsing of the "sym-offset" modifier broke, as it took the '-' part of the
      "sym-offset" as a minus, and tried to break it up into a mathematical
      operation of "field.sym - offset", in which case it failed to parse
      (unless the event had a field called "offset").
      
      Both .sym and .sym-offset modifiers should not be entered into
      mathematical calculations anyway. If ".sym-offset" is found in the
      modifier, then simply make it not an operation that can be calculated on.
      
      Link: https://lkml.kernel.org/r/20210707110821.188ae255@oasis.local.home
      
      
      
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 100719dc ("tracing: Add simple expression support to hist triggers")
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      26c56373
  5. Jun 10, 2021
  6. Mar 18, 2021
  7. Nov 11, 2020
  8. Oct 15, 2020
    • Steven Rostedt (VMware)'s avatar
      tracing: Check return value of __create_val_fields() before using its result · 6d9bd139
      Steven Rostedt (VMware) authored
      After having a typo for writing a histogram trigger.
      
      Wrote:
        echo 'hist:key=pid:ts=common_timestamp.usec' > events/sched/sched_waking/trigger
      
      Instead of:
        echo 'hist:key=pid:ts=common_timestamp.usecs' > events/sched/sched_waking/trigger
      
      and the following crash happened:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000008
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP PTI
       CPU: 4 PID: 1641 Comm: sh Not tainted 5.9.0-rc5-test+ #549
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016
       RIP: 0010:event_hist_trigger_func+0x70b/0x1ee0
       Code: 24 08 89 d5 49 89 cc e9 8c 00 00 00 4c 89 f2 41 b9 00 10 00 00 4c 89 e1 44 89 ee 4c 89 ff e8 dc d3 ff ff 45 89 ea 4b 8b 14 d7 <f6> 42 08 04 74 17 41 8b 8f c0 00 00 00 8d 71 01 41 89 b7 c0 00 00
       RSP: 0018:ffff959213d53db0 EFLAGS: 00010202
       RAX: ffffffffffffffea RBX: 0000000000000000 RCX: 0000000000084c04
       RDX: 0000000000000000 RSI: df7326aefebd174c RDI: 0000000000031080
       RBP: 0000000000000002 R08: 0000000000000001 R09: 0000000000000001
       R10: 0000000000000001 R11: 0000000000000046 R12: ffff959211dcf690
       R13: 0000000000000001 R14: ffff95925a36e370 R15: ffff959251c89800
       FS:  00007fb9ea934740(0000) GS:ffff95925ab00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000008 CR3: 00000000c976c005 CR4: 00000000001706e0
       Call Trace:
        ? trigger_process_regex+0x78/0x110
        trigger_process_regex+0xc5/0x110
        event_trigger_write+0x71/0xd0
        vfs_write+0xca/0x210
        ksys_write+0x70/0xf0
        do_syscall_64+0x33/0x40
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
       RIP: 0033:0x7fb9eaa29487
       Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
      
      This was caused by accessing the hlist_data fields after the call to
      __create_val_fields() without checking if the creation succeed.
      
      Link: https://lkml.kernel.org/r/20201013154852.3abd8702@gandalf.local.home
      
      
      
      Fixes: 63a1e5de ("tracing: Save normal string variables")
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6d9bd139
  9. Oct 05, 2020
  10. Sep 18, 2020
  11. Jun 01, 2020
  12. Apr 23, 2020
    • Vamshi K Sthambamkadi's avatar
      tracing: Fix memory leaks in trace_events_hist.c · 9da73974
      Vamshi K Sthambamkadi authored
      kmemleak report 1:
          [<9092c50b>] kmem_cache_alloc_trace+0x138/0x270
          [<05a2c9ed>] create_field_var+0xcf/0x180
          [<528a2d68>] action_create+0xe2/0xc80
          [<63f50b61>] event_hist_trigger_func+0x15b5/0x1920
          [<28ea5d3d>] trigger_process_regex+0x7b/0xc0
          [<3138e86f>] event_trigger_write+0x4d/0xb0
          [<ffd66c19>] __vfs_write+0x30/0x200
          [<4f424a0d>] vfs_write+0x96/0x1b0
          [<da59a290>] ksys_write+0x53/0xc0
          [<3717101a>] __ia32_sys_write+0x15/0x20
          [<c5f23497>] do_fast_syscall_32+0x70/0x250
          [<46e2629c>] entry_SYSENTER_32+0xaf/0x102
      
      This is because save_vars[] of struct hist_trigger_data are
      not destroyed
      
      kmemleak report 2:
          [<9092c50b>] kmem_cache_alloc_trace+0x138/0x270
          [<6e5e97c5>] create_var+0x3c/0x110
          [<de82f1b9>] create_field_var+0xaf/0x180
          [<528a2d68>] action_create+0xe2/0xc80
          [<63f50b61>] event_hist_trigger_func+0x15b5/0x1920
          [<28ea5d3d>] trigger_process_regex+0x7b/0xc0
          [<3138e86f>] event_trigger_write+0x4d/0xb0
          [<ffd66c19>] __vfs_write+0x30/0x200
          [<4f424a0d>] vfs_write+0x96/0x1b0
          [<da59a290>] ksys_write+0x53/0xc0
          [<3717101a>] __ia32_sys_write+0x15/0x20
          [<c5f23497>] do_fast_syscall_32+0x70/0x250
          [<46e2629c>] entry_SYSENTER_32+0xaf/0x102
      
      struct hist_field allocated through create_var() do not initialize
      "ref" field to 1. The code in __destroy_hist_field() does not destroy
      object if "ref" is initialized to zero, the condition
      if (--hist_field->ref > 1) always passes since unsigned int wraps.
      
      kmemleak report 3:
          [<f8666fcc>] __kmalloc_track_caller+0x139/0x2b0
          [<bb7f80a5>] kstrdup+0x27/0x50
          [<39d70006>] init_var_ref+0x58/0xd0
          [<8ca76370>] create_var_ref+0x89/0xe0
          [<f045fc39>] action_create+0x38f/0xc80
          [<7c146821>] event_hist_trigger_func+0x15b5/0x1920
          [<07de3f61>] trigger_process_regex+0x7b/0xc0
          [<e87daf8f>] event_trigger_write+0x4d/0xb0
          [<19bf1512>] __vfs_write+0x30/0x200
          [<64ce4d27>] vfs_write+0x96/0x1b0
          [<a6f34170>] ksys_write+0x53/0xc0
          [<7d4230cd>] __ia32_sys_write+0x15/0x20
          [<8eadca00>] do_fast_syscall_32+0x70/0x250
          [<235cf985>] entry_SYSENTER_32+0xaf/0x102
      
      hist_fields (system & event_name) are not freed
      
      Link: http://lkml.kernel.org/r/20200422061503.GA5151@cosmos
      
      
      
      Signed-off-by: default avatarVamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      9da73974
  13. Feb 20, 2020
  14. Feb 11, 2020
  15. Feb 01, 2020
  16. Jan 31, 2020
  17. Jan 30, 2020
  18. Jan 29, 2020
  19. Jan 20, 2020
    • Steven Rostedt (VMware)'s avatar
      tracing: Fix histogram code when expression has same var as value · 8bcebc77
      Steven Rostedt (VMware) authored
      While working on a tool to convert SQL syntex into the histogram language of
      the kernel, I discovered the following bug:
      
       # echo 'first u64 start_time u64 end_time pid_t pid u64 delta' >> synthetic_events
       # echo 'hist:keys=pid:start=common_timestamp' > events/sched/sched_waking/trigger
       # echo 'hist:keys=next_pid:delta=common_timestamp-$start,start2=$start:onmatch(sched.sched_waking).trace(first,$start2,common_timestamp,next_pid,$delta)' > events/sched/sched_switch/trigger
      
      Would not display any histograms in the sched_switch histogram side.
      
      But if I were to swap the location of
      
        "delta=common_timestamp-$start" with "start2=$start"
      
      Such that the last line had:
      
       # echo 'hist:keys=next_pid:start2=$start,delta=common_timestamp-$start:onmatch(sched.sched_waking).trace(first,$start2,common_timestamp,next_pid,$delta)' > events/sched/sched_switch/trigger
      
      The histogram works as expected.
      
      What I found out is that the expressions clear out the value once it is
      resolved. As the variables are resolved in the order listed, when
      processing:
      
        delta=common_timestamp-$start
      
      The $start is cleared. When it gets to "start2=$start", it errors out with
      "unresolved symbol" (which is silent as this happens at the location of the
      trace), and the histogram is dropped.
      
      When processing the histogram for variable references, instead of adding a
      new reference for a variable used twice, use the same reference. That way,
      not only is it more efficient, but the order will no longer matter in
      processing of the variables.
      
      From Tom Zanussi:
      
       "Just to clarify some more about what the problem was is that without
        your patch, we would have two separate references to the same variable,
        and during resolve_var_refs(), they'd both want to be resolved
        separately, so in this case, since the first reference to start wasn't
        part of an expression, it wouldn't get the read-once flag set, so would
        be read normally, and then the second reference would do the read-once
        read and also be read but using read-once.  So everything worked and
        you didn't see a problem:
      
         from: start2=$start,delta=common_timestamp-$start
      
        In the second case, when you switched them around, the first reference
        would be resolved by doing the read-once, and following that the second
        reference would try to resolve and see that the variable had already
        been read, so failed as unset, which caused it to short-circuit out and
        not do the trigger action to generate the synthetic event:
      
         to: delta=common_timestamp-$start,start2=$start
      
        With your patch, we only have the single resolution which happens
        correctly the one time it's resolved, so this can't happen."
      
      Link: https://lore.kernel.org/r/20200116154216.58ca08eb@gandalf.local.home
      
      
      
      Cc: stable@vger.kernel.org
      Fixes: 067fe038 ("tracing: Add variable reference handling to hist triggers")
      Reviewed-by: default avatarTom Zanuss <zanussi@kernel.org>
      Tested-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8bcebc77
  20. Jan 14, 2020
    • Masami Hiramatsu's avatar
      tracing: trigger: Replace unneeded RCU-list traversals · aeed8aa3
      Masami Hiramatsu authored
      With CONFIG_PROVE_RCU_LIST, I had many suspicious RCU warnings
      when I ran ftracetest trigger testcases.
      
      -----
        # dmesg -c > /dev/null
        # ./ftracetest test.d/trigger
        ...
        # dmesg | grep "RCU-list traversed" | cut -f 2 -d ] | cut -f 2 -d " "
        kernel/trace/trace_events_hist.c:6070
        kernel/trace/trace_events_hist.c:1760
        kernel/trace/trace_events_hist.c:5911
        kernel/trace/trace_events_trigger.c:504
        kernel/trace/trace_events_hist.c:1810
        kernel/trace/trace_events_hist.c:3158
        kernel/trace/trace_events_hist.c:3105
        kernel/trace/trace_events_hist.c:5518
        kernel/trace/trace_events_hist.c:5998
        kernel/trace/trace_events_hist.c:6019
        kernel/trace/trace_events_hist.c:6044
        kernel/trace/trace_events_trigger.c:1500
        kernel/trace/trace_events_trigger.c:1540
        kernel/trace/trace_events_trigger.c:539
        kernel/trace/trace_events_trigger.c:584
      -----
      
      I investigated those warnings and found that the RCU-list
      traversals in event trigger and hist didn't need to use
      RCU version because those were called only under event_mutex.
      
      I also checked other RCU-list traversals related to event
      trigger list, and found that most of them were called from
      event_hist_trigger_func() or hist_unregister_trigger() or
      register/unregister functions except for a few cases.
      
      Replace these unneeded RCU-list traversals with normal list
      traversal macro and lockdep_assert_held() to check the
      event_mutex is held.
      
      Link: http://lkml.kernel.org/r/157680910305.11685.15110237954275915782.stgit@devnote2
      
      
      
      Cc: stable@vger.kernel.org
      Fixes: 30350d65 ("tracing: Add variable support to hist triggers")
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      aeed8aa3
  21. Jan 13, 2020
    • Masami Hiramatsu's avatar
      tracing: trigger: Replace unneeded RCU-list traversals · 3b42a4c8
      Masami Hiramatsu authored
      With CONFIG_PROVE_RCU_LIST, I had many suspicious RCU warnings
      when I ran ftracetest trigger testcases.
      
      -----
        # dmesg -c > /dev/null
        # ./ftracetest test.d/trigger
        ...
        # dmesg | grep "RCU-list traversed" | cut -f 2 -d ] | cut -f 2 -d " "
        kernel/trace/trace_events_hist.c:6070
        kernel/trace/trace_events_hist.c:1760
        kernel/trace/trace_events_hist.c:5911
        kernel/trace/trace_events_trigger.c:504
        kernel/trace/trace_events_hist.c:1810
        kernel/trace/trace_events_hist.c:3158
        kernel/trace/trace_events_hist.c:3105
        kernel/trace/trace_events_hist.c:5518
        kernel/trace/trace_events_hist.c:5998
        kernel/trace/trace_events_hist.c:6019
        kernel/trace/trace_events_hist.c:6044
        kernel/trace/trace_events_trigger.c:1500
        kernel/trace/trace_events_trigger.c:1540
        kernel/trace/trace_events_trigger.c:539
        kernel/trace/trace_events_trigger.c:584
      -----
      
      I investigated those warnings and found that the RCU-list
      traversals in event trigger and hist didn't need to use
      RCU version because those were called only under event_mutex.
      
      I also checked other RCU-list traversals related to event
      trigger list, and found that most of them were called from
      event_hist_trigger_func() or hist_unregister_trigger() or
      register/unregister functions except for a few cases.
      
      Replace these unneeded RCU-list traversals with normal list
      traversal macro and lockdep_assert_held() to check the
      event_mutex is held.
      
      Link: http://lkml.kernel.org/r/157680910305.11685.15110237954275915782.stgit@devnote2
      
      
      
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      3b42a4c8
Loading