tracing fixes
Subsystems (4)
Linus,
Please pull the latest tracing-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing-fixes-for-linus
Thanks,
Ingo
------------------>
Lai Jiangshan (3):
tracing/kprobe: Show sign of fields in trace_kprobe format files tracing/syscalls: Fix typo in SYSCALL_DEFINE0
tracing: Fix sign fields in ftrace_define_fields_##call()
Li Zefan (4):
ksym_tracer: Fix to make the tracer work
ksym_tracer: Fix to allow writing newline to ksym_trace_filter
ksym_tracer: Fix race when incrementing count
ksym_tracer: Remove trace_stat
Randy Dunlap (4):
Documentation: Update mmiotrace.txt
Documentation: Update tracepoint-analysis.txt
Documentation: Update ftrace-design.txt
tracing: Kconfig spelling fixes and cleanups
Steven Rostedt (1):
tracing: Fix setting tracer specific options
Documentation/trace/ftrace-design.txt | 14 ++-- Documentation/trace/mmiotrace.txt | 15 ++-- Documentation/trace/tracepoint-analysis.txt | 60 ++++++------ include/linux/syscalls.h | 2 +- include/trace/ftrace.h | 7 +- kernel/hw_breakpoint.c | 10 ++- kernel/trace/Kconfig | 112 +++++++++++----------- kernel/trace/trace.c | 2 +- kernel/trace/trace_export.c | 7 +- kernel/trace/trace_kprobe.c | 7 +- kernel/trace/trace_ksym.c | 140 +++++++++++---------------- 11 files changed, 179 insertions(+), 197 deletions(-)
Documentation/trace/ftrace-design.txt +7 -7
@@ -53,14 +53,14 @@ size of the mcount call that is embedded in the function). For example, if the function foo() calls bar(), when the bar() function calls mcount(), the arguments mcount() will pass to the tracer are: "frompc" - the address bar() will use to return to foo() - "selfpc" - the address bar() (with _mcount() size adjustment) + "selfpc" - the address bar() (with mcount() size adjustment) Also keep in mind that this mcount function will be called *a lot*, so optimizing for the default case of no tracer will help the smooth running of your system when tracing is disabled. So the start of the mcount function is -typically the bare min with checking things before returning. That also means -the code flow should usually kept linear (i.e. no branching in the nop case). -This is of course an optimization and not a hard requirement. +typically the bare minimum with checking things before returning. That also +means the code flow should usually be kept linear (i.e. no branching in the nop +case). This is of course an optimization and not a hard requirement. Here is some pseudo code that should help (these functions should actually be implemented in assembly):
@@ -131,10 +131,10 @@ some functions to save (hijack) and restore the return address. The mcount function should check the function pointers ftrace_graph_return (compare to ftrace_stub) and ftrace_graph_entry (compare to -ftrace_graph_entry_stub). If either of those are not set to the relevant stub +ftrace_graph_entry_stub). If either of those is not set to the relevant stub function, call the arch-specific function ftrace_graph_caller which in turn calls the arch-specific function prepare_ftrace_return. Neither of these -function names are strictly required, but you should use them anyways to stay +function names is strictly required, but you should use them anyway to stay consistent across the architecture ports -- easier to compare & contrast things.
@@ -144,7 +144,7 @@ but the first argument should be a pointer to the "frompc". Typically this is located on the stack. This allows the function to hijack the return address temporarily to have it point to the arch-specific function return_to_handler. That function will simply call the common ftrace_return_to_handler function and -that will return the original return address with which, you can return to the +that will return the original return address with which you can return to the original call site. Here is the updated mcount pseudo code:
Documentation/trace/mmiotrace.txt +8 -7
@@ -44,7 +44,8 @@ Check for lost events. Usage ----- -Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +Make sure debugfs is mounted to /sys/kernel/debug. +If not (requires root privileges): $ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded.
@@ -91,7 +92,7 @@ $ dmesg > dmesg.txt $ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt and then send the .tar.gz file. The trace compresses considerably. Replace "pciid" and "nick" with the PCI ID or model name of your piece of hardware -under investigation and your nick name. +under investigation and your nickname. How Mmiotrace Works
@@ -100,7 +101,7 @@ How Mmiotrace Works Access to hardware IO-memory is gained by mapping addresses from PCI bus by calling one of the ioremap_*() functions. Mmiotrace is hooked into the __ioremap() function and gets called whenever a mapping is created. Mapping is -an event that is recorded into the trace log. Note, that ISA range mappings +an event that is recorded into the trace log. Note that ISA range mappings are not caught, since the mapping always exists and is returned directly. MMIO accesses are recorded via page faults. Just before __ioremap() returns,
@@ -122,11 +123,11 @@ Trace Log Format ---------------- The raw log is text and easily filtered with e.g. grep and awk. One record is -one line in the log. A record starts with a keyword, followed by keyword -dependant arguments. Arguments are separated by a space, or continue until the +one line in the log. A record starts with a keyword, followed by keyword- +dependent arguments. Arguments are separated by a space, or continue until the end of line. The format for version 20070824 is as follows: -Explanation Keyword Space separated arguments +Explanation Keyword Space-separated arguments --------------------------------------------------------------------------- read event R width, timestamp, map id, physical, value, PC, PID
@@ -136,7 +137,7 @@ iounmap event UNMAP timestamp, map id, PC, PID marker MARK timestamp, text version VERSION the string "20070824" info for reader LSPCI one line from lspci -v -PCI address map PCIDEV space separated /proc/bus/pci/devices data +PCI address map PCIDEV space-separated /proc/bus/pci/devices data unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual
Documentation/trace/tracepoint-analysis.txt +30 -30
173 lines not on this page · raw message
include/linux/syscalls.h +1 -1
@@ -195,7 +195,7 @@ struct perf_event_attr; static const struct syscall_metadata __used \ __attribute__((__aligned__(4))) \ __attribute__((section("__syscalls_metadata"))) \ - __syscall_meta_##sname = { \ + __syscall_meta__##sname = { \ .name = "sys_"#sname, \ .nb_args = 0, \ .enter_event = &event_enter__##sname, \
include/trace/ftrace.h +4 -3
@@ -414,7 +414,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \BUILD_BUG_ON (len >MAX_FILTER_STR_VAL ); \ ret = trace_define_field(event_call, #type "[" #len "]", #item, \ offsetof(typeof(field), item), \ - sizeof(field.item), 0, FILTER_OTHER); \ + sizeof(field.item), \ + is_signed_type(type), FILTER_OTHER); \ if (ret) \ return ret;
@@ -422,8 +423,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \#define __dynamic_array (type, item, len) \ ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ offsetof(typeof(field), __data_loc_##item), \ - sizeof(field.__data_loc_##item), 0, \ - FILTER_OTHER); + sizeof(field.__data_loc_##item), \ + is_signed_type(type), FILTER_OTHER);#undef __string#define __string (item, src) __dynamic_array(char, item, -1)
kernel/hw_breakpoint.c +7 -3
@@ -40,6 +40,7 @@#include <linux/percpu.h> #include <linux/sched.h> #include <linux/init.h> +#include <linux/cpu.h> #include <linux/smp.h> #include <linux/hw_breakpoint.h>
@@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,if (!cpu_events)return ERR_PTR (-ENOMEM ); -for_each_possible_cpu (cpu) { +get_online_cpus (); +for_each_online_cpu (cpu) { pevent =per_cpu_ptr (cpu_events, cpu); bp =perf_event_create_kernel_counter (attr, cpu,-1 , triggered);
@@ -399,18 +401,20 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, goto fail; } } +put_online_cpus ();return cpu_events; fail: -for_each_possible_cpu (cpu) { +for_each_online_cpu (cpu) { pevent =per_cpu_ptr (cpu_events, cpu);if (IS_ERR (*pevent))break ;unregister_hw_breakpoint (*pevent); } +put_online_cpus (); +free_percpu (cpu_events); -/* return the error if any */ return ERR_PTR (err); }EXPORT_SYMBOL_GPL (register_wide_hw_breakpoint);
kernel/trace/Kconfig +56 -56
284 lines not on this page · raw message
kernel/trace/trace.c +1 -1
@@ -3949,7 +3949,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt,if (!!(topt->flags->val & topt->opt->bit) != val) {mutex_lock (&trace_types_lock); ret =__set_tracer_option (current_trace, topt->flags, - topt->opt, val); + topt->opt, !val);mutex_unlock (&trace_types_lock);if (ret)return ret;
kernel/trace/trace_export.c +4 -3
@@ -158,7 +158,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \BUILD_BUG_ON (len >MAX_FILTER_STR_VAL ); \ ret = trace_define_field(event_call, #type "[" #len "]", #item, \ offsetof(typeof(field), item), \ - sizeof(field.item), 0, FILTER_OTHER); \ + sizeof(field.item), \ + is_signed_type(type), FILTER_OTHER); \ if (ret) \ return ret;
@@ -168,8 +169,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ ret = trace_define_field(event_call, #type "[" #len "]", #item, \ offsetof(typeof(field), \ container.item), \ - sizeof(field.container.item), 0, \ - FILTER_OTHER); \ + sizeof(field.container.item), \ + is_signed_type(type), FILTER_OTHER); \ if (ret) \ return ret;
kernel/trace/trace_kprobe.c +4 -3
@@ -1182,10 +1182,11 @@ static int __probe_event_show_format(struct trace_seq *s,#undef SHOW_FIELD#define SHOW_FIELD (type, item, name) \ do { \ - ret = trace_seq_printf(s, "\tfield: " #type " %s;\t" \ - "offset:%u;\tsize:%u;\n", name, \ + ret = trace_seq_printf(s, "\tfield:" #type " %s;\t" \ + "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\ (unsigned int)offsetof(typeof(field), item),\ - (unsigned int)sizeof(type)); \ + (unsigned int)sizeof(type), \ + is_signed_type(type)); \ if (!ret) \ return 0; \ } while (0)
kernel/trace/trace_ksym.c +57 -83
202 lines not on this page · raw message