From: Ingo Molnar Date: Mon, 16 Mar 2009 08:12:42 +0000 (+0100) Subject: Merge branches 'tracing/ftrace', 'tracing/syscalls' and 'linus' into tracing/core X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7243f2145a9b06e5cf9a49fc9b8b9a4fff6fb42e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge branches 'tracing/ftrace', 'tracing/syscalls' and 'linus' into tracing/core Conflicts: arch/parisc/kernel/irq.c --- 7243f2145a9b06e5cf9a49fc9b8b9a4fff6fb42e diff --cc arch/parisc/kernel/irq.c index 49482806863f,49482806863f,29e70e16ede8..2b5f5915dd1d --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@@@ -133,10 -133,10 -132,13 +132,13 @@@@ int cpu_check_affinity(unsigned int irq static void cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) { -- if (cpu_check_affinity(irq, dest)) ++ int cpu_dest; ++ ++ cpu_dest = cpu_check_affinity(irq, dest); ++ if (cpu_dest < 0) return; -- cpumask_copy(irq_desc[irq].affinity, dest); - cpumask_copy(&irq_desc[irq].affinity, &cpumask_of_cpu(cpu_dest)); +++ cpumask_copy(&irq_desc[irq].affinity, dest); } #endif diff --cc include/linux/ftrace.h index 9d598bbf28a6,6dc1c652447e,677432b9cb7e..db3fed630db3 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@@@ -485,42 -486,50 -490,6 +485,50 @@@@ static inline int test_tsk_trace_graph( return tsk->trace & TSK_TRACE_FL_GRAPH; } +extern int ftrace_dump_on_oops; + #endif /* CONFIG_TRACING */ + +#ifdef CONFIG_HW_BRANCH_TRACER + +void trace_hw_branch(u64 from, u64 to); +void trace_hw_branch_oops(void); + +#else /* CONFIG_HW_BRANCH_TRACER */ + +static inline void trace_hw_branch(u64 from, u64 to) {} +static inline void trace_hw_branch_oops(void) {} + +#endif /* CONFIG_HW_BRANCH_TRACER */ + +/* + * A syscall entry in the ftrace syscalls array. + * - * @syscall_nr: syscall number + + * @name: name of the syscall + + * @nb_args: number of parameters it takes + + * @types: list of types as strings + + * @args: list of args as strings (args[i] matches types[i]) + */ - struct syscall_trace_entry { - int syscall_nr; + +struct syscall_metadata { + + const char *name; + + int nb_args; + + const char **types; + + const char **args; +}; + +#ifdef CONFIG_FTRACE_SYSCALLS + +extern void arch_init_ftrace_syscalls(void); + +extern struct syscall_metadata *syscall_nr_to_meta(int nr); +extern void start_ftrace_syscalls(void); +extern void stop_ftrace_syscalls(void); +extern void ftrace_syscall_enter(struct pt_regs *regs); +extern void ftrace_syscall_exit(struct pt_regs *regs); +#else +static inline void start_ftrace_syscalls(void) { } +static inline void stop_ftrace_syscalls(void) { } +static inline void ftrace_syscall_enter(struct pt_regs *regs) { } +static inline void ftrace_syscall_exit(struct pt_regs *regs) { } +#endif + #endif /* _LINUX_FTRACE_H */ diff --cc kernel/trace/trace.h index 56ce34d90b03,d80ca0d464d9,4d3d381bfd95..f56162806f50 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@@@ -18,9 -18,8 -16,9 +18,9 @@@@ enum trace_type TRACE_FN, TRACE_CTX, TRACE_WAKE, - TRACE_CONT, TRACE_STACK, TRACE_PRINT, ++ TRACE_BPRINT, TRACE_SPECIAL, TRACE_MMIO_RW, TRACE_MMIO_MAP, @@@@ -118,23 -117,16 -112,15 +118,23 @@@@ struct userstack_entry }; /* - * ftrace_printk entry: + * trace_printk entry: */ - struct print_entry { ++struct bprint_entry { + struct trace_entry ent; + unsigned long ip; + int depth; + const char *fmt; + u32 buf[]; +}; + + struct print_entry { + struct trace_entry ent; + unsigned long ip; + int depth; + char buf[]; + }; + #define TRACE_OLD_SIZE 88 struct trace_field_cont { @@@@ -184,24 -176,37 -170,6 +184,37 @@@@ struct trace_power struct power_trace state_data; }; +struct kmemtrace_alloc_entry { + struct trace_entry ent; + enum kmemtrace_type_id type_id; + unsigned long call_site; + const void *ptr; + size_t bytes_req; + size_t bytes_alloc; + gfp_t gfp_flags; + int node; +}; + +struct kmemtrace_free_entry { + struct trace_entry ent; + enum kmemtrace_type_id type_id; + unsigned long call_site; + const void *ptr; +}; + + +struct syscall_trace_enter { + + struct trace_entry ent; + + int nr; + + unsigned long args[]; + +}; + + + +struct syscall_trace_exit { + + struct trace_entry ent; + + int nr; + + unsigned long ret; + +}; + + + + /* * trace_flag_type is an enumeration that holds different * states when a trace occurs. These are: @@@@ -310,11 -314,15 -279,7 +323,15 @@@@ extern void __ftrace_bad_type(void) IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ TRACE_GRAPH_RET); \ IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ - IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \ + IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \ + IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ + TRACE_KMEM_ALLOC); \ + IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ + TRACE_KMEM_FREE); \ + + IF_ASSIGN(var, ent, struct syscall_trace_enter, \ + + TRACE_SYSCALL_ENTER); \ + + IF_ASSIGN(var, ent, struct syscall_trace_exit, \ + + TRACE_SYSCALL_EXIT); \ __ftrace_bad_type(); \ } while (0) @@@@ -579,10 -587,8 -488,17 +596,10 @@@@ extern int trace_selftest_startup_branc #endif /* CONFIG_FTRACE_STARTUP_TEST */ extern void *head_page(struct trace_array_cpu *data); -extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...); -extern void trace_seq_print_cont(struct trace_seq *s, - struct trace_iterator *iter); - -extern int -seq_print_ip_sym(struct trace_seq *s, unsigned long ip, - unsigned long sym_flags); -extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, - size_t cnt); extern long ns2usecs(cycle_t nsec); extern int ++trace_vbprintk(unsigned long ip, int depth, const char *fmt, va_list args); ++extern int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); extern unsigned long trace_flags; @@@@ -750,51 -756,26 -664,4 +767,51 @@@@ static inline void trace_branch_disable } #endif /* CONFIG_BRANCH_TRACER */ ++/* set ring buffers to default size if not already done so */ ++int tracing_update_buffers(void); ++ +/* trace event type bit fields, not numeric */ +enum { + TRACE_EVENT_TYPE_PRINTF = 1, + TRACE_EVENT_TYPE_RAW = 2, +}; + +struct ftrace_event_call { + char *name; + char *system; + struct dentry *dir; + int enabled; + int (*regfunc)(void); + void (*unregfunc)(void); + int id; + int (*raw_init)(void); + int (*show_format)(struct trace_seq *s); +}; + +void event_trace_printk(unsigned long ip, const char *fmt, ...); +extern struct ftrace_event_call __start_ftrace_events[]; +extern struct ftrace_event_call __stop_ftrace_events[]; + ++extern const char *__start___trace_bprintk_fmt[]; ++extern const char *__stop___trace_bprintk_fmt[]; ++ ++/* ++ * The double __builtin_constant_p is because gcc will give us an error ++ * if we try to allocate the static variable to fmt if it is not a ++ * constant. Even with the outer if statement optimizing out. ++ */ ++#define event_trace_printk(ip, fmt, args...) \ ++do { \ ++ __trace_printk_check_format(fmt, ##args); \ ++ tracing_record_cmdline(current); \ ++ if (__builtin_constant_p(fmt)) { \ ++ static const char *trace_printk_fmt \ ++ __attribute__((section("__trace_printk_fmt"))) = \ ++ __builtin_constant_p(fmt) ? fmt : NULL; \ ++ \ ++ __trace_bprintk(ip, trace_printk_fmt, ##args); \ ++ } else \ ++ __trace_printk(ip, fmt, ##args); \ ++} while (0) ++ #endif /* _LINUX_KERNEL_TRACE_H */