diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ftrace.h | 11 | ||||
| -rw-r--r-- | include/linux/ring_buffer.h | 4 | ||||
| -rw-r--r-- | include/linux/trace_events.h | 20 | ||||
| -rw-r--r-- | include/linux/tracepoint.h | 39 |
4 files changed, 58 insertions, 16 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 6cd8c0ee4b6f..eae6548efbf0 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -263,7 +263,18 @@ static inline void ftrace_kill(void) { } | |||
| 263 | #endif /* CONFIG_FUNCTION_TRACER */ | 263 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 264 | 264 | ||
| 265 | #ifdef CONFIG_STACK_TRACER | 265 | #ifdef CONFIG_STACK_TRACER |
| 266 | |||
| 267 | #define STACK_TRACE_ENTRIES 500 | ||
| 268 | |||
| 269 | struct stack_trace; | ||
| 270 | |||
| 271 | extern unsigned stack_trace_index[]; | ||
| 272 | extern struct stack_trace stack_trace_max; | ||
| 273 | extern unsigned long stack_trace_max_size; | ||
| 274 | extern arch_spinlock_t stack_trace_max_lock; | ||
| 275 | |||
| 266 | extern int stack_tracer_enabled; | 276 | extern int stack_tracer_enabled; |
| 277 | void stack_trace_print(void); | ||
| 267 | int | 278 | int |
| 268 | stack_trace_sysctl(struct ctl_table *table, int write, | 279 | stack_trace_sysctl(struct ctl_table *table, int write, |
| 269 | void __user *buffer, size_t *lenp, | 280 | void __user *buffer, size_t *lenp, |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index e2c13cd863bd..4acc552e9279 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -154,8 +154,8 @@ ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | |||
| 154 | } | 154 | } |
| 155 | #endif | 155 | #endif |
| 156 | 156 | ||
| 157 | int ring_buffer_empty(struct ring_buffer *buffer); | 157 | bool ring_buffer_empty(struct ring_buffer *buffer); |
| 158 | int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); | 158 | bool ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); |
| 159 | 159 | ||
| 160 | void ring_buffer_record_disable(struct ring_buffer *buffer); | 160 | void ring_buffer_record_disable(struct ring_buffer *buffer); |
| 161 | void ring_buffer_record_enable(struct ring_buffer *buffer); | 161 | void ring_buffer_record_enable(struct ring_buffer *buffer); |
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index ed27917cabc9..429fdfc3baf5 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h | |||
| @@ -168,13 +168,12 @@ struct ring_buffer_event * | |||
| 168 | trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, | 168 | trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, |
| 169 | int type, unsigned long len, | 169 | int type, unsigned long len, |
| 170 | unsigned long flags, int pc); | 170 | unsigned long flags, int pc); |
| 171 | void trace_current_buffer_unlock_commit(struct ring_buffer *buffer, | 171 | void trace_buffer_unlock_commit(struct trace_array *tr, |
| 172 | struct ring_buffer_event *event, | 172 | struct ring_buffer *buffer, |
| 173 | unsigned long flags, int pc); | ||
| 174 | void trace_buffer_unlock_commit(struct ring_buffer *buffer, | ||
| 175 | struct ring_buffer_event *event, | 173 | struct ring_buffer_event *event, |
| 176 | unsigned long flags, int pc); | 174 | unsigned long flags, int pc); |
| 177 | void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer, | 175 | void trace_buffer_unlock_commit_regs(struct trace_array *tr, |
| 176 | struct ring_buffer *buffer, | ||
| 178 | struct ring_buffer_event *event, | 177 | struct ring_buffer_event *event, |
| 179 | unsigned long flags, int pc, | 178 | unsigned long flags, int pc, |
| 180 | struct pt_regs *regs); | 179 | struct pt_regs *regs); |
| @@ -329,6 +328,7 @@ enum { | |||
| 329 | EVENT_FILE_FL_SOFT_DISABLED_BIT, | 328 | EVENT_FILE_FL_SOFT_DISABLED_BIT, |
| 330 | EVENT_FILE_FL_TRIGGER_MODE_BIT, | 329 | EVENT_FILE_FL_TRIGGER_MODE_BIT, |
| 331 | EVENT_FILE_FL_TRIGGER_COND_BIT, | 330 | EVENT_FILE_FL_TRIGGER_COND_BIT, |
| 331 | EVENT_FILE_FL_PID_FILTER_BIT, | ||
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| 334 | /* | 334 | /* |
| @@ -342,6 +342,7 @@ enum { | |||
| 342 | * tracepoint may be enabled) | 342 | * tracepoint may be enabled) |
| 343 | * TRIGGER_MODE - When set, invoke the triggers associated with the event | 343 | * TRIGGER_MODE - When set, invoke the triggers associated with the event |
| 344 | * TRIGGER_COND - When set, one or more triggers has an associated filter | 344 | * TRIGGER_COND - When set, one or more triggers has an associated filter |
| 345 | * PID_FILTER - When set, the event is filtered based on pid | ||
| 345 | */ | 346 | */ |
| 346 | enum { | 347 | enum { |
| 347 | EVENT_FILE_FL_ENABLED = (1 << EVENT_FILE_FL_ENABLED_BIT), | 348 | EVENT_FILE_FL_ENABLED = (1 << EVENT_FILE_FL_ENABLED_BIT), |
| @@ -352,6 +353,7 @@ enum { | |||
| 352 | EVENT_FILE_FL_SOFT_DISABLED = (1 << EVENT_FILE_FL_SOFT_DISABLED_BIT), | 353 | EVENT_FILE_FL_SOFT_DISABLED = (1 << EVENT_FILE_FL_SOFT_DISABLED_BIT), |
| 353 | EVENT_FILE_FL_TRIGGER_MODE = (1 << EVENT_FILE_FL_TRIGGER_MODE_BIT), | 354 | EVENT_FILE_FL_TRIGGER_MODE = (1 << EVENT_FILE_FL_TRIGGER_MODE_BIT), |
| 354 | EVENT_FILE_FL_TRIGGER_COND = (1 << EVENT_FILE_FL_TRIGGER_COND_BIT), | 355 | EVENT_FILE_FL_TRIGGER_COND = (1 << EVENT_FILE_FL_TRIGGER_COND_BIT), |
| 356 | EVENT_FILE_FL_PID_FILTER = (1 << EVENT_FILE_FL_PID_FILTER_BIT), | ||
| 355 | }; | 357 | }; |
| 356 | 358 | ||
| 357 | struct trace_event_file { | 359 | struct trace_event_file { |
| @@ -430,6 +432,8 @@ extern enum event_trigger_type event_triggers_call(struct trace_event_file *file | |||
| 430 | extern void event_triggers_post_call(struct trace_event_file *file, | 432 | extern void event_triggers_post_call(struct trace_event_file *file, |
| 431 | enum event_trigger_type tt); | 433 | enum event_trigger_type tt); |
| 432 | 434 | ||
| 435 | bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); | ||
| 436 | |||
| 433 | /** | 437 | /** |
| 434 | * trace_trigger_soft_disabled - do triggers and test if soft disabled | 438 | * trace_trigger_soft_disabled - do triggers and test if soft disabled |
| 435 | * @file: The file pointer of the event to test | 439 | * @file: The file pointer of the event to test |
| @@ -449,6 +453,8 @@ trace_trigger_soft_disabled(struct trace_event_file *file) | |||
| 449 | event_triggers_call(file, NULL); | 453 | event_triggers_call(file, NULL); |
| 450 | if (eflags & EVENT_FILE_FL_SOFT_DISABLED) | 454 | if (eflags & EVENT_FILE_FL_SOFT_DISABLED) |
| 451 | return true; | 455 | return true; |
| 456 | if (eflags & EVENT_FILE_FL_PID_FILTER) | ||
| 457 | return trace_event_ignore_this_pid(file); | ||
| 452 | } | 458 | } |
| 453 | return false; | 459 | return false; |
| 454 | } | 460 | } |
| @@ -508,7 +514,7 @@ event_trigger_unlock_commit(struct trace_event_file *file, | |||
| 508 | enum event_trigger_type tt = ETT_NONE; | 514 | enum event_trigger_type tt = ETT_NONE; |
| 509 | 515 | ||
| 510 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | 516 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
| 511 | trace_buffer_unlock_commit(buffer, event, irq_flags, pc); | 517 | trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); |
| 512 | 518 | ||
| 513 | if (tt) | 519 | if (tt) |
| 514 | event_triggers_post_call(file, tt); | 520 | event_triggers_post_call(file, tt); |
| @@ -540,7 +546,7 @@ event_trigger_unlock_commit_regs(struct trace_event_file *file, | |||
| 540 | enum event_trigger_type tt = ETT_NONE; | 546 | enum event_trigger_type tt = ETT_NONE; |
| 541 | 547 | ||
| 542 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | 548 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) |
| 543 | trace_buffer_unlock_commit_regs(buffer, event, | 549 | trace_buffer_unlock_commit_regs(file->tr, buffer, event, |
| 544 | irq_flags, pc, regs); | 550 | irq_flags, pc, regs); |
| 545 | 551 | ||
| 546 | if (tt) | 552 | if (tt) |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index a5f7f3ecafa3..696a339c592c 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -26,6 +26,7 @@ struct notifier_block; | |||
| 26 | struct tracepoint_func { | 26 | struct tracepoint_func { |
| 27 | void *func; | 27 | void *func; |
| 28 | void *data; | 28 | void *data; |
| 29 | int prio; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | struct tracepoint { | 32 | struct tracepoint { |
| @@ -42,9 +43,14 @@ struct trace_enum_map { | |||
| 42 | unsigned long enum_value; | 43 | unsigned long enum_value; |
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 46 | #define TRACEPOINT_DEFAULT_PRIO 10 | ||
| 47 | |||
| 45 | extern int | 48 | extern int |
| 46 | tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); | 49 | tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); |
| 47 | extern int | 50 | extern int |
| 51 | tracepoint_probe_register_prio(struct tracepoint *tp, void *probe, void *data, | ||
| 52 | int prio); | ||
| 53 | extern int | ||
| 48 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); | 54 | tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data); |
| 49 | extern void | 55 | extern void |
| 50 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), | 56 | for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), |
| @@ -111,7 +117,18 @@ extern void syscall_unregfunc(void); | |||
| 111 | #define TP_ARGS(args...) args | 117 | #define TP_ARGS(args...) args |
| 112 | #define TP_CONDITION(args...) args | 118 | #define TP_CONDITION(args...) args |
| 113 | 119 | ||
| 114 | #ifdef CONFIG_TRACEPOINTS | 120 | /* |
| 121 | * Individual subsystem my have a separate configuration to | ||
| 122 | * enable their tracepoints. By default, this file will create | ||
| 123 | * the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem | ||
| 124 | * wants to be able to disable its tracepoints from being created | ||
| 125 | * it can define NOTRACE before including the tracepoint headers. | ||
| 126 | */ | ||
| 127 | #if defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) | ||
| 128 | #define TRACEPOINTS_ENABLED | ||
| 129 | #endif | ||
| 130 | |||
| 131 | #ifdef TRACEPOINTS_ENABLED | ||
| 115 | 132 | ||
| 116 | /* | 133 | /* |
| 117 | * it_func[0] is never NULL because there is at least one element in the array | 134 | * it_func[0] is never NULL because there is at least one element in the array |
| @@ -167,10 +184,11 @@ extern void syscall_unregfunc(void); | |||
| 167 | * structure. Force alignment to the same alignment as the section start. | 184 | * structure. Force alignment to the same alignment as the section start. |
| 168 | * | 185 | * |
| 169 | * When lockdep is enabled, we make sure to always do the RCU portions of | 186 | * When lockdep is enabled, we make sure to always do the RCU portions of |
| 170 | * the tracepoint code, regardless of whether tracing is on or we match the | 187 | * the tracepoint code, regardless of whether tracing is on. However, |
| 171 | * condition. This lets us find RCU issues triggered with tracepoints even | 188 | * don't check if the condition is false, due to interaction with idle |
| 172 | * when this tracepoint is off. This code has no purpose other than poking | 189 | * instrumentation. This lets us find RCU issues triggered with tracepoints |
| 173 | * RCU a bit. | 190 | * even when this tracepoint is off. This code has no purpose other than |
| 191 | * poking RCU a bit. | ||
| 174 | */ | 192 | */ |
| 175 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 193 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
| 176 | extern struct tracepoint __tracepoint_##name; \ | 194 | extern struct tracepoint __tracepoint_##name; \ |
| @@ -196,6 +214,13 @@ extern void syscall_unregfunc(void); | |||
| 196 | (void *)probe, data); \ | 214 | (void *)probe, data); \ |
| 197 | } \ | 215 | } \ |
| 198 | static inline int \ | 216 | static inline int \ |
| 217 | register_trace_prio_##name(void (*probe)(data_proto), void *data,\ | ||
| 218 | int prio) \ | ||
| 219 | { \ | ||
| 220 | return tracepoint_probe_register_prio(&__tracepoint_##name, \ | ||
| 221 | (void *)probe, data, prio); \ | ||
| 222 | } \ | ||
| 223 | static inline int \ | ||
| 199 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ | 224 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ |
| 200 | { \ | 225 | { \ |
| 201 | return tracepoint_probe_unregister(&__tracepoint_##name,\ | 226 | return tracepoint_probe_unregister(&__tracepoint_##name,\ |
| @@ -234,7 +259,7 @@ extern void syscall_unregfunc(void); | |||
| 234 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | 259 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
| 235 | EXPORT_SYMBOL(__tracepoint_##name) | 260 | EXPORT_SYMBOL(__tracepoint_##name) |
| 236 | 261 | ||
| 237 | #else /* !CONFIG_TRACEPOINTS */ | 262 | #else /* !TRACEPOINTS_ENABLED */ |
| 238 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 263 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
| 239 | static inline void trace_##name(proto) \ | 264 | static inline void trace_##name(proto) \ |
| 240 | { } \ | 265 | { } \ |
| @@ -266,7 +291,7 @@ extern void syscall_unregfunc(void); | |||
| 266 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 291 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
| 267 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 292 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
| 268 | 293 | ||
| 269 | #endif /* CONFIG_TRACEPOINTS */ | 294 | #endif /* TRACEPOINTS_ENABLED */ |
| 270 | 295 | ||
| 271 | #ifdef CONFIG_TRACING | 296 | #ifdef CONFIG_TRACING |
| 272 | /** | 297 | /** |
