diff options
| -rw-r--r-- | Documentation/trace/ftrace.txt | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/process.c | 24 | ||||
| -rw-r--r-- | drivers/cpuidle/cpuidle.c | 8 | ||||
| -rw-r--r-- | include/linux/ftrace.h | 4 | ||||
| -rw-r--r-- | include/linux/interrupt.h | 7 | ||||
| -rw-r--r-- | include/linux/tracepoint.h | 22 | ||||
| -rw-r--r-- | include/trace/events/power.h | 2 | ||||
| -rw-r--r-- | include/trace/events/printk.h | 41 | ||||
| -rw-r--r-- | kernel/irq/chip.c | 2 | ||||
| -rw-r--r-- | kernel/printk.c | 5 | ||||
| -rw-r--r-- | kernel/softirq.c | 6 | ||||
| -rw-r--r-- | kernel/trace/ftrace.c | 17 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 6 | ||||
| -rw-r--r-- | kernel/trace/trace_events_filter.c | 7 | ||||
| -rw-r--r-- | kernel/trace/trace_syscalls.c | 4 |
15 files changed, 118 insertions, 44 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 1ebc24cf9a55..6f51fed45f2d 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
| @@ -226,6 +226,13 @@ Here is the list of current tracers that may be configured. | |||
| 226 | Traces and records the max latency that it takes for | 226 | Traces and records the max latency that it takes for |
| 227 | the highest priority task to get scheduled after | 227 | the highest priority task to get scheduled after |
| 228 | it has been woken up. | 228 | it has been woken up. |
| 229 | Traces all tasks as an average developer would expect. | ||
| 230 | |||
| 231 | "wakeup_rt" | ||
| 232 | |||
| 233 | Traces and records the max latency that it takes for just | ||
| 234 | RT tasks (as the current "wakeup" does). This is useful | ||
| 235 | for those interested in wake up timings of RT tasks. | ||
| 229 | 236 | ||
| 230 | "hw-branch-tracer" | 237 | "hw-branch-tracer" |
| 231 | 238 | ||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 15763af7bfe3..44eefde92109 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
| @@ -377,8 +377,8 @@ static inline int hlt_use_halt(void) | |||
| 377 | void default_idle(void) | 377 | void default_idle(void) |
| 378 | { | 378 | { |
| 379 | if (hlt_use_halt()) { | 379 | if (hlt_use_halt()) { |
| 380 | trace_power_start(POWER_CSTATE, 1, smp_processor_id()); | 380 | trace_power_start_rcuidle(POWER_CSTATE, 1, smp_processor_id()); |
| 381 | trace_cpu_idle(1, smp_processor_id()); | 381 | trace_cpu_idle_rcuidle(1, smp_processor_id()); |
| 382 | current_thread_info()->status &= ~TS_POLLING; | 382 | current_thread_info()->status &= ~TS_POLLING; |
| 383 | /* | 383 | /* |
| 384 | * TS_POLLING-cleared state must be visible before we | 384 | * TS_POLLING-cleared state must be visible before we |
| @@ -391,8 +391,8 @@ void default_idle(void) | |||
| 391 | else | 391 | else |
| 392 | local_irq_enable(); | 392 | local_irq_enable(); |
| 393 | current_thread_info()->status |= TS_POLLING; | 393 | current_thread_info()->status |= TS_POLLING; |
| 394 | trace_power_end(smp_processor_id()); | 394 | trace_power_end_rcuidle(smp_processor_id()); |
| 395 | trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()); | 395 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); |
| 396 | } else { | 396 | } else { |
| 397 | local_irq_enable(); | 397 | local_irq_enable(); |
| 398 | /* loop is done by the caller */ | 398 | /* loop is done by the caller */ |
| @@ -450,8 +450,8 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait); | |||
| 450 | static void mwait_idle(void) | 450 | static void mwait_idle(void) |
| 451 | { | 451 | { |
| 452 | if (!need_resched()) { | 452 | if (!need_resched()) { |
| 453 | trace_power_start(POWER_CSTATE, 1, smp_processor_id()); | 453 | trace_power_start_rcuidle(POWER_CSTATE, 1, smp_processor_id()); |
| 454 | trace_cpu_idle(1, smp_processor_id()); | 454 | trace_cpu_idle_rcuidle(1, smp_processor_id()); |
| 455 | if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) | 455 | if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) |
| 456 | clflush((void *)¤t_thread_info()->flags); | 456 | clflush((void *)¤t_thread_info()->flags); |
| 457 | 457 | ||
| @@ -461,8 +461,8 @@ static void mwait_idle(void) | |||
| 461 | __sti_mwait(0, 0); | 461 | __sti_mwait(0, 0); |
| 462 | else | 462 | else |
| 463 | local_irq_enable(); | 463 | local_irq_enable(); |
| 464 | trace_power_end(smp_processor_id()); | 464 | trace_power_end_rcuidle(smp_processor_id()); |
| 465 | trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()); | 465 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); |
| 466 | } else | 466 | } else |
| 467 | local_irq_enable(); | 467 | local_irq_enable(); |
| 468 | } | 468 | } |
| @@ -474,13 +474,13 @@ static void mwait_idle(void) | |||
| 474 | */ | 474 | */ |
| 475 | static void poll_idle(void) | 475 | static void poll_idle(void) |
| 476 | { | 476 | { |
| 477 | trace_power_start(POWER_CSTATE, 0, smp_processor_id()); | 477 | trace_power_start_rcuidle(POWER_CSTATE, 0, smp_processor_id()); |
| 478 | trace_cpu_idle(0, smp_processor_id()); | 478 | trace_cpu_idle_rcuidle(0, smp_processor_id()); |
| 479 | local_irq_enable(); | 479 | local_irq_enable(); |
| 480 | while (!need_resched()) | 480 | while (!need_resched()) |
| 481 | cpu_relax(); | 481 | cpu_relax(); |
| 482 | trace_power_end(smp_processor_id()); | 482 | trace_power_end_rcuidle(smp_processor_id()); |
| 483 | trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()); | 483 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | /* | 486 | /* |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 59f4261c753a..6588f43017bd 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -94,13 +94,13 @@ int cpuidle_idle_call(void) | |||
| 94 | 94 | ||
| 95 | target_state = &drv->states[next_state]; | 95 | target_state = &drv->states[next_state]; |
| 96 | 96 | ||
| 97 | trace_power_start(POWER_CSTATE, next_state, dev->cpu); | 97 | trace_power_start_rcuidle(POWER_CSTATE, next_state, dev->cpu); |
| 98 | trace_cpu_idle(next_state, dev->cpu); | 98 | trace_cpu_idle_rcuidle(next_state, dev->cpu); |
| 99 | 99 | ||
| 100 | entered_state = target_state->enter(dev, drv, next_state); | 100 | entered_state = target_state->enter(dev, drv, next_state); |
| 101 | 101 | ||
| 102 | trace_power_end(dev->cpu); | 102 | trace_power_end_rcuidle(dev->cpu); |
| 103 | trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu); | 103 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); |
| 104 | 104 | ||
| 105 | if (entered_state >= 0) { | 105 | if (entered_state >= 0) { |
| 106 | /* Update cpuidle counters */ | 106 | /* Update cpuidle counters */ |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 028e26f0bf08..f33fb3b041c6 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -178,9 +178,9 @@ struct dyn_ftrace { | |||
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | int ftrace_force_update(void); | 180 | int ftrace_force_update(void); |
| 181 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 181 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
| 182 | int len, int reset); | 182 | int len, int reset); |
| 183 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 183 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
| 184 | int len, int reset); | 184 | int len, int reset); |
| 185 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); | 185 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); |
| 186 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); | 186 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a64b00e286f5..3f830e005118 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/atomic.h> | 20 | #include <linux/atomic.h> |
| 21 | #include <asm/ptrace.h> | 21 | #include <asm/ptrace.h> |
| 22 | #include <asm/system.h> | 22 | #include <asm/system.h> |
| 23 | #include <trace/events/irq.h> | ||
| 24 | 23 | ||
| 25 | /* | 24 | /* |
| 26 | * These correspond to the IORESOURCE_IRQ_* defines in | 25 | * These correspond to the IORESOURCE_IRQ_* defines in |
| @@ -456,11 +455,7 @@ asmlinkage void do_softirq(void); | |||
| 456 | asmlinkage void __do_softirq(void); | 455 | asmlinkage void __do_softirq(void); |
| 457 | extern void open_softirq(int nr, void (*action)(struct softirq_action *)); | 456 | extern void open_softirq(int nr, void (*action)(struct softirq_action *)); |
| 458 | extern void softirq_init(void); | 457 | extern void softirq_init(void); |
| 459 | static inline void __raise_softirq_irqoff(unsigned int nr) | 458 | extern void __raise_softirq_irqoff(unsigned int nr); |
| 460 | { | ||
| 461 | trace_softirq_raise(nr); | ||
| 462 | or_softirq_pending(1UL << nr); | ||
| 463 | } | ||
| 464 | 459 | ||
| 465 | extern void raise_softirq_irqoff(unsigned int nr); | 460 | extern void raise_softirq_irqoff(unsigned int nr); |
| 466 | extern void raise_softirq(unsigned int nr); | 461 | extern void raise_softirq(unsigned int nr); |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index df0a779c1bbd..fc36da97ff7e 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -114,7 +114,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 114 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just | 114 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just |
| 115 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". | 115 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". |
| 116 | */ | 116 | */ |
| 117 | #define __DO_TRACE(tp, proto, args, cond) \ | 117 | #define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) \ |
| 118 | do { \ | 118 | do { \ |
| 119 | struct tracepoint_func *it_func_ptr; \ | 119 | struct tracepoint_func *it_func_ptr; \ |
| 120 | void *it_func; \ | 120 | void *it_func; \ |
| @@ -122,6 +122,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 122 | \ | 122 | \ |
| 123 | if (!(cond)) \ | 123 | if (!(cond)) \ |
| 124 | return; \ | 124 | return; \ |
| 125 | prercu; \ | ||
| 125 | rcu_read_lock_sched_notrace(); \ | 126 | rcu_read_lock_sched_notrace(); \ |
| 126 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ | 127 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ |
| 127 | if (it_func_ptr) { \ | 128 | if (it_func_ptr) { \ |
| @@ -132,6 +133,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 132 | } while ((++it_func_ptr)->func); \ | 133 | } while ((++it_func_ptr)->func); \ |
| 133 | } \ | 134 | } \ |
| 134 | rcu_read_unlock_sched_notrace(); \ | 135 | rcu_read_unlock_sched_notrace(); \ |
| 136 | postrcu; \ | ||
| 135 | } while (0) | 137 | } while (0) |
| 136 | 138 | ||
| 137 | /* | 139 | /* |
| @@ -139,7 +141,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 139 | * not add unwanted padding between the beginning of the section and the | 141 | * not add unwanted padding between the beginning of the section and the |
| 140 | * structure. Force alignment to the same alignment as the section start. | 142 | * structure. Force alignment to the same alignment as the section start. |
| 141 | */ | 143 | */ |
| 142 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 144 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
| 143 | extern struct tracepoint __tracepoint_##name; \ | 145 | extern struct tracepoint __tracepoint_##name; \ |
| 144 | static inline void trace_##name(proto) \ | 146 | static inline void trace_##name(proto) \ |
| 145 | { \ | 147 | { \ |
| @@ -147,7 +149,17 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 147 | __DO_TRACE(&__tracepoint_##name, \ | 149 | __DO_TRACE(&__tracepoint_##name, \ |
| 148 | TP_PROTO(data_proto), \ | 150 | TP_PROTO(data_proto), \ |
| 149 | TP_ARGS(data_args), \ | 151 | TP_ARGS(data_args), \ |
| 150 | TP_CONDITION(cond)); \ | 152 | TP_CONDITION(cond),,); \ |
| 153 | } \ | ||
| 154 | static inline void trace_##name##_rcuidle(proto) \ | ||
| 155 | { \ | ||
| 156 | if (static_branch(&__tracepoint_##name.key)) \ | ||
| 157 | __DO_TRACE(&__tracepoint_##name, \ | ||
| 158 | TP_PROTO(data_proto), \ | ||
| 159 | TP_ARGS(data_args), \ | ||
| 160 | TP_CONDITION(cond), \ | ||
| 161 | rcu_idle_exit(), \ | ||
| 162 | rcu_idle_enter()); \ | ||
| 151 | } \ | 163 | } \ |
| 152 | static inline int \ | 164 | static inline int \ |
| 153 | register_trace_##name(void (*probe)(data_proto), void *data) \ | 165 | register_trace_##name(void (*probe)(data_proto), void *data) \ |
| @@ -190,9 +202,11 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 190 | EXPORT_SYMBOL(__tracepoint_##name) | 202 | EXPORT_SYMBOL(__tracepoint_##name) |
| 191 | 203 | ||
| 192 | #else /* !CONFIG_TRACEPOINTS */ | 204 | #else /* !CONFIG_TRACEPOINTS */ |
| 193 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ | 205 | #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ |
| 194 | static inline void trace_##name(proto) \ | 206 | static inline void trace_##name(proto) \ |
| 195 | { } \ | 207 | { } \ |
| 208 | static inline void trace_##name##_rcuidle(proto) \ | ||
| 209 | { } \ | ||
| 196 | static inline int \ | 210 | static inline int \ |
| 197 | register_trace_##name(void (*probe)(data_proto), \ | 211 | register_trace_##name(void (*probe)(data_proto), \ |
| 198 | void *data) \ | 212 | void *data) \ |
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 1bcc2a8c00e2..14b38940062b 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
| @@ -151,6 +151,8 @@ enum { | |||
| 151 | events get removed */ | 151 | events get removed */ |
| 152 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; | 152 | static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {}; |
| 153 | static inline void trace_power_end(u64 cpuid) {}; | 153 | static inline void trace_power_end(u64 cpuid) {}; |
| 154 | static inline void trace_power_start_rcuidle(u64 type, u64 state, u64 cpuid) {}; | ||
| 155 | static inline void trace_power_end_rcuidle(u64 cpuid) {}; | ||
| 154 | static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; | 156 | static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {}; |
| 155 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ | 157 | #endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */ |
| 156 | 158 | ||
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h new file mode 100644 index 000000000000..94ec79cc011a --- /dev/null +++ b/include/trace/events/printk.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM printk | ||
| 3 | |||
| 4 | #if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_PRINTK_H | ||
| 6 | |||
| 7 | #include <linux/tracepoint.h> | ||
| 8 | |||
| 9 | TRACE_EVENT_CONDITION(console, | ||
| 10 | TP_PROTO(const char *log_buf, unsigned start, unsigned end, | ||
| 11 | unsigned log_buf_len), | ||
| 12 | |||
| 13 | TP_ARGS(log_buf, start, end, log_buf_len), | ||
| 14 | |||
| 15 | TP_CONDITION(start != end), | ||
| 16 | |||
| 17 | TP_STRUCT__entry( | ||
| 18 | __dynamic_array(char, msg, end - start + 1) | ||
| 19 | ), | ||
| 20 | |||
| 21 | TP_fast_assign( | ||
| 22 | if ((start & (log_buf_len - 1)) > (end & (log_buf_len - 1))) { | ||
| 23 | memcpy(__get_dynamic_array(msg), | ||
| 24 | log_buf + (start & (log_buf_len - 1)), | ||
| 25 | log_buf_len - (start & (log_buf_len - 1))); | ||
| 26 | memcpy((char *)__get_dynamic_array(msg) + | ||
| 27 | log_buf_len - (start & (log_buf_len - 1)), | ||
| 28 | log_buf, end & (log_buf_len - 1)); | ||
| 29 | } else | ||
| 30 | memcpy(__get_dynamic_array(msg), | ||
| 31 | log_buf + (start & (log_buf_len - 1)), | ||
| 32 | end - start); | ||
| 33 | ((char *)__get_dynamic_array(msg))[end - start] = 0; | ||
| 34 | ), | ||
| 35 | |||
| 36 | TP_printk("%s", __get_str(msg)) | ||
| 37 | ); | ||
| 38 | #endif /* _TRACE_PRINTK_H */ | ||
| 39 | |||
| 40 | /* This part must be outside protection */ | ||
| 41 | #include <trace/define_trace.h> | ||
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index f7c543a801d9..fc418249f01f 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
| 18 | 18 | ||
| 19 | #include <trace/events/irq.h> | ||
| 20 | |||
| 19 | #include "internals.h" | 21 | #include "internals.h" |
| 20 | 22 | ||
| 21 | /** | 23 | /** |
diff --git a/kernel/printk.c b/kernel/printk.c index 13c0a1143f49..cb8a6bd697c6 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -44,6 +44,9 @@ | |||
| 44 | 44 | ||
| 45 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
| 46 | 46 | ||
| 47 | #define CREATE_TRACE_POINTS | ||
| 48 | #include <trace/events/printk.h> | ||
| 49 | |||
| 47 | /* | 50 | /* |
| 48 | * Architectures can override it: | 51 | * Architectures can override it: |
| 49 | */ | 52 | */ |
| @@ -542,6 +545,8 @@ MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to" | |||
| 542 | static void _call_console_drivers(unsigned start, | 545 | static void _call_console_drivers(unsigned start, |
| 543 | unsigned end, int msg_log_level) | 546 | unsigned end, int msg_log_level) |
| 544 | { | 547 | { |
| 548 | trace_console(&LOG_BUF(0), start, end, log_buf_len); | ||
| 549 | |||
| 545 | if ((msg_log_level < console_loglevel || ignore_loglevel) && | 550 | if ((msg_log_level < console_loglevel || ignore_loglevel) && |
| 546 | console_drivers && start != end) { | 551 | console_drivers && start != end) { |
| 547 | if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { | 552 | if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { |
diff --git a/kernel/softirq.c b/kernel/softirq.c index 4eb3a0fa351e..06d40993594a 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
| @@ -385,6 +385,12 @@ void raise_softirq(unsigned int nr) | |||
| 385 | local_irq_restore(flags); | 385 | local_irq_restore(flags); |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | void __raise_softirq_irqoff(unsigned int nr) | ||
| 389 | { | ||
| 390 | trace_softirq_raise(nr); | ||
| 391 | or_softirq_pending(1UL << nr); | ||
| 392 | } | ||
| 393 | |||
| 388 | void open_softirq(int nr, void (*action)(struct softirq_action *)) | 394 | void open_softirq(int nr, void (*action)(struct softirq_action *)) |
| 389 | { | 395 | { |
| 390 | softirq_vec[nr].action = action; | 396 | softirq_vec[nr].action = action; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 683d559a0eef..d1499e910fe8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1129,7 +1129,7 @@ static struct ftrace_hash *alloc_ftrace_hash(int size_bits) | |||
| 1129 | return NULL; | 1129 | return NULL; |
| 1130 | 1130 | ||
| 1131 | size = 1 << size_bits; | 1131 | size = 1 << size_bits; |
| 1132 | hash->buckets = kzalloc(sizeof(*hash->buckets) * size, GFP_KERNEL); | 1132 | hash->buckets = kcalloc(size, sizeof(*hash->buckets), GFP_KERNEL); |
| 1133 | 1133 | ||
| 1134 | if (!hash->buckets) { | 1134 | if (!hash->buckets) { |
| 1135 | kfree(hash); | 1135 | kfree(hash); |
| @@ -3146,8 +3146,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
| 3146 | mutex_lock(&ftrace_regex_lock); | 3146 | mutex_lock(&ftrace_regex_lock); |
| 3147 | if (reset) | 3147 | if (reset) |
| 3148 | ftrace_filter_reset(hash); | 3148 | ftrace_filter_reset(hash); |
| 3149 | if (buf) | 3149 | if (buf && !ftrace_match_records(hash, buf, len)) { |
| 3150 | ftrace_match_records(hash, buf, len); | 3150 | ret = -EINVAL; |
| 3151 | goto out_regex_unlock; | ||
| 3152 | } | ||
| 3151 | 3153 | ||
| 3152 | mutex_lock(&ftrace_lock); | 3154 | mutex_lock(&ftrace_lock); |
| 3153 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3155 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
| @@ -3157,6 +3159,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
| 3157 | 3159 | ||
| 3158 | mutex_unlock(&ftrace_lock); | 3160 | mutex_unlock(&ftrace_lock); |
| 3159 | 3161 | ||
| 3162 | out_regex_unlock: | ||
| 3160 | mutex_unlock(&ftrace_regex_lock); | 3163 | mutex_unlock(&ftrace_regex_lock); |
| 3161 | 3164 | ||
| 3162 | free_ftrace_hash(hash); | 3165 | free_ftrace_hash(hash); |
| @@ -3173,10 +3176,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
| 3173 | * Filters denote which functions should be enabled when tracing is enabled. | 3176 | * Filters denote which functions should be enabled when tracing is enabled. |
| 3174 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. | 3177 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. |
| 3175 | */ | 3178 | */ |
| 3176 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 3179 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
| 3177 | int len, int reset) | 3180 | int len, int reset) |
| 3178 | { | 3181 | { |
| 3179 | ftrace_set_regex(ops, buf, len, reset, 1); | 3182 | return ftrace_set_regex(ops, buf, len, reset, 1); |
| 3180 | } | 3183 | } |
| 3181 | EXPORT_SYMBOL_GPL(ftrace_set_filter); | 3184 | EXPORT_SYMBOL_GPL(ftrace_set_filter); |
| 3182 | 3185 | ||
| @@ -3191,10 +3194,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter); | |||
| 3191 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled | 3194 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled |
| 3192 | * for tracing. | 3195 | * for tracing. |
| 3193 | */ | 3196 | */ |
| 3194 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 3197 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
| 3195 | int len, int reset) | 3198 | int len, int reset) |
| 3196 | { | 3199 | { |
| 3197 | ftrace_set_regex(ops, buf, len, reset, 0); | 3200 | return ftrace_set_regex(ops, buf, len, reset, 0); |
| 3198 | } | 3201 | } |
| 3199 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); | 3202 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); |
| 3200 | /** | 3203 | /** |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a3f1bc5d2a00..10d5503f0d04 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -2764,12 +2764,12 @@ static const char readme_msg[] = | |||
| 2764 | "tracing mini-HOWTO:\n\n" | 2764 | "tracing mini-HOWTO:\n\n" |
| 2765 | "# mount -t debugfs nodev /sys/kernel/debug\n\n" | 2765 | "# mount -t debugfs nodev /sys/kernel/debug\n\n" |
| 2766 | "# cat /sys/kernel/debug/tracing/available_tracers\n" | 2766 | "# cat /sys/kernel/debug/tracing/available_tracers\n" |
| 2767 | "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" | 2767 | "wakeup wakeup_rt preemptirqsoff preemptoff irqsoff function nop\n\n" |
| 2768 | "# cat /sys/kernel/debug/tracing/current_tracer\n" | 2768 | "# cat /sys/kernel/debug/tracing/current_tracer\n" |
| 2769 | "nop\n" | 2769 | "nop\n" |
| 2770 | "# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" | 2770 | "# echo wakeup > /sys/kernel/debug/tracing/current_tracer\n" |
| 2771 | "# cat /sys/kernel/debug/tracing/current_tracer\n" | 2771 | "# cat /sys/kernel/debug/tracing/current_tracer\n" |
| 2772 | "sched_switch\n" | 2772 | "wakeup\n" |
| 2773 | "# cat /sys/kernel/debug/tracing/trace_options\n" | 2773 | "# cat /sys/kernel/debug/tracing/trace_options\n" |
| 2774 | "noprint-parent nosym-offset nosym-addr noverbose\n" | 2774 | "noprint-parent nosym-offset nosym-addr noverbose\n" |
| 2775 | "# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" | 2775 | "# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 24aee7127451..76afaee99dbc 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
| @@ -685,7 +685,7 @@ find_event_field(struct ftrace_event_call *call, char *name) | |||
| 685 | 685 | ||
| 686 | static int __alloc_pred_stack(struct pred_stack *stack, int n_preds) | 686 | static int __alloc_pred_stack(struct pred_stack *stack, int n_preds) |
| 687 | { | 687 | { |
| 688 | stack->preds = kzalloc(sizeof(*stack->preds)*(n_preds + 1), GFP_KERNEL); | 688 | stack->preds = kcalloc(n_preds + 1, sizeof(*stack->preds), GFP_KERNEL); |
| 689 | if (!stack->preds) | 689 | if (!stack->preds) |
| 690 | return -ENOMEM; | 690 | return -ENOMEM; |
| 691 | stack->index = n_preds; | 691 | stack->index = n_preds; |
| @@ -826,8 +826,7 @@ static int __alloc_preds(struct event_filter *filter, int n_preds) | |||
| 826 | if (filter->preds) | 826 | if (filter->preds) |
| 827 | __free_preds(filter); | 827 | __free_preds(filter); |
| 828 | 828 | ||
| 829 | filter->preds = | 829 | filter->preds = kcalloc(n_preds, sizeof(*filter->preds), GFP_KERNEL); |
| 830 | kzalloc(sizeof(*filter->preds) * n_preds, GFP_KERNEL); | ||
| 831 | 830 | ||
| 832 | if (!filter->preds) | 831 | if (!filter->preds) |
| 833 | return -ENOMEM; | 832 | return -ENOMEM; |
| @@ -1486,7 +1485,7 @@ static int fold_pred(struct filter_pred *preds, struct filter_pred *root) | |||
| 1486 | children = count_leafs(preds, &preds[root->left]); | 1485 | children = count_leafs(preds, &preds[root->left]); |
| 1487 | children += count_leafs(preds, &preds[root->right]); | 1486 | children += count_leafs(preds, &preds[root->right]); |
| 1488 | 1487 | ||
| 1489 | root->ops = kzalloc(sizeof(*root->ops) * children, GFP_KERNEL); | 1488 | root->ops = kcalloc(children, sizeof(*root->ops), GFP_KERNEL); |
| 1490 | if (!root->ops) | 1489 | if (!root->ops) |
| 1491 | return -ENOMEM; | 1490 | return -ENOMEM; |
| 1492 | 1491 | ||
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index cb654542c1a1..43500153dd1e 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
| @@ -468,8 +468,8 @@ int __init init_ftrace_syscalls(void) | |||
| 468 | unsigned long addr; | 468 | unsigned long addr; |
| 469 | int i; | 469 | int i; |
| 470 | 470 | ||
| 471 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * | 471 | syscalls_metadata = kcalloc(NR_syscalls, sizeof(*syscalls_metadata), |
| 472 | NR_syscalls, GFP_KERNEL); | 472 | GFP_KERNEL); |
| 473 | if (!syscalls_metadata) { | 473 | if (!syscalls_metadata) { |
| 474 | WARN_ON(1); | 474 | WARN_ON(1); |
| 475 | return -ENOMEM; | 475 | return -ENOMEM; |
