]> Pileus Git - ~andy/linux/blobdiff - include/linux/ftrace_event.h
tracing: Compare to 1 instead of zero for is_signed_type()
[~andy/linux] / include / linux / ftrace_event.h
index 0b0814d90164fd65751ee5c3dfa4714f58de2982..34e00fb49becf506865c18ffafefe23c413ea5c4 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/perf_event.h>
 
 struct trace_array;
+struct trace_buffer;
 struct tracer;
 struct dentry;
 
@@ -67,6 +68,7 @@ struct trace_entry {
 struct trace_iterator {
        struct trace_array      *tr;
        struct tracer           *trace;
+       struct trace_buffer     *trace_buffer;
        void                    *private;
        int                     cpu_file;
        struct mutex            mutex;
@@ -197,6 +199,7 @@ enum {
        TRACE_EVENT_FL_CAP_ANY_BIT,
        TRACE_EVENT_FL_NO_SET_FILTER_BIT,
        TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
+       TRACE_EVENT_FL_WAS_ENABLED_BIT,
 };
 
 /*
@@ -205,12 +208,16 @@ enum {
  *  CAP_ANY      - Any user can enable for perf
  *  NO_SET_FILTER - Set when filter has error and is to be ignored
  *  IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file
+ *  WAS_ENABLED   - Set and stays set when an event was ever enabled
+ *                    (used for module unloading, if a module event is enabled,
+ *                     it is best to clear the buffers that used it).
  */
 enum {
        TRACE_EVENT_FL_FILTERED         = (1 << TRACE_EVENT_FL_FILTERED_BIT),
        TRACE_EVENT_FL_CAP_ANY          = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
        TRACE_EVENT_FL_NO_SET_FILTER    = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
        TRACE_EVENT_FL_IGNORE_ENABLE    = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
+       TRACE_EVENT_FL_WAS_ENABLED      = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
 };
 
 struct ftrace_event_call {
@@ -223,6 +230,13 @@ struct ftrace_event_call {
        struct list_head        *files;
        void                    *mod;
        void                    *data;
+       /*
+        *   bit 0:             filter_active
+        *   bit 1:             allow trace by non root (cap any)
+        *   bit 2:             failed to apply filter
+        *   bit 3:             ftrace internal event (do not enable)
+        *   bit 4:             Event was enabled by module
+        */
        int                     flags; /* static flags of different events */
 
 #ifdef CONFIG_PERF_EVENTS
@@ -237,16 +251,23 @@ struct ftrace_subsystem_dir;
 enum {
        FTRACE_EVENT_FL_ENABLED_BIT,
        FTRACE_EVENT_FL_RECORDED_CMD_BIT,
+       FTRACE_EVENT_FL_SOFT_MODE_BIT,
+       FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
 };
 
 /*
  * Ftrace event file flags:
- *  ENABELD      - The event is enabled
+ *  ENABLED      - The event is enabled
  *  RECORDED_CMD  - The comms should be recorded at sched_switch
+ *  SOFT_MODE     - The event is enabled/disabled by SOFT_DISABLED
+ *  SOFT_DISABLED - When set, do not trace the event (even though its
+ *                   tracepoint may be enabled)
  */
 enum {
        FTRACE_EVENT_FL_ENABLED         = (1 << FTRACE_EVENT_FL_ENABLED_BIT),
        FTRACE_EVENT_FL_RECORDED_CMD    = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT),
+       FTRACE_EVENT_FL_SOFT_MODE       = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT),
+       FTRACE_EVENT_FL_SOFT_DISABLED   = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT),
 };
 
 struct ftrace_event_file {
@@ -258,23 +279,20 @@ struct ftrace_event_file {
 
        /*
         * 32 bit flags:
-        *   bit 1:             enabled
-        *   bit 2:             filter_active
-        *   bit 3:             enabled cmd record
-        *   bit 4:             allow trace by non root (cap any)
-        *   bit 5:             failed to apply filter
-        *   bit 6:             ftrace internal event (do not enable)
-        *
-        * Changes to flags must hold the event_mutex.
+        *   bit 0:             enabled
+        *   bit 1:             enabled cmd record
+        *   bit 2:             enable/disable with the soft disable bit
+        *   bit 3:             soft disabled
         *
-        * Note: Reads of flags do not hold the event_mutex since
-        * they occur in critical sections. But the way flags
+        * Note: The bits must be set atomically to prevent races
+        * from other writers. Reads of flags do not need to be in
+        * sync as they occur in critical sections. But the way flags
         * is currently used, these changes do not affect the code
         * except that when a change is made, it may have a slight
         * delay in propagating the changes to other CPUs due to
-        * caching and such.
+        * caching and such. Which is mostly OK ;-)
         */
-       unsigned int            flags;
+       unsigned long           flags;
 };
 
 #define __TRACE_EVENT_FLAGS(name, value)                               \
@@ -315,7 +333,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
 extern int trace_add_event_call(struct ftrace_event_call *call);
 extern void trace_remove_event_call(struct ftrace_event_call *call);
 
-#define is_signed_type(type)   (((type)(-1)) < (type)0)
+#define is_signed_type(type)   (((type)(-1)) < (type)1)
 
 int trace_set_clr_event(const char *system, const char *event, int set);