Merge branch 'rcu/next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck...
authorIngo Molnar <mingo@kernel.org>
Tue, 3 Sep 2013 05:41:11 +0000 (07:41 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 3 Sep 2013 05:41:11 +0000 (07:41 +0200)
Pull RCU updates from Paul E. McKenney:

"
 * Update RCU documentation.  These were posted to LKML at
   https://lkml.org/lkml/2013/8/19/611.

 * Miscellaneous fixes.  These were posted to LKML at
   https://lkml.org/lkml/2013/8/19/619.

 * Full-system idle detection.  This is for use by Frederic
   Weisbecker's adaptive-ticks mechanism.  Its purpose is
   to allow the timekeeping CPU to shut off its tick when
   all other CPUs are idle.  These were posted to LKML at
   https://lkml.org/lkml/2013/8/19/648.

 * Improve rcutorture test coverage.  These were posted to LKML at
   https://lkml.org/lkml/2013/8/19/675.
"

Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
include/linux/ftrace_event.h
init/Kconfig
kernel/trace/trace.h

index 120d57a1c3a5dcb452a75d4fd21a6d338b128a0d,81af18a75f4db365cd4e57523060f13e33104481..5eaa746735ff7f4ce73f0ac5f0ed11ba78a24d50
@@@ -78,11 -78,6 +78,11 @@@ struct trace_iterator 
        /* trace_seq for __print_flags() and __print_symbolic() etc. */
        struct trace_seq        tmp_seq;
  
 +      cpumask_var_t           started;
 +
 +      /* it's true when current open file is snapshot */
 +      bool                    snapshot;
 +
        /* The below is zeroed out in pipe_read */
        struct trace_seq        seq;
        struct trace_entry      *ent;
        loff_t                  pos;
        long                    idx;
  
 -      cpumask_var_t           started;
 -
 -      /* it's true when current open file is snapshot */
 -      bool                    snapshot;
 +      /* All new field here will be zeroed out in pipe_read */
  };
  
  enum trace_iter_flags {
@@@ -334,7 -332,7 +334,7 @@@ extern int trace_define_field(struct ft
                              const char *name, int offset, int size,
                              int is_signed, int filter_type);
  extern int trace_add_event_call(struct ftrace_event_call *call);
 -extern void trace_remove_event_call(struct ftrace_event_call *call);
 +extern int trace_remove_event_call(struct ftrace_event_call *call);
  
  #define is_signed_type(type)  (((type)(-1)) < (type)1)
  
@@@ -359,6 -357,40 +359,40 @@@ do {                                                                     
                __trace_printk(ip, fmt, ##args);                        \
  } while (0)
  
+ /**
+  * tracepoint_string - register constant persistent string to trace system
+  * @str - a constant persistent string that will be referenced in tracepoints
+  *
+  * If constant strings are being used in tracepoints, it is faster and
+  * more efficient to just save the pointer to the string and reference
+  * that with a printf "%s" instead of saving the string in the ring buffer
+  * and wasting space and time.
+  *
+  * The problem with the above approach is that userspace tools that read
+  * the binary output of the trace buffers do not have access to the string.
+  * Instead they just show the address of the string which is not very
+  * useful to users.
+  *
+  * With tracepoint_string(), the string will be registered to the tracing
+  * system and exported to userspace via the debugfs/tracing/printk_formats
+  * file that maps the string address to the string text. This way userspace
+  * tools that read the binary buffers have a way to map the pointers to
+  * the ASCII strings they represent.
+  *
+  * The @str used must be a constant string and persistent as it would not
+  * make sense to show a string that no longer exists. But it is still fine
+  * to be used with modules, because when modules are unloaded, if they
+  * had tracepoints, the ring buffers are cleared too. As long as the string
+  * does not change during the life of the module, it is fine to use
+  * tracepoint_string() within a module.
+  */
+ #define tracepoint_string(str)                                                \
+       ({                                                              \
+               static const char *___tp_str __tracepoint_string = str; \
+               ___tp_str;                                              \
+       })
+ #define __tracepoint_string   __attribute__((section("__tracepoint_str")))
  #ifdef CONFIG_PERF_EVENTS
  struct perf_event;
  
diff --combined init/Kconfig
index fed81b576f29ad8003c48ed293bb9cd42bd95922,c08a5495dbb7486609466a433ffa90f144eb99a4..cc917d3ec858faaf3bcce1b605484fbd107e57a3
@@@ -470,6 -470,7 +470,7 @@@ config TREE_RC
  config TREE_PREEMPT_RCU
        bool "Preemptible tree-based hierarchical RCU"
        depends on PREEMPT
+       select IRQ_WORK
        help
          This option selects the RCU implementation that is
          designed for very large SMP systems with hundreds or
@@@ -955,7 -956,7 +956,7 @@@ config MEMCG_SWAP_ENABLE
          Memory Resource Controller Swap Extension comes with its price in
          a bigger memory consumption. General purpose distribution kernels
          which want to enable the feature but keep it disabled by default
 -        and let the user enable it by swapaccount boot command line
 +        and let the user enable it by swapaccount=1 boot command line
          parameter should have this option unselected.
          For those who want to have the feature enabled by default should
          select this option (if, for some reason, they need to disable it
diff --combined kernel/trace/trace.h
index afaae41b0a0269012ae394dc5df877cd5cf86045,ba321f12df8cddf21cbefba3e1f0d2951da0cf02..fe39acd4c1aafa8655c6d8656621dcafbeb3abbf
@@@ -130,12 -130,19 +130,12 @@@ enum trace_flag_type 
  
  struct trace_array;
  
 -struct trace_cpu {
 -      struct trace_array      *tr;
 -      struct dentry           *dir;
 -      int                     cpu;
 -};
 -
  /*
   * The CPU trace array - it consists of thousands of trace entries
   * plus some other descriptor data: (for example which task started
   * the trace, etc.)
   */
  struct trace_array_cpu {
 -      struct trace_cpu        trace_cpu;
        atomic_t                disabled;
        void                    *buffer_page;   /* ring buffer spare */
  
@@@ -189,6 -196,7 +189,6 @@@ struct trace_array 
        bool                    allocated_snapshot;
  #endif
        int                     buffer_disabled;
 -      struct trace_cpu        trace_cpu;      /* place holder */
  #ifdef CONFIG_FTRACE_SYSCALLS
        int                     sys_refcount_enter;
        int                     sys_refcount_exit;
        struct dentry           *event_dir;
        struct list_head        systems;
        struct list_head        events;
 -      struct task_struct      *waiter;
        int                     ref;
  };
  
@@@ -671,15 -680,6 +671,15 @@@ extern int trace_selftest_startup_sched
                                               struct trace_array *tr);
  extern int trace_selftest_startup_branch(struct tracer *trace,
                                         struct trace_array *tr);
 +/*
 + * Tracer data references selftest functions that only occur
 + * on boot up. These can be __init functions. Thus, when selftests
 + * are enabled, then the tracers need to reference __init functions.
 + */
 +#define __tracer_data         __refdata
 +#else
 +/* Tracers are seldom changed. Optimize when selftests are disabled. */
 +#define __tracer_data         __read_mostly
  #endif /* CONFIG_FTRACE_STARTUP_TEST */
  
  extern void *head_page(struct trace_array_cpu *data);
@@@ -1022,6 -1022,9 +1022,9 @@@ extern struct list_head ftrace_events
  extern const char *__start___trace_bprintk_fmt[];
  extern const char *__stop___trace_bprintk_fmt[];
  
+ extern const char *__start___tracepoint_str[];
+ extern const char *__stop___tracepoint_str[];
  void trace_printk_init_buffers(void);
  void trace_printk_start_comm(void);
  int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set);