OSDN Git Service

Merge tag 'trace-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Sep 2023 23:34:25 +0000 (16:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 1 Sep 2023 23:34:25 +0000 (16:34 -0700)
Pull tracing updates from Steven Rostedt:
 "User visible changes:

   - Added a way to easier filter with cpumasks:

       # echo 'cpumask & CPUS{17-42}' > /sys/kernel/tracing/events/ipi_send_cpumask/filter

   - Show actual size of ring buffer after modifying the ring buffer
     size via buffer_size_kb.

     Currently it just returns what was written, but the actual size
     rounds up to the sub buffer size. Show that real size instead.

  Major changes:

   - Added "eventfs". This is the code that handles the inodes and
     dentries of tracefs/events directory. As there are thousands of
     events, and each event has several inodes and dentries that
     currently exist even when tracing is never used, they take up
     precious memory. Instead, eventfs will allocate the inodes and
     dentries in a JIT way (similar to what procfs does). There is now
     metadata that handles the events and subdirectories, and will
     create the inodes and dentries when they are used.

     Note, I also have patches that remove the subdirectory meta data,
     but will wait till the next merge window before applying them. It's
     a little more complex, and I want to make sure the dynamic code
     works properly before adding more complexity, making it easier to
     revert if need be.

  Minor changes:

   - Optimization to user event list traversal

   - Remove intermediate permission of tracefs files (note the
     intermediate permission removes all access to the files so it is
     not a security concern, but just a clean up)

   - Add the complex fix to FORTIFY_SOURCE to the kernel stack event
     logic

   - Other minor cleanups"

* tag 'trace-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (29 commits)
  tracefs: Remove kerneldoc from struct eventfs_file
  tracefs: Avoid changing i_mode to a temp value
  tracing/user_events: Optimize safe list traversals
  ftrace: Remove empty declaration ftrace_enable_daemon() and ftrace_disable_daemon()
  tracing: Remove unused function declarations
  tracing/filters: Document cpumask filtering
  tracing/filters: Further optimise scalar vs cpumask comparison
  tracing/filters: Optimise CPU vs cpumask filtering when the user mask is a single CPU
  tracing/filters: Optimise scalar vs cpumask filtering when the user mask is a single CPU
  tracing/filters: Optimise cpumask vs cpumask filtering when user mask is a single CPU
  tracing/filters: Enable filtering the CPU common field by a cpumask
  tracing/filters: Enable filtering a scalar field by a cpumask
  tracing/filters: Enable filtering a cpumask field by another cpumask
  tracing/filters: Dynamically allocate filter_pred.regex
  test: ftrace: Fix kprobe test for eventfs
  eventfs: Move tracing/events to eventfs
  eventfs: Implement removal of meta data from eventfs
  eventfs: Implement functions to create files and dirs when accessed
  eventfs: Implement eventfs lookup, read, open functions
  eventfs: Implement eventfs file add functions
  ...

1  2 
Documentation/trace/events.rst
fs/tracefs/inode.c
include/linux/trace_events.h
kernel/trace/trace.c
kernel/trace/trace.h

Simple merge
Simple merge
Simple merge
@@@ -4206,22 -4189,9 +4189,16 @@@ static void *s_start(struct seq_file *m
        loff_t l = 0;
        int cpu;
  
-       /*
-        * copy the tracer to avoid using a global lock all around.
-        * iter->trace is a copy of current_trace, the pointer to the
-        * name may be used instead of a strcmp(), as iter->trace->name
-        * will point to the same string as current_trace->name.
-        */
        mutex_lock(&trace_types_lock);
-       if (unlikely(tr->current_trace && iter->trace->name != tr->current_trace->name)) {
 -      if (unlikely(tr->current_trace != iter->trace))
++      if (unlikely(tr->current_trace != iter->trace)) {
 +              /* Close iter->trace before switching to the new current tracer */
 +              if (iter->trace->close)
 +                      iter->trace->close(iter);
-               *iter->trace = *tr->current_trace;
+               iter->trace = tr->current_trace;
 +              /* Reopen the new current tracer */
 +              if (iter->trace->open)
 +                      iter->trace->open(iter);
 +      }
        mutex_unlock(&trace_types_lock);
  
  #ifdef CONFIG_TRACER_MAX_TRACE
@@@ -6822,13 -6761,10 +6806,10 @@@ static int tracing_release_pipe(struct 
  
        if (iter->trace->pipe_close)
                iter->trace->pipe_close(iter);
 -
 +      close_pipe_on_cpu(tr, iter->cpu_file);
        mutex_unlock(&trace_types_lock);
  
-       free_cpumask_var(iter->started);
-       kfree(iter->fmt);
-       kfree(iter->temp);
-       mutex_destroy(&iter->mutex);
+       free_trace_iter_content(iter);
        kfree(iter);
  
        trace_array_put(tr);
Simple merge