diff options
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/define_trace.h | 5 | ||||
| -rw-r--r-- | include/trace/events/lock.h | 55 | ||||
| -rw-r--r-- | include/trace/events/module.h | 18 | ||||
| -rw-r--r-- | include/trace/events/napi.h | 10 | ||||
| -rw-r--r-- | include/trace/events/sched.h | 32 | ||||
| -rw-r--r-- | include/trace/events/signal.h | 52 | ||||
| -rw-r--r-- | include/trace/ftrace.h | 56 |
7 files changed, 104 insertions, 124 deletions
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 5acfb1eb4df9..1dfab5401511 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
| @@ -65,6 +65,10 @@ | |||
| 65 | 65 | ||
| 66 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 66 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 67 | 67 | ||
| 68 | /* Make all open coded DECLARE_TRACE nops */ | ||
| 69 | #undef DECLARE_TRACE | ||
| 70 | #define DECLARE_TRACE(name, proto, args) | ||
| 71 | |||
| 68 | #ifdef CONFIG_EVENT_TRACING | 72 | #ifdef CONFIG_EVENT_TRACING |
| 69 | #include <trace/ftrace.h> | 73 | #include <trace/ftrace.h> |
| 70 | #endif | 74 | #endif |
| @@ -75,6 +79,7 @@ | |||
| 75 | #undef DEFINE_EVENT | 79 | #undef DEFINE_EVENT |
| 76 | #undef DEFINE_EVENT_PRINT | 80 | #undef DEFINE_EVENT_PRINT |
| 77 | #undef TRACE_HEADER_MULTI_READ | 81 | #undef TRACE_HEADER_MULTI_READ |
| 82 | #undef DECLARE_TRACE | ||
| 78 | 83 | ||
| 79 | /* Only undef what we defined in this file */ | 84 | /* Only undef what we defined in this file */ |
| 80 | #ifdef UNDEF_TRACE_INCLUDE_FILE | 85 | #ifdef UNDEF_TRACE_INCLUDE_FILE |
diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h index 5c1dcfc16c60..2821b86de63b 100644 --- a/include/trace/events/lock.h +++ b/include/trace/events/lock.h | |||
| @@ -35,15 +35,15 @@ TRACE_EVENT(lock_acquire, | |||
| 35 | __get_str(name)) | 35 | __get_str(name)) |
| 36 | ); | 36 | ); |
| 37 | 37 | ||
| 38 | TRACE_EVENT(lock_release, | 38 | DECLARE_EVENT_CLASS(lock, |
| 39 | 39 | ||
| 40 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), | 40 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
| 41 | 41 | ||
| 42 | TP_ARGS(lock, nested, ip), | 42 | TP_ARGS(lock, ip), |
| 43 | 43 | ||
| 44 | TP_STRUCT__entry( | 44 | TP_STRUCT__entry( |
| 45 | __string(name, lock->name) | 45 | __string( name, lock->name ) |
| 46 | __field(void *, lockdep_addr) | 46 | __field( void *, lockdep_addr ) |
| 47 | ), | 47 | ), |
| 48 | 48 | ||
| 49 | TP_fast_assign( | 49 | TP_fast_assign( |
| @@ -51,51 +51,30 @@ TRACE_EVENT(lock_release, | |||
| 51 | __entry->lockdep_addr = lock; | 51 | __entry->lockdep_addr = lock; |
| 52 | ), | 52 | ), |
| 53 | 53 | ||
| 54 | TP_printk("%p %s", | 54 | TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) |
| 55 | __entry->lockdep_addr, __get_str(name)) | ||
| 56 | ); | 55 | ); |
| 57 | 56 | ||
| 58 | #ifdef CONFIG_LOCK_STAT | 57 | DEFINE_EVENT(lock, lock_release, |
| 59 | |||
| 60 | TRACE_EVENT(lock_contended, | ||
| 61 | 58 | ||
| 62 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | 59 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
| 63 | 60 | ||
| 64 | TP_ARGS(lock, ip), | 61 | TP_ARGS(lock, ip) |
| 62 | ); | ||
| 65 | 63 | ||
| 66 | TP_STRUCT__entry( | 64 | #ifdef CONFIG_LOCK_STAT |
| 67 | __string(name, lock->name) | ||
| 68 | __field(void *, lockdep_addr) | ||
| 69 | ), | ||
| 70 | 65 | ||
| 71 | TP_fast_assign( | 66 | DEFINE_EVENT(lock, lock_contended, |
| 72 | __assign_str(name, lock->name); | ||
| 73 | __entry->lockdep_addr = lock; | ||
| 74 | ), | ||
| 75 | 67 | ||
| 76 | TP_printk("%p %s", | 68 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
| 77 | __entry->lockdep_addr, __get_str(name)) | ||
| 78 | ); | ||
| 79 | 69 | ||
| 80 | TRACE_EVENT(lock_acquired, | 70 | TP_ARGS(lock, ip) |
| 81 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), | 71 | ); |
| 82 | 72 | ||
| 83 | TP_ARGS(lock, ip, waittime), | 73 | DEFINE_EVENT(lock, lock_acquired, |
| 84 | 74 | ||
| 85 | TP_STRUCT__entry( | 75 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
| 86 | __string(name, lock->name) | ||
| 87 | __field(s64, wait_nsec) | ||
| 88 | __field(void *, lockdep_addr) | ||
| 89 | ), | ||
| 90 | 76 | ||
| 91 | TP_fast_assign( | 77 | TP_ARGS(lock, ip) |
| 92 | __assign_str(name, lock->name); | ||
| 93 | __entry->wait_nsec = waittime; | ||
| 94 | __entry->lockdep_addr = lock; | ||
| 95 | ), | ||
| 96 | TP_printk("%p %s (%llu ns)", __entry->lockdep_addr, | ||
| 97 | __get_str(name), | ||
| 98 | __entry->wait_nsec) | ||
| 99 | ); | 78 | ); |
| 100 | 79 | ||
| 101 | #endif | 80 | #endif |
diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 4b0f48ba16a6..c7bb2f0482fe 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h | |||
| @@ -51,11 +51,14 @@ TRACE_EVENT(module_free, | |||
| 51 | TP_printk("%s", __get_str(name)) | 51 | TP_printk("%s", __get_str(name)) |
| 52 | ); | 52 | ); |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_MODULE_UNLOAD | ||
| 55 | /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */ | ||
| 56 | |||
| 54 | DECLARE_EVENT_CLASS(module_refcnt, | 57 | DECLARE_EVENT_CLASS(module_refcnt, |
| 55 | 58 | ||
| 56 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), | 59 | TP_PROTO(struct module *mod, unsigned long ip), |
| 57 | 60 | ||
| 58 | TP_ARGS(mod, ip, refcnt), | 61 | TP_ARGS(mod, ip), |
| 59 | 62 | ||
| 60 | TP_STRUCT__entry( | 63 | TP_STRUCT__entry( |
| 61 | __field( unsigned long, ip ) | 64 | __field( unsigned long, ip ) |
| @@ -65,7 +68,7 @@ DECLARE_EVENT_CLASS(module_refcnt, | |||
| 65 | 68 | ||
| 66 | TP_fast_assign( | 69 | TP_fast_assign( |
| 67 | __entry->ip = ip; | 70 | __entry->ip = ip; |
| 68 | __entry->refcnt = refcnt; | 71 | __entry->refcnt = __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs); |
| 69 | __assign_str(name, mod->name); | 72 | __assign_str(name, mod->name); |
| 70 | ), | 73 | ), |
| 71 | 74 | ||
| @@ -75,17 +78,18 @@ DECLARE_EVENT_CLASS(module_refcnt, | |||
| 75 | 78 | ||
| 76 | DEFINE_EVENT(module_refcnt, module_get, | 79 | DEFINE_EVENT(module_refcnt, module_get, |
| 77 | 80 | ||
| 78 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), | 81 | TP_PROTO(struct module *mod, unsigned long ip), |
| 79 | 82 | ||
| 80 | TP_ARGS(mod, ip, refcnt) | 83 | TP_ARGS(mod, ip) |
| 81 | ); | 84 | ); |
| 82 | 85 | ||
| 83 | DEFINE_EVENT(module_refcnt, module_put, | 86 | DEFINE_EVENT(module_refcnt, module_put, |
| 84 | 87 | ||
| 85 | TP_PROTO(struct module *mod, unsigned long ip, int refcnt), | 88 | TP_PROTO(struct module *mod, unsigned long ip), |
| 86 | 89 | ||
| 87 | TP_ARGS(mod, ip, refcnt) | 90 | TP_ARGS(mod, ip) |
| 88 | ); | 91 | ); |
| 92 | #endif /* CONFIG_MODULE_UNLOAD */ | ||
| 89 | 93 | ||
| 90 | TRACE_EVENT(module_request, | 94 | TRACE_EVENT(module_request, |
| 91 | 95 | ||
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h index a8989c4547e7..188deca2f3c7 100644 --- a/include/trace/events/napi.h +++ b/include/trace/events/napi.h | |||
| @@ -1,4 +1,7 @@ | |||
| 1 | #ifndef _TRACE_NAPI_H_ | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM napi | ||
| 3 | |||
| 4 | #if !defined(_TRACE_NAPI_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 2 | #define _TRACE_NAPI_H_ | 5 | #define _TRACE_NAPI_H_ |
| 3 | 6 | ||
| 4 | #include <linux/netdevice.h> | 7 | #include <linux/netdevice.h> |
| @@ -8,4 +11,7 @@ DECLARE_TRACE(napi_poll, | |||
| 8 | TP_PROTO(struct napi_struct *napi), | 11 | TP_PROTO(struct napi_struct *napi), |
| 9 | TP_ARGS(napi)); | 12 | TP_ARGS(napi)); |
| 10 | 13 | ||
| 11 | #endif | 14 | #endif /* _TRACE_NAPI_H_ */ |
| 15 | |||
| 16 | /* This part must be outside protection */ | ||
| 17 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index cfceb0b73e20..4f733ecea46e 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -51,15 +51,12 @@ TRACE_EVENT(sched_kthread_stop_ret, | |||
| 51 | 51 | ||
| 52 | /* | 52 | /* |
| 53 | * Tracepoint for waiting on task to unschedule: | 53 | * Tracepoint for waiting on task to unschedule: |
| 54 | * | ||
| 55 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 56 | * but used by the latency tracer plugin. ) | ||
| 57 | */ | 54 | */ |
| 58 | TRACE_EVENT(sched_wait_task, | 55 | TRACE_EVENT(sched_wait_task, |
| 59 | 56 | ||
| 60 | TP_PROTO(struct rq *rq, struct task_struct *p), | 57 | TP_PROTO(struct task_struct *p), |
| 61 | 58 | ||
| 62 | TP_ARGS(rq, p), | 59 | TP_ARGS(p), |
| 63 | 60 | ||
| 64 | TP_STRUCT__entry( | 61 | TP_STRUCT__entry( |
| 65 | __array( char, comm, TASK_COMM_LEN ) | 62 | __array( char, comm, TASK_COMM_LEN ) |
| @@ -79,15 +76,12 @@ TRACE_EVENT(sched_wait_task, | |||
| 79 | 76 | ||
| 80 | /* | 77 | /* |
| 81 | * Tracepoint for waking up a task: | 78 | * Tracepoint for waking up a task: |
| 82 | * | ||
| 83 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 84 | * but used by the latency tracer plugin. ) | ||
| 85 | */ | 79 | */ |
| 86 | DECLARE_EVENT_CLASS(sched_wakeup_template, | 80 | DECLARE_EVENT_CLASS(sched_wakeup_template, |
| 87 | 81 | ||
| 88 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | 82 | TP_PROTO(struct task_struct *p, int success), |
| 89 | 83 | ||
| 90 | TP_ARGS(rq, p, success), | 84 | TP_ARGS(p, success), |
| 91 | 85 | ||
| 92 | TP_STRUCT__entry( | 86 | TP_STRUCT__entry( |
| 93 | __array( char, comm, TASK_COMM_LEN ) | 87 | __array( char, comm, TASK_COMM_LEN ) |
| @@ -111,31 +105,25 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, | |||
| 111 | ); | 105 | ); |
| 112 | 106 | ||
| 113 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, | 107 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, |
| 114 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | 108 | TP_PROTO(struct task_struct *p, int success), |
| 115 | TP_ARGS(rq, p, success)); | 109 | TP_ARGS(p, success)); |
| 116 | 110 | ||
| 117 | /* | 111 | /* |
| 118 | * Tracepoint for waking up a new task: | 112 | * Tracepoint for waking up a new task: |
| 119 | * | ||
| 120 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 121 | * but used by the latency tracer plugin. ) | ||
| 122 | */ | 113 | */ |
| 123 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, | 114 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
| 124 | TP_PROTO(struct rq *rq, struct task_struct *p, int success), | 115 | TP_PROTO(struct task_struct *p, int success), |
| 125 | TP_ARGS(rq, p, success)); | 116 | TP_ARGS(p, success)); |
| 126 | 117 | ||
| 127 | /* | 118 | /* |
| 128 | * Tracepoint for task switches, performed by the scheduler: | 119 | * Tracepoint for task switches, performed by the scheduler: |
| 129 | * | ||
| 130 | * (NOTE: the 'rq' argument is not used by generic trace events, | ||
| 131 | * but used by the latency tracer plugin. ) | ||
| 132 | */ | 120 | */ |
| 133 | TRACE_EVENT(sched_switch, | 121 | TRACE_EVENT(sched_switch, |
| 134 | 122 | ||
| 135 | TP_PROTO(struct rq *rq, struct task_struct *prev, | 123 | TP_PROTO(struct task_struct *prev, |
| 136 | struct task_struct *next), | 124 | struct task_struct *next), |
| 137 | 125 | ||
| 138 | TP_ARGS(rq, prev, next), | 126 | TP_ARGS(prev, next), |
| 139 | 127 | ||
| 140 | TP_STRUCT__entry( | 128 | TP_STRUCT__entry( |
| 141 | __array( char, prev_comm, TASK_COMM_LEN ) | 129 | __array( char, prev_comm, TASK_COMM_LEN ) |
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h index a510b75ac304..814566c99d29 100644 --- a/include/trace/events/signal.h +++ b/include/trace/events/signal.h | |||
| @@ -100,18 +100,7 @@ TRACE_EVENT(signal_deliver, | |||
| 100 | __entry->sa_handler, __entry->sa_flags) | 100 | __entry->sa_handler, __entry->sa_flags) |
| 101 | ); | 101 | ); |
| 102 | 102 | ||
| 103 | /** | 103 | DECLARE_EVENT_CLASS(signal_queue_overflow, |
| 104 | * signal_overflow_fail - called when signal queue is overflow | ||
| 105 | * @sig: signal number | ||
| 106 | * @group: signal to process group or not (bool) | ||
| 107 | * @info: pointer to struct siginfo | ||
| 108 | * | ||
| 109 | * Kernel fails to generate 'sig' signal with 'info' siginfo, because | ||
| 110 | * siginfo queue is overflow, and the signal is dropped. | ||
| 111 | * 'group' is not 0 if the signal will be sent to a process group. | ||
| 112 | * 'sig' is always one of RT signals. | ||
| 113 | */ | ||
| 114 | TRACE_EVENT(signal_overflow_fail, | ||
| 115 | 104 | ||
| 116 | TP_PROTO(int sig, int group, struct siginfo *info), | 105 | TP_PROTO(int sig, int group, struct siginfo *info), |
| 117 | 106 | ||
| @@ -135,6 +124,24 @@ TRACE_EVENT(signal_overflow_fail, | |||
| 135 | ); | 124 | ); |
| 136 | 125 | ||
| 137 | /** | 126 | /** |
| 127 | * signal_overflow_fail - called when signal queue is overflow | ||
| 128 | * @sig: signal number | ||
| 129 | * @group: signal to process group or not (bool) | ||
| 130 | * @info: pointer to struct siginfo | ||
| 131 | * | ||
| 132 | * Kernel fails to generate 'sig' signal with 'info' siginfo, because | ||
| 133 | * siginfo queue is overflow, and the signal is dropped. | ||
| 134 | * 'group' is not 0 if the signal will be sent to a process group. | ||
| 135 | * 'sig' is always one of RT signals. | ||
| 136 | */ | ||
| 137 | DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail, | ||
| 138 | |||
| 139 | TP_PROTO(int sig, int group, struct siginfo *info), | ||
| 140 | |||
| 141 | TP_ARGS(sig, group, info) | ||
| 142 | ); | ||
| 143 | |||
| 144 | /** | ||
| 138 | * signal_lose_info - called when siginfo is lost | 145 | * signal_lose_info - called when siginfo is lost |
| 139 | * @sig: signal number | 146 | * @sig: signal number |
| 140 | * @group: signal to process group or not (bool) | 147 | * @group: signal to process group or not (bool) |
| @@ -145,28 +152,13 @@ TRACE_EVENT(signal_overflow_fail, | |||
| 145 | * 'group' is not 0 if the signal will be sent to a process group. | 152 | * 'group' is not 0 if the signal will be sent to a process group. |
| 146 | * 'sig' is always one of non-RT signals. | 153 | * 'sig' is always one of non-RT signals. |
| 147 | */ | 154 | */ |
| 148 | TRACE_EVENT(signal_lose_info, | 155 | DEFINE_EVENT(signal_queue_overflow, signal_lose_info, |
| 149 | 156 | ||
| 150 | TP_PROTO(int sig, int group, struct siginfo *info), | 157 | TP_PROTO(int sig, int group, struct siginfo *info), |
| 151 | 158 | ||
| 152 | TP_ARGS(sig, group, info), | 159 | TP_ARGS(sig, group, info) |
| 153 | |||
| 154 | TP_STRUCT__entry( | ||
| 155 | __field( int, sig ) | ||
| 156 | __field( int, group ) | ||
| 157 | __field( int, errno ) | ||
| 158 | __field( int, code ) | ||
| 159 | ), | ||
| 160 | |||
| 161 | TP_fast_assign( | ||
| 162 | __entry->sig = sig; | ||
| 163 | __entry->group = group; | ||
| 164 | TP_STORE_SIGINFO(__entry, info); | ||
| 165 | ), | ||
| 166 | |||
| 167 | TP_printk("sig=%d group=%d errno=%d code=%d", | ||
| 168 | __entry->sig, __entry->group, __entry->errno, __entry->code) | ||
| 169 | ); | 160 | ); |
| 161 | |||
| 170 | #endif /* _TRACE_SIGNAL_H */ | 162 | #endif /* _TRACE_SIGNAL_H */ |
| 171 | 163 | ||
| 172 | /* This part must be outside protection */ | 164 | /* This part must be outside protection */ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index ea6f9d4a20e9..16253db38d73 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -154,9 +154,11 @@ | |||
| 154 | * | 154 | * |
| 155 | * field = (typeof(field))entry; | 155 | * field = (typeof(field))entry; |
| 156 | * | 156 | * |
| 157 | * p = get_cpu_var(ftrace_event_seq); | 157 | * p = &get_cpu_var(ftrace_event_seq); |
| 158 | * trace_seq_init(p); | 158 | * trace_seq_init(p); |
| 159 | * ret = trace_seq_printf(s, <TP_printk> "\n"); | 159 | * ret = trace_seq_printf(s, "%s: ", <call>); |
| 160 | * if (ret) | ||
| 161 | * ret = trace_seq_printf(s, <TP_printk> "\n"); | ||
| 160 | * put_cpu(); | 162 | * put_cpu(); |
| 161 | * if (!ret) | 163 | * if (!ret) |
| 162 | * return TRACE_TYPE_PARTIAL_LINE; | 164 | * return TRACE_TYPE_PARTIAL_LINE; |
| @@ -450,38 +452,38 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \ | |||
| 450 | * | 452 | * |
| 451 | * static void ftrace_raw_event_<call>(proto) | 453 | * static void ftrace_raw_event_<call>(proto) |
| 452 | * { | 454 | * { |
| 455 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; | ||
| 453 | * struct ring_buffer_event *event; | 456 | * struct ring_buffer_event *event; |
| 454 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 | 457 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 |
| 455 | * struct ring_buffer *buffer; | 458 | * struct ring_buffer *buffer; |
| 456 | * unsigned long irq_flags; | 459 | * unsigned long irq_flags; |
| 460 | * int __data_size; | ||
| 457 | * int pc; | 461 | * int pc; |
| 458 | * | 462 | * |
| 459 | * local_save_flags(irq_flags); | 463 | * local_save_flags(irq_flags); |
| 460 | * pc = preempt_count(); | 464 | * pc = preempt_count(); |
| 461 | * | 465 | * |
| 466 | * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); | ||
| 467 | * | ||
| 462 | * event = trace_current_buffer_lock_reserve(&buffer, | 468 | * event = trace_current_buffer_lock_reserve(&buffer, |
| 463 | * event_<call>.id, | 469 | * event_<call>.id, |
| 464 | * sizeof(struct ftrace_raw_<call>), | 470 | * sizeof(*entry) + __data_size, |
| 465 | * irq_flags, pc); | 471 | * irq_flags, pc); |
| 466 | * if (!event) | 472 | * if (!event) |
| 467 | * return; | 473 | * return; |
| 468 | * entry = ring_buffer_event_data(event); | 474 | * entry = ring_buffer_event_data(event); |
| 469 | * | 475 | * |
| 470 | * <assign>; <-- Here we assign the entries by the __field and | 476 | * { <assign>; } <-- Here we assign the entries by the __field and |
| 471 | * __array macros. | 477 | * __array macros. |
| 472 | * | 478 | * |
| 473 | * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); | 479 | * if (!filter_current_check_discard(buffer, event_call, entry, event)) |
| 480 | * trace_current_buffer_unlock_commit(buffer, | ||
| 481 | * event, irq_flags, pc); | ||
| 474 | * } | 482 | * } |
| 475 | * | 483 | * |
| 476 | * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) | 484 | * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) |
| 477 | * { | 485 | * { |
| 478 | * int ret; | 486 | * return register_trace_<call>(ftrace_raw_event_<call>); |
| 479 | * | ||
| 480 | * ret = register_trace_<call>(ftrace_raw_event_<call>); | ||
| 481 | * if (!ret) | ||
| 482 | * pr_info("event trace: Could not activate trace point " | ||
| 483 | * "probe to <call>"); | ||
| 484 | * return ret; | ||
| 485 | * } | 487 | * } |
| 486 | * | 488 | * |
| 487 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) | 489 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) |
| @@ -493,6 +495,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \ | |||
| 493 | * .trace = ftrace_raw_output_<call>, <-- stage 2 | 495 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
| 494 | * }; | 496 | * }; |
| 495 | * | 497 | * |
| 498 | * static const char print_fmt_<call>[] = <TP_printk>; | ||
| 499 | * | ||
| 496 | * static struct ftrace_event_call __used | 500 | * static struct ftrace_event_call __used |
| 497 | * __attribute__((__aligned__(4))) | 501 | * __attribute__((__aligned__(4))) |
| 498 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 502 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
| @@ -501,6 +505,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \ | |||
| 501 | * .raw_init = trace_event_raw_init, | 505 | * .raw_init = trace_event_raw_init, |
| 502 | * .regfunc = ftrace_reg_event_<call>, | 506 | * .regfunc = ftrace_reg_event_<call>, |
| 503 | * .unregfunc = ftrace_unreg_event_<call>, | 507 | * .unregfunc = ftrace_unreg_event_<call>, |
| 508 | * .print_fmt = print_fmt_<call>, | ||
| 509 | * .define_fields = ftrace_define_fields_<call>, | ||
| 504 | * } | 510 | * } |
| 505 | * | 511 | * |
| 506 | */ | 512 | */ |
| @@ -569,7 +575,6 @@ ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \ | |||
| 569 | return; \ | 575 | return; \ |
| 570 | entry = ring_buffer_event_data(event); \ | 576 | entry = ring_buffer_event_data(event); \ |
| 571 | \ | 577 | \ |
| 572 | \ | ||
| 573 | tstruct \ | 578 | tstruct \ |
| 574 | \ | 579 | \ |
| 575 | { assign; } \ | 580 | { assign; } \ |
| @@ -758,13 +763,12 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 758 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ | 763 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| 759 | static notrace void \ | 764 | static notrace void \ |
| 760 | perf_trace_templ_##call(struct ftrace_event_call *event_call, \ | 765 | perf_trace_templ_##call(struct ftrace_event_call *event_call, \ |
| 761 | proto) \ | 766 | struct pt_regs *__regs, proto) \ |
| 762 | { \ | 767 | { \ |
| 763 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 768 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
| 764 | struct ftrace_raw_##call *entry; \ | 769 | struct ftrace_raw_##call *entry; \ |
| 765 | u64 __addr = 0, __count = 1; \ | 770 | u64 __addr = 0, __count = 1; \ |
| 766 | unsigned long irq_flags; \ | 771 | unsigned long irq_flags; \ |
| 767 | struct pt_regs *__regs; \ | ||
| 768 | int __entry_size; \ | 772 | int __entry_size; \ |
| 769 | int __data_size; \ | 773 | int __data_size; \ |
| 770 | int rctx; \ | 774 | int rctx; \ |
| @@ -785,20 +789,22 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call, \ | |||
| 785 | \ | 789 | \ |
| 786 | { assign; } \ | 790 | { assign; } \ |
| 787 | \ | 791 | \ |
| 788 | __regs = &__get_cpu_var(perf_trace_regs); \ | ||
| 789 | perf_fetch_caller_regs(__regs, 2); \ | ||
| 790 | \ | ||
| 791 | perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ | 792 | perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ |
| 792 | __count, irq_flags, __regs); \ | 793 | __count, irq_flags, __regs); \ |
| 793 | } | 794 | } |
| 794 | 795 | ||
| 795 | #undef DEFINE_EVENT | 796 | #undef DEFINE_EVENT |
| 796 | #define DEFINE_EVENT(template, call, proto, args) \ | 797 | #define DEFINE_EVENT(template, call, proto, args) \ |
| 797 | static notrace void perf_trace_##call(proto) \ | 798 | static notrace void perf_trace_##call(proto) \ |
| 798 | { \ | 799 | { \ |
| 799 | struct ftrace_event_call *event_call = &event_##call; \ | 800 | struct ftrace_event_call *event_call = &event_##call; \ |
| 800 | \ | 801 | struct pt_regs *__regs = &get_cpu_var(perf_trace_regs); \ |
| 801 | perf_trace_templ_##template(event_call, args); \ | 802 | \ |
| 803 | perf_fetch_caller_regs(__regs, 1); \ | ||
| 804 | \ | ||
| 805 | perf_trace_templ_##template(event_call, __regs, args); \ | ||
| 806 | \ | ||
| 807 | put_cpu_var(perf_trace_regs); \ | ||
| 802 | } | 808 | } |
| 803 | 809 | ||
| 804 | #undef DEFINE_EVENT_PRINT | 810 | #undef DEFINE_EVENT_PRINT |
