Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/urgent

+106 -6
+3
include/linux/ring_buffer.h
··· 120 u64 ring_buffer_time_stamp(int cpu); 121 void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 122 123 enum ring_buffer_flags { 124 RB_FL_OVERWRITE = 1 << 0, 125 };
··· 120 u64 ring_buffer_time_stamp(int cpu); 121 void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 122 123 + void tracing_on(void); 124 + void tracing_off(void); 125 + 126 enum ring_buffer_flags { 127 RB_FL_OVERWRITE = 1 << 0, 128 };
+2 -6
kernel/trace/ftrace.c
··· 185 }; 186 187 static int ftrace_filtered; 188 - static int tracing_on; 189 190 static LIST_HEAD(ftrace_new_addrs); 191 ··· 505 { 506 int *command = data; 507 508 - if (*command & FTRACE_ENABLE_CALLS) { 509 ftrace_replace_code(1); 510 - tracing_on = 1; 511 - } else if (*command & FTRACE_DISABLE_CALLS) { 512 ftrace_replace_code(0); 513 - tracing_on = 0; 514 - } 515 516 if (*command & FTRACE_UPDATE_TRACE_FUNC) 517 ftrace_update_ftrace_func(ftrace_trace_function);
··· 185 }; 186 187 static int ftrace_filtered; 188 189 static LIST_HEAD(ftrace_new_addrs); 190 ··· 506 { 507 int *command = data; 508 509 + if (*command & FTRACE_ENABLE_CALLS) 510 ftrace_replace_code(1); 511 + else if (*command & FTRACE_DISABLE_CALLS) 512 ftrace_replace_code(0); 513 514 if (*command & FTRACE_UPDATE_TRACE_FUNC) 515 ftrace_update_ftrace_func(ftrace_trace_function);
+101
kernel/trace/ring_buffer.c
··· 16 #include <linux/list.h> 17 #include <linux/fs.h> 18 19 /* Up this if you want to test the TIME_EXTENTS and normalization */ 20 #define DEBUG_SHIFT 0 21 ··· 1162 struct ring_buffer_event *event; 1163 int cpu, resched; 1164 1165 if (atomic_read(&buffer->record_disabled)) 1166 return NULL; 1167 ··· 1280 void *body; 1281 int ret = -EBUSY; 1282 int cpu, resched; 1283 1284 if (atomic_read(&buffer->record_disabled)) 1285 return -EBUSY; ··· 2105 return 0; 2106 } 2107
··· 16 #include <linux/list.h> 17 #include <linux/fs.h> 18 19 + #include "trace.h" 20 + 21 + /* Global flag to disable all recording to ring buffers */ 22 + static int ring_buffers_off __read_mostly; 23 + 24 + /** 25 + * tracing_on - enable all tracing buffers 26 + * 27 + * This function enables all tracing buffers that may have been 28 + * disabled with tracing_off. 29 + */ 30 + void tracing_on(void) 31 + { 32 + ring_buffers_off = 0; 33 + } 34 + 35 + /** 36 + * tracing_off - turn off all tracing buffers 37 + * 38 + * This function stops all tracing buffers from recording data. 39 + * It does not disable any overhead the tracers themselves may 40 + * be causing. This function simply causes all recording to 41 + * the ring buffers to fail. 42 + */ 43 + void tracing_off(void) 44 + { 45 + ring_buffers_off = 1; 46 + } 47 + 48 /* Up this if you want to test the TIME_EXTENTS and normalization */ 49 #define DEBUG_SHIFT 0 50 ··· 1133 struct ring_buffer_event *event; 1134 int cpu, resched; 1135 1136 + if (ring_buffers_off) 1137 + return NULL; 1138 + 1139 if (atomic_read(&buffer->record_disabled)) 1140 return NULL; 1141 ··· 1248 void *body; 1249 int ret = -EBUSY; 1250 int cpu, resched; 1251 + 1252 + if (ring_buffers_off) 1253 + return -EBUSY; 1254 1255 if (atomic_read(&buffer->record_disabled)) 1256 return -EBUSY; ··· 2070 return 0; 2071 } 2072 2073 + static ssize_t 2074 + rb_simple_read(struct file *filp, char __user *ubuf, 2075 + size_t cnt, loff_t *ppos) 2076 + { 2077 + int *p = filp->private_data; 2078 + char buf[64]; 2079 + int r; 2080 + 2081 + /* !ring_buffers_off == tracing_on */ 2082 + r = sprintf(buf, "%d\n", !*p); 2083 + 2084 + return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); 2085 + } 2086 + 2087 + static ssize_t 2088 + rb_simple_write(struct file *filp, const char __user *ubuf, 2089 + size_t cnt, loff_t *ppos) 2090 + { 2091 + int *p = filp->private_data; 2092 + char buf[64]; 2093 + long val; 2094 + int ret; 2095 + 2096 + if (cnt >= sizeof(buf)) 2097 + return -EINVAL; 2098 + 2099 + if (copy_from_user(&buf, ubuf, cnt)) 2100 + return -EFAULT; 2101 + 2102 + buf[cnt] = 0; 2103 + 2104 + ret = strict_strtoul(buf, 10, &val); 2105 + if (ret < 0) 2106 + return ret; 2107 + 2108 + /* !ring_buffers_off == tracing_on */ 2109 + *p = !val; 2110 + 2111 + (*ppos)++; 2112 + 2113 + return cnt; 2114 + } 2115 + 2116 + static struct file_operations rb_simple_fops = { 2117 + .open = tracing_open_generic, 2118 + .read = rb_simple_read, 2119 + .write = rb_simple_write, 2120 + }; 2121 + 2122 + 2123 + static __init int rb_init_debugfs(void) 2124 + { 2125 + struct dentry *d_tracer; 2126 + struct dentry *entry; 2127 + 2128 + d_tracer = tracing_init_dentry(); 2129 + 2130 + entry = debugfs_create_file("tracing_on", 0644, d_tracer, 2131 + &ring_buffers_off, &rb_simple_fops); 2132 + if (!entry) 2133 + pr_warning("Could not create debugfs 'tracing_on' entry\n"); 2134 + 2135 + return 0; 2136 + } 2137 + 2138 + fs_initcall(rb_init_debugfs);