1. Jan 25, 2023
    • Steven Rostedt (Google)'s avatar
      tracing/histogram: Add stacktrace type · cc5fc8bf
      Steven Rostedt (Google) authored
      Now that stacktraces can be part of synthetic events, allow a key to be
      typed as a stacktrace.
      
        # cd /sys/kernel/tracing
        # echo 's:block_lat u64 delta; unsigned long stack[];' >> dynamic_events
        # echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace if prev_state == 2' >> events/sched/sched_switch/trigger
        # echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,st2=$st:onmatch(sched.sched_switch).trace(block_lat,$delta,$st2)' >> events/sched/sched_switch/trigger
        # echo 'hist:keys=delta.buckets=100,stack.stacktrace:sort=delta' > events/synthetic/block_lat/trigger
      
        # cat events/synthetic/block_lat/hist
      
        # event histogram
        #
        # trigger info: hist:keys=delta.buckets=100,stacktrace:vals=hitcount:sort=delta.buckets=100:size=2048 [active]
        #
      
        { delta: ~ 0-99, stacktrace:
                 event_hist_trigger+0x464/0x480
                 event_triggers_call+0x52/0xe0
                 trace_event_buffer_commit+0x193/0x250
                 trace_event_raw_event_sched_switch+0xfc/0x150
                 __traceiter_sched_switch+0x41/0x60
                 __schedule+0x448/0x7b0
                 schedule_idle+0x26/0x40
                 cpu_startup_entry+0x19/0x20
                 start_secondary+0xed/0xf0
                 secondary_startup_64_no_verify+0xe0/0xeb
        } hitcount:          6
        { delta: ~ 0-99, stacktrace:
                 event_hist_trigger+0x464/0x480
                 event_triggers_call+0x52/0xe0
                 trace_event_buffer_commit+0x193/0x250
                 trace_event_raw_event_sched_switch+0xfc/0x150
                 __traceiter_sched_switch+0x41/0x60
                 __schedule+0x448/0x7b0
                 schedule_idle+0x26/0x40
                 cpu_startup_entry+0x19/0x20
                 __pfx_kernel_init+0x0/0x10
                 arch_call_rest_init+0xa/0x24
                 start_kernel+0x964/0x98d
                 secondary_startup_64_no_verify+0xe0/0xeb
        } hitcount:          3
        { delta: ~ 0-99, stacktrace:
                 event_hist_trigger+0x464/0x480
                 event_triggers_call+0x52/0xe0
                 trace_event_buffer_commit+0x193/0x250
                 trace_event_raw_event_sched_switch+0xfc/0x150
                 __traceiter_sched_switch+0x41/0x60
                 __schedule+0x448/0x7b0
                 schedule+0x5a/0xb0
                 worker_thread+0xaf/0x380
                 kthread+0xe9/0x110
                 ret_from_fork+0x2c/0x50
        } hitcount:          1
        { delta: ~ 100-199, stacktrace:
                 event_hist_trigger+0x464/0x480
                 event_triggers_call+0x52/0xe0
                 trace_event_buffer_commit+0x193/0x250
                 trace_event_raw_event_sched_switch+0xfc/0x150
                 __traceiter_sched_switch+0x41/0x60
                 __schedule+0x448/0x7b0
                 schedule_idle+0x26/0x40
                 cpu_startup_entry+0x19/0x20
                 start_secondary+0xed/0xf0
                 secondary_startup_64_no_verify+0xe0/0xeb
        } hitcount:         15
        [..]
        { delta: ~ 8500-8599, stacktrace:
                 event_hist_trigger+0x464/0x480
                 event_triggers_call+0x52/0xe0
                 trace_event_buffer_commit+0x193/0x250
                 trace_event_raw_event_sched_switch+0xfc/0x150
                 __traceiter_sched_switch+0x41/0x60
                 __schedule+0x448/0x7b0
                 schedule_idle+0x26/0x40
                 cpu_startup_entry+0x19/0x20
                 start_secondary+0xed/0xf0
                 secondary_startup_64_no_verify+0xe0/0xeb
        } hitcount:          1
      
        Totals:
            Hits: 89
            Entries: 11
            Dropped: 0
      
      Link: https://lkml.kernel.org/r/20230117152236.167046397@goodmis.org
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Ching-lin Yu <chinglinyu@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      cc5fc8bf
    • Steven Rostedt (Google)'s avatar
      tracing: Allow synthetic events to pass around stacktraces · 00cf3d67
      Steven Rostedt (Google) authored
      Allow a stacktrace from one event to be displayed by the end event of a
      synthetic event. This is very useful when looking for the longest latency
      of a sleep or something blocked on I/O.
      
       # cd /sys/kernel/tracing/
       # echo 's:block_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
       # echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' > events/sched/sched_switch/trigger
       # echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(block_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
      
      The above creates a "block_lat" synthetic event that take the stacktrace of
      when a task schedules out in either the interruptible or uninterruptible
      states, and on a new per process max $delta (the time it was scheduled
      out), will print the process id and the stacktrace.
      
        # echo 1 > events/synthetic/block_lat/enable
        # cat trace
       #           TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
       #              | |         |   |||||     |         |
          kworker/u16:0-767     [006] d..4.   560.645045: block_lat: pid=767 delta=66 stack=STACK:
       => __schedule
       => schedule
       => pipe_read
       => vfs_read
       => ksys_read
       => do_syscall_64
       => 0x966000aa
      
                 <idle>-0       [003] d..4.   561.132117: block_lat: pid=0 delta=413787 stack=STACK:
       => __schedule
       => schedule
       => schedule_hrtimeout_range_clock
       => do_sys_poll
       => __x64_sys_poll
       => do_syscall_64
       => 0x966000aa
      
                  <...>-153     [006] d..4.   562.068407: block_lat: pid=153 delta=54 stack=STACK:
       => __schedule
       => schedule
       => io_schedule
       => rq_qos_wait
       => wbt_wait
       => __rq_qos_throttle
       => blk_mq_submit_bio
       => submit_bio_noacct_nocheck
       => ext4_bio_write_page
       => mpage_submit_page
       => mpage_process_page_bufs
       => mpage_prepare_extent_to_map
       => ext4_do_writepages
       => ext4_writepages
       => do_writepages
       => __writeback_single_inode
      
      Link: https://lkml.kernel.org/r/20230117152236.010941267@goodmis.org
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Ching-lin Yu <chinglinyu@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      00cf3d67
    • Steven Rostedt (Google)'s avatar
      tracing: Allow stacktraces to be saved as histogram variables · 288709c9
      Steven Rostedt (Google) authored
      Allow to save stacktraces into a histogram variable. This will be used by
      synthetic events to allow a stacktrace from one event to be passed and
      displayed by another event.
      
      The special keyword "stacktrace" is to be used to trigger a stack
      trace for the event that the histogram trigger is attached to.
      
        echo 'hist:keys=pid:st=stacktrace" > events/sched/sched_waking/trigger
      
      Currently nothing can get access to the "$st" variable above that contains
      the stack trace, but that will soon change.
      
      Link: https://lkml.kernel.org/r/20230117152235.856323729@goodmis.org
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Ching-lin Yu <chinglinyu@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      288709c9
    • Steven Rostedt (Google)'s avatar
      tracing: Simplify calculating entry size using struct_size() · 19ff8049
      Steven Rostedt (Google) authored
      When tracing a dynamic string field for a synthetic event, the offset
      calculation for where to write the next event can use struct_size() to
      find what the current size of the structure is.
      
      This simplifies the code and makes it less error prone.
      
      Link: https://lkml.kernel.org/r/20230117152235.698632147@goodmis.org
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Ching-lin Yu <chinglinyu@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      19ff8049
    • Jia-Ju Bai's avatar
      tracing: Add NULL checks for buffer in ring_buffer_free_read_page() · 3e4272b9
      Jia-Ju Bai authored
      In a previous commit 7433632c, buffer, buffer->buffers and
      buffer->buffers[cpu] in ring_buffer_wake_waiters() can be NULL,
      and thus the related checks are added.
      
      However, in the same call stack, these variables are also used in
      ring_buffer_free_read_page():
      
      tracing_buffers_release()
        ring_buffer_wake_waiters(iter->array_buffer->buffer)
          cpu_buffer = buffer->buffers[cpu] -> Add checks by previous commit
        ring_buffer_free_read_page(iter->array_buffer->buffer)
          cpu_buffer = buffer->buffers[cpu] -> No check
      
      Thus, to avod possible null-pointer derefernces, the related checks
      should be added.
      
      These results are reported by a static tool designed by myself.
      
      Link: https://lkml.kernel.org/r/20230113125501.760324-1-baijiaju1990@gmail.com
      
      
      
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      3e4272b9
    • Mark Rutland's avatar
      ftrace: Add sample with custom ops · b56c68f7
      Mark Rutland authored
      When reworking core ftrace code or architectural ftrace code, it's often
      necessary to test/analyse/benchmark a number of ftrace_ops
      configurations. This patch adds a module which can be used to explore
      some of those configurations.
      
      I'm using this to benchmark various options for changing the way
      trampolines and handling of ftrace_ops work on arm64, and ensuring other
      architectures aren't adversely affected.
      
      For example, in a QEMU+KVM VM running on a 2GHz Xeon E5-2660
      workstation, loading the module in various configurations produces:
      
      | # insmod ftrace-ops.ko
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1681558ns (16ns / call)
      
      | # insmod ftrace-ops.ko nr_ops_irrelevant=5
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 5
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 1693042ns (16ns / call)
      
      | # insmod ftrace-ops.ko nr_ops_relevant=2
      | ftrace_ops: registering:
      |   relevant ops: 2
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: NO
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 11965582ns (119ns / call)
      
      | # insmod ftrace-ops.ko save_regs=true
      | ftrace_ops: registering:
      |   relevant ops: 1
      |     tracee: tracee_relevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   irrelevant ops: 0
      |     tracee: tracee_irrelevant [ftrace_ops]
      |     tracer: ops_func_nop [ftrace_ops]
      |   saving registers: YES
      |   assist recursion: NO
      |   assist RCU: NO
      | ftrace_ops: Attempted 100000 calls to tracee_relevant [ftrace_ops] in 4459624ns (44ns / call)
      
      Link: https://lkml.kernel.org/r/20230103124912.2948963-4-mark.rutland@arm.com
      
      
      
      Cc: Florent Revest <revest@chromium.org>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      b56c68f7
    • Steven Rostedt (Google)'s avatar
      tracing/selftests: Add test for event filtering on function name · 7f09d639
      Steven Rostedt (Google) authored
      With the new filter logic of passing in the name of a function to match an
      instruction pointer (or the address of the function), add a test to make
      sure that it is functional.
      
      This is also the first test to test plain filtering. The filtering has
      been tested via the trigger logic, which uses the same code, but there was
      nothing to test just the event filter, so this test is the first to add
      such a case.
      
      Link: https://lkml.kernel.org/r/20221219183214.075559302@goodmis.org
      
      
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Zheng Yejian <zhengyejian1@huawei.com>
      Cc: linux-kselftest@vger.kernel.org
      Suggested-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Reviewed-by: default avatarRoss Zwisler <zwisler@google.com>
      Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      7f09d639
    • Steven Rostedt (Google)'s avatar
      tracing: Add a way to filter function addresses to function names · e6745a4d
      Steven Rostedt (Google) authored
      There's been several times where an event records a function address in
      its field and I needed to filter on that address for a specific function
      name. It required looking up the function in kallsyms, finding its size,
      and doing a compare of "field >= function_start && field < function_end".
      
      But this would change from boot to boot and is unreliable in scripts.
      Also, it is useful to have this at boot up, where the addresses will not
      be known. For example, on the boot command line:
      
        trace_trigger="initcall_finish.traceoff if func.function == acpi_init"
      
      To implement this, add a ".function" prefix, that will check that the
      field is of size long, and the only operations allowed (so far) are "=="
      and "!=".
      
      Link: https://lkml.kernel.org/r/20221219183213.916833763@goodmis.org
      
      
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: Zheng Yejian <zhengyejian1@huawei.com>
      Reviewed-by: default avatarRoss Zwisler <zwisler@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      e6745a4d
    • Colin Ian King's avatar
      rv: remove redundant initialization of pointer ptr · ae3edea8
      Colin Ian King authored
      The pointer ptr is being initialized with a value that is never read,
      it is being updated later on a call to strim. Remove the extraneous
      initialization.
      
      Link: https://lkml.kernel.org/r/20230116161612.77192-1-colin.i.king@gmail.com
      
      
      
      Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      ae3edea8
    • Mark Rutland's avatar
      ftrace: Maintain samples/ftrace · 34226fc6
      Mark Rutland authored
      There's no entry in MAINTAINERS for samples/ftrace. Add one so that the
      FTRACE maintainers are kept in the loop.
      
      Link: https://lkml.kernel.org/r/20230103124912.2948963-2-mark.rutland@arm.com
      
      
      
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      34226fc6
    • Randy Dunlap's avatar
      tracing/filter: fix kernel-doc warnings · d5090d91
      Randy Dunlap authored
      Use the 'struct' keyword for a struct's kernel-doc notation and
      use the correct function parameter name to eliminate kernel-doc
      warnings:
      
      kernel/trace/trace_events_filter.c:136: warning: cannot understand function prototype: 'struct prog_entry '
      kerne/trace/trace_events_filter.c:155: warning: Excess function parameter 'when_to_branch' description in 'update_preds'
      
      Also correct some trivial punctuation problems.
      
      Link: https://lkml.kernel.org/r/20230108021238.16398-1-rdunlap@infradead.org
      
      
      
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      d5090d91
    • Randy Dunlap's avatar
      lib: Kconfig: fix spellos · ca0f2cfc
      Randy Dunlap authored
      Fix spelling in lib/ Kconfig files.
      (reported by codespell)
      
      Link: https://lkml.kernel.org/r/20230124181655.16269-1-rdunlap@infradead.org
      
      
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: kasan-dev@googlegroups.com
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      ca0f2cfc
    • Natalia Petrova's avatar
      trace_events_hist: add check for return value of 'create_hist_field' · 8b152e91
      Natalia Petrova authored
      Function 'create_hist_field' is called recursively at
      trace_events_hist.c:1954 and can return NULL-value that's why we have
      to check it to avoid null pointer dereference.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Link: https://lkml.kernel.org/r/20230111120409.4111-1-n.petrova@fintech.ru
      
      Cc: stable@vger.kernel.org
      Fixes: 30350d65
      
       ("tracing: Add variable support to hist triggers")
      Signed-off-by: default avatarNatalia Petrova <n.petrova@fintech.ru>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      8b152e91
    • Chuang Wang's avatar
      tracing/osnoise: Use built-in RCU list checking · 685b64e4
      Chuang Wang authored
      list_for_each_entry_rcu() has built-in RCU and lock checking.
      
      Pass cond argument to list_for_each_entry_rcu() to silence false lockdep
      warning when CONFIG_PROVE_RCU_LIST is enabled.
      
      Execute as follow:
      
       [tracing]# echo osnoise > current_tracer
       [tracing]# echo 1 > tracing_on
       [tracing]# echo 0 > tracing_on
      
      The trace_types_lock is held when osnoise_tracer_stop() or
      timerlat_tracer_stop() are called in the non-RCU read side section.
      So, pass lockdep_is_held(&trace_types_lock) to silence false lockdep
      warning.
      
      Link: https://lkml.kernel.org/r/20221227023036.784337-1-nashuiliang@gmail.com
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Fixes: dae18134
      
       ("tracing/osnoise: Support a list of trace_array *tr")
      Acked-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarChuang Wang <nashuiliang@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      685b64e4
    • Randy Dunlap's avatar
    • Steven Rostedt (Google)'s avatar
      ftrace/scripts: Update the instructions for ftrace-bisect.sh · 7ae4ba71
      Steven Rostedt (Google) authored
      The instructions for the ftrace-bisect.sh script, which is used to find
      what function is being traced that is causing a kernel crash, and possibly
      a triple fault reboot, uses the old method. In 5.1, a new feature was
      added that let the user write in the index into available_filter_functions
      that maps to the function a user wants to set in set_ftrace_filter (or
      set_ftrace_notrace). This takes O(1) to set, as suppose to writing a
      function name, which takes O(n) (where n is the number of functions in
      available_filter_functions).
      
      The ftrace-bisect.sh requires setting half of the functions in
      available_filter_functions, which is O(n^2) using the name method to enable
      and can take several minutes to complete. The number method is O(n) which
      takes less than a second to complete. Using the number method for any
      kernel 5.1 and after is the proper way to do the bisect.
      
      Update the usage to reflect the new change, as well as using the
      /sys/kernel/tracing path instead of the obsolete debugfs path.
      
      Link: https://lkml.kernel.org/r/20230123112252.022003dd@gandalf.local.home
      
      
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Fixes: f79b3f33
      
       ("ftrace: Allow enabling of filters via index of available_filter_functions")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      7ae4ba71
    • Steven Rostedt (Google)'s avatar
      tracing: Make sure trace_printk() can output as soon as it can be used · 3bb06eb6
      Steven Rostedt (Google) authored
      Currently trace_printk() can be used as soon as early_trace_init() is
      called from start_kernel(). But if a crash happens, and
      "ftrace_dump_on_oops" is set on the kernel command line, all you get will
      be:
      
        [    0.456075]   <idle>-0         0dN.2. 347519us : Unknown type 6
        [    0.456075]   <idle>-0         0dN.2. 353141us : Unknown type 6
        [    0.456075]   <idle>-0         0dN.2. 358684us : Unknown type 6
      
      This is because the trace_printk() event (type 6) hasn't been registered
      yet. That gets done via an early_initcall(), which may be early, but not
      early enough.
      
      Instead of registering the trace_printk() event (and other ftrace events,
      which are not trace events) via an early_initcall(), have them registered at
      the same time that trace_printk() can be used. This way, if there is a
      crash before early_initcall(), then the trace_printk()s will actually be
      useful.
      
      Link: https://lkml.kernel.org/r/20230104161412.019f6c55@gandalf.local.home
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Fixes: e725c731
      
       ("tracing: Split tracing initialization into two for early initialization")
      Reported-by: default avatar"Joel Fernandes (Google)" <joel@joelfernandes.org>
      Tested-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      3bb06eb6
    • Mark Rutland's avatar
      ftrace: Export ftrace_free_filter() to modules · 8be9fbd5
      Mark Rutland authored
      Setting filters on an ftrace ops results in some memory being allocated
      for the filter hashes, which must be freed before the ops can be freed.
      This can be done by removing every individual element of the hash by
      calling ftrace_set_filter_ip() or ftrace_set_filter_ips() with `remove`
      set, but this is somewhat error prone as it's easy to forget to remove
      an element.
      
      Make it easier to clean this up by exporting ftrace_free_filter(), which
      can be used to clean up all of the filter hashes after an ftrace_ops has
      been unregistered.
      
      Using this, fix the ftrace-direct* samples to free hashes prior to being
      unloaded. All other code either removes individual filters explicitly or
      is built-in and already calls ftrace_free_filter().
      
      Link: https://lkml.kernel.org/r/20230103124912.2948963-3-mark.rutland@arm.com
      
      Cc: stable@vger.kernel.org
      Cc: Florent Revest <revest@chromium.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Fixes: e1067a07 ("ftrace/samples: Add module ...
      8be9fbd5
  2. Jan 22, 2023
    • Linus Torvalds's avatar
      Linux 6.2-rc5 · 2241ab53
      Linus Torvalds authored
      2241ab53
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.2-2023-01-21' of git://git.kernel.dk/linux · 95f184d0
      Linus Torvalds authored
      Pull another io_uring fix from Jens Axboe:
       "Just a single fix for a regression that happened in this release due
        to a poll change. Normally I would've just deferred it to next week,
        but since the original fix got picked up by stable, I think it's
        better to just send this one off separately.
      
        The issue is around the poll race fix, and how it mistakenly also got
        applied to multishot polling. Those don't need the race fix, and we
        should not be doing any reissues for that case. Exhaustive test cases
        were written and committed to the liburing regression suite for the
        reported issue, and additions for similar issues"
      
      * tag 'io_uring-6.2-2023-01-21' of git://git.kernel.dk/linux:
        io_uring/poll: don't reissue in case of poll race on multishot request
      95f184d0
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · f6714402
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are some small char/misc and other subsystem driver fixes for
        6.2-rc5 to resolve a few reported issues. They include:
      
         - long time pending fastrpc fixes (should have gone into 6.1, my
           fault)
      
         - mei driver/bus fixes and new device ids
      
         - interconnect driver fixes for reported problems
      
         - vmci bugfix
      
         - w1 driver bugfixes for reported problems
      
        Almost all of these have been in linux-next with no reported problems,
        the rest have all passed 0-day bot testing in my tree and on the
        mailing lists where they have sat too long due to me taking a long
        time to catch up on my pending patch queue"
      
      * tag 'char-misc-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        VMCI: Use threaded irqs instead of tasklets
        misc: fastrpc: Pass bitfield into qcom_scm_assign_mem
        gsmi: fix null-deref in gsmi_get_variable
        misc: fastrpc: Fix use-after-free race condition for maps
        misc: fastrpc: Don't remove map on creater_process and device_release
        misc: fastrpc: Fix use-after-free and race in fastrpc_map_find
        misc: fastrpc: fix error code in fastrpc_req_mmap()
        mei: me: add meteor lake point M DID
        mei: bus: fix unlink on bus in error path
        w1: fix WARNING after calling w1_process()
        w1: fix deadloop in __w1_remove_master_device()
        comedi: adv_pci1760: Fix PWM instruction handling
        interconnect: qcom: rpm: Use _optional func for provider clocks
        interconnect: qcom: msm8996: Fix regmap max_register values
        interconnect: qcom: msm8996: Provide UFS clocks to A2NoC
        dt-bindings: interconnect: Add UFS clocks to MSM8996 A2NoC
      f6714402
    • Linus Torvalds's avatar
      Merge tag 'driver-core-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · c88a3114
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are three small driver and kernel core fixes for 6.2-rc5. They
        include:
      
         - potential gadget fixup in do_prlimit
      
         - device property refcount leak fix
      
         - test_async_probe bugfix for reported problem"
      
      * tag 'driver-core-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        prlimit: do_prlimit needs to have a speculation check
        driver core: Fix test_async_probe_init saves device in wrong array
        device property: fix of node refcount leak in fwnode_graph_get_next_endpoint()
      c88a3114
    • Linus Torvalds's avatar
      Merge tag 'staging-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · bb86d657
      Linus Torvalds authored
      Pull staging driver fix from Greg KH:
       "Here is a single staging driver fix for 6.2-rc5. It resolves a build
        issue reported and Fixed by Arnd in the vc04_services driver. It's
        been in linux-next this week with no reported problems"
      
      * tag 'staging-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: vchiq_arm: fix enum vchiq_status return types
      bb86d657
    • Linus Torvalds's avatar
      Merge tag 'tty-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · bd5cc6ee
      Linus Torvalds authored
      Pull tty/serial driver fixes from Greg KH:
       "Here are some small tty and serial driver fixes for 6.2-rc5 that
        resolve a number of tiny reported issues and some new device ids. They
        include:
      
         - new device id for the exar serial driver
      
         - speakup tty driver bugfix
      
         - atmel serial driver baudrate fixup
      
         - stm32 serial driver bugfix and then revert as the bugfix broke the
           build. That will come back in a later pull request once it is all
           worked out properly.
      
         - amba-pl011 serial driver rs486 mode bugfix
      
         - qcom_geni serial driver bugfix
      
        Most of these have been in linux-next with no reported problems (well,
        other than the build breakage which generated the revert), the new
        device id passed 0-day testing"
      
      * tag 'tty-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: exar: Add support for Sealevel 7xxxC serial cards
        Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler"
        tty: serial: qcom_geni: avoid duplicate struct member init
        serial: atmel: fix incorrect baudrate setup
        tty: fix possible null-ptr-defer in spk_ttyio_release
        serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler
        serial: amba-pl011: fix high priority character transmission in rs486 mode
        serial: pch_uart: Pass correct sg to dma_unmap_sg()
        tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer
      bd5cc6ee
    • Linus Torvalds's avatar
      Merge tag 'usb-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · e67da288
      Linus Torvalds authored
      Pull USB / Thunderbolt fixes from Greg KH:
       "Here are a number of small USB and Thunderbolt driver fixes and new
        device id changes for 6.2-rc5. Included in here are:
      
         - thunderbolt bugfixes for reported problems
      
         - new usb-serial driver ids added
      
         - onboard_hub usb driver fixes for much-reported problems
      
         - xhci bugfixes
      
         - typec bugfixes
      
         - ehci-fsl driver module alias fix
      
         - iowarrior header size fix
      
         - usb gadget driver fixes
      
        All of these, except for the iowarrior fix, have been in linux-next
        with no reported issues. The iowarrior fix passed the 0-day testing
        and is a one digit change based on a reported problem in the driver
        (which was written to a spec, not the real device that is now
        available)"
      
      * tag 'usb-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (40 commits)
        USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100
        usb: host: ehci-fsl: Fix module alias
        usb: dwc3: fix extcon dependency
        usb: core: hub: disable autosuspend for TI TUSB8041
        USB: fix misleading usb_set_intfdata() kernel doc
        usb: gadget: f_ncm: fix potential NULL ptr deref in ncm_bitrate()
        USB: gadget: Add ID numbers to configfs-gadget driver names
        usb: typec: tcpm: Fix altmode re-registration causes sysfs create fail
        usb: gadget: g_webcam: Send color matching descriptor per frame
        usb: typec: altmodes/displayport: Use proper macro for pin assignment check
        usb: typec: altmodes/displayport: Fix pin assignment calculation
        usb: typec: altmodes/displayport: Add pin assignment helper
        usb: gadget: f_fs: Ensure ep0req is dequeued before free_request
        usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait
        usb: misc: onboard_hub: Move 'attach' work to the driver
        usb: misc: onboard_hub: Invert driver registration order
        usb: ucsi: Ensure connector delayed work items are flushed
        usb: musb: fix error return code in omap2430_probe()
        usb: chipidea: core: fix possible constant 0 if use IS_ERR(ci->role_switch)
        xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables
        ...
      e67da288
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v6.2-3' of... · 83cd5fd0
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Hide LDFLAGS_vmlinux from decompressor Makefiles to fix error
         messages when GNU Make 4.4 is used.
      
       - Fix 'make modules' build error when CONFIG_DEBUG_INFO_BTF_MODULES=y.
      
       - Fix warnings emitted by GNU Make 4.4 in scripts/kconfig/Makefile.
      
       - Support GNU Make 4.4 for scripts/jobserver-exec.
      
       - Show clearer error message when kernel/gen_kheaders.sh fails due to
         missing cpio.
      
      * tag 'kbuild-fixes-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kheaders: explicitly validate existence of cpio command
        scripts: support GNU make 4.4 in jobserver-exec
        kconfig: Update all declared targets
        scripts: rpm: make clear that mkspec script contains 4.13 feature
        init/Kconfig: fix LOCALVERSION_AUTO help text
        kbuild: fix 'make modules' error when CONFIG_DEBUG_INFO_BTF_MODULES=y
        kbuild: export top-level LDFLAGS_vmlinux only t...
      83cd5fd0
    • Linus Torvalds's avatar
      ext4: deal with legacy signed xattr name hash values · f3bbac32
      Linus Torvalds authored
      
      
      We potentially have old hashes of the xattr names generated on systems
      with signed 'char' types.  Now that everybody uses '-funsigned-char',
      those hashes will no longer match.
      
      This only happens if you use xattrs names that have the high bit set,
      which probably doesn't happen in practice, but the xfstest generic/454
      shows it.
      
      Instead of adding a new "signed xattr hash filesystem" bit and having to
      deal with all the possible combinations, just calculate the hash both
      ways if the first one fails, and always generate new hashes with the
      proper unsigned char version.
      
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Link: https://lore.kernel.org/oe-lkp/202212291509.704a11c9-oliver.sang@intel.com
      Link: https://lore.kernel.org/all/CAHk-=whUNjwqZXa-MH9KMmc_CpQpoFKFjAB9ZKHuu=TbsouT4A@mail.gmail.com/
      Exposed-by: 3bc753c0
      
       ("kbuild: treat char as always unsigned")
      Cc: Eric Biggers <ebiggers@kernel.org>
      Cc: Andreas Dilger <adilger@dilger.ca>
      Cc: Theodore Ts'o <tytso@mit.edu>,
      Cc: Jason Donenfeld <Jason@zx2c4.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f3bbac32
  3. Jan 21, 2023