tracing fixes
Subsystems (10)
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
------------------>
Alexey Dobriyan (1):
kernel/profile.c: Switch /proc/irq/prof_cpu_mask to seq_file
Christoph Hellwig (1):
tracing: Remove markers
Frederic Weisbecker (2):
tracing: Factorize the events profile accounting
tracing: Allocate the ftrace event profile buffer dynamically
Li Zefan (3):
function-graph: use ftrace_graph_funcs directly
tracing: remove max_tracer_type_len tracing/events: use list_for_entry_continue
Peter Zijlstra (1):
tracing: Export trace_profile_buf symbols
Documentation/markers.txt | 104 ---- arch/powerpc/platforms/cell/spufs/file.c | 1 - arch/powerpc/platforms/cell/spufs/sched.c | 1 - include/linux/ftrace_event.h | 10 +- include/linux/kvm_host.h | 1 - include/linux/marker.h | 221 ------- include/linux/module.h | 11 - include/linux/syscalls.h | 24 +- include/trace/ftrace.h | 111 ++-- init/Kconfig | 7 - kernel/Makefile | 1 - kernel/marker.c | 930 ----------------------------- kernel/module.c | 18 - kernel/profile.c | 45 +- kernel/trace/ftrace.c | 23 +- kernel/trace/trace.c | 49 +- kernel/trace/trace_event_profile.c | 82 +++- kernel/trace/trace_events.c | 49 +- kernel/trace/trace_printk.c | 1 - kernel/trace/trace_syscalls.c | 97 +++- samples/Kconfig | 6 - samples/Makefile | 2 +- samples/markers/Makefile | 4 - samples/markers/marker-example.c | 53 -- samples/markers/probe-example.c | 92 --- scripts/Makefile.modpost | 12 - 26 files changed, 297 insertions(+), 1658 deletions(-) delete mode 100644 Documentation/markers.txt delete mode 100644 include/linux/marker.h delete mode 100644 kernel/marker.c delete mode 100644 samples/markers/Makefile delete mode 100644 samples/markers/marker-example.c delete mode 100644 samples/markers/probe-example.c
Documentation/markers.txt deleted +0 -104
@@ -1,104 +0,0 @@ - Using the Linux Kernel Markers - - Mathieu Desnoyers - - -This document introduces Linux Kernel Markers and their use. It provides -examples of how to insert markers in the kernel and connect probe functions to -them and provides some examples of probe functions. - - -* Purpose of markers - -A marker placed in code provides a hook to call a function (probe) that you can -provide at runtime. A marker can be "on" (a probe is connected to it) or "off" -(no probe is attached). When a marker is "off" it has no effect, except for -adding a tiny time penalty (checking a condition for a branch) and space -penalty (adding a few bytes for the function call at the end of the -instrumented function and adds a data structure in a separate section). When a -marker is "on", the function you provide is called each time the marker is -executed, in the execution context of the caller. When the function provided -ends its execution, it returns to the caller (continuing from the marker site). - -You can put markers at important locations in the code. Markers are -lightweight hooks that can pass an arbitrary number of parameters, -described in a printk-like format string, to the attached probe function. - -They can be used for tracing and performance accounting. - - -* Usage - -In order to use the macro trace_mark, you should include linux/marker.h. - -#include <linux/marker.h> - -And, - -trace_mark(subsystem_event, "myint %d mystring %s", someint, somestring); -Where : -- subsystem_event is an identifier unique to your event - - subsystem is the name of your subsystem. - - event is the name of the event to mark. -- "myint %d mystring %s" is the formatted string for the serializer. "myint" and - "mystring" are repectively the field names associated with the first and - second parameter. -- someint is an integer. -- somestring is a char pointer. - -Connecting a function (probe) to a marker is done by providing a probe (function -to call) for the specific marker through marker_probe_register() and can be -activated by calling marker_arm(). Marker deactivation can be done by calling -marker_disarm() as many times as marker_arm() has been called. Removing a probe -is done through marker_probe_unregister(); it will disarm the probe. - -marker_synchronize_unregister() must be called between probe unregistration and -the first occurrence of -- the end of module exit function, - to make sure there is no caller left using the probe; -- the free of any resource used by the probes, - to make sure the probes wont be accessing invalid data. -This, and the fact that preemption is disabled around the probe call, make sure -that probe removal and module unload are safe. See the "Probe example" section -below for a sample probe module. - -The marker mechanism supports inserting multiple instances of the same marker. -Markers can be put in inline functions, inlined static functions, and -unrolled loops as well as regular functions. - -The naming scheme "subsystem_event" is suggested here as a convention intended -to limit collisions. Marker names are global to the kernel: they are considered -as being the same whether they are in the core kernel image or in modules. -Conflicting format strings for markers with the same name will cause the markers -to be detected to have a different format string not to be armed and will output -a printk warning which identifies the inconsistency: - -"Format mismatch for probe probe_name (format), marker (format)" - -Another way to use markers is to simply define the marker without generating any -function call to actually call into the marker. This is useful in combination -with tracepoint probes in a scheme like this : - -void probe_tracepoint_name(unsigned int arg1, struct task_struct *tsk); - -DEFINE_MARKER_TP(marker_eventname, tracepoint_name, probe_tracepoint_name, - "arg1 %u pid %d"); - -notrace void probe_tracepoint_name(unsigned int arg1, struct task_struct *tsk) -{ - struct marker *marker = &GET_MARKER(kernel_irq_entry); - /* write data to trace buffers ... */ -} - -* Probe / marker example - -See the example provided in samples/markers/src - -Compile them with your kernel. - -Run, as root : -modprobe marker-example (insmod order is not important) -modprobe probe-example -cat /proc/marker-example (returns an expected error) -rmmod marker-example probe-example -dmesg
arch/powerpc/platforms/cell/spufs/file.c +0 -1
@@ -29,7 +29,6 @@#include <linux/poll.h> #include <linux/ptrace.h> #include <linux/seq_file.h> -#include <linux/marker.h> #include <asm/io.h> #include <asm/time.h>
arch/powerpc/platforms/cell/spufs/sched.c +0 -1
@@ -39,7 +39,6 @@#include <linux/pid_namespace.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> -#include <linux/marker.h> #include <asm/io.h> #include <asm/mmu_context.h>
include/linux/ftrace_event.h +8 -2
@@ -4,6 +4,7 @@#include <linux/ring_buffer.h> #include <linux/trace_seq.h> #include <linux/percpu.h> +#include <linux/hardirq.h> struct trace_array ;struct tracer ;
@@ -130,10 +131,15 @@ struct ftrace_event_call {void *data;atomic_t profile_count; -int (*profile_enable)(struct ftrace_event_call *); -void (*profile_disable)(struct ftrace_event_call *); +int (*profile_enable)(void ); +void (*profile_disable)(void ); }; +#define FTRACE_MAX_PROFILE_SIZE 2048 + +extern char *trace_profile_buf; +extern char *trace_profile_buf_nmi; +#define MAX_FILTER_PRED 32#define MAX_FILTER_STR_VAL 256/* Should handle KSYM_SYMBOL_LEN */
include/linux/kvm_host.h +0 -1
@@ -15,7 +15,6 @@#include <linux/sched.h> #include <linux/mm.h> #include <linux/preempt.h> -#include <linux/marker.h> #include <linux/msi.h> #include <asm/signal.h>
include/linux/marker.h deleted +0 -221
221 lines not on this page · raw message
include/linux/module.h +0 -11
@@ -15,7 +15,6 @@#include <linux/stringify.h> #include <linux/kobject.h> #include <linux/moduleparam.h> -#include <linux/marker.h> #include <linux/tracepoint.h> #include <asm/local.h>
@@ -327,10 +326,6 @@ struct module/* The command line arguments (may be mangled). People like keeping pointers to this stuff */ char *args; -#ifdef CONFIG_MARKERS -struct marker *markers; -unsigned int num_markers; -#endif #ifdef CONFIG_TRACEPOINTS struct tracepoint *tracepoints;unsigned int num_tracepoints;
@@ -535,8 +530,6 @@ int unregister_module_notifier(struct notifier_block * nb);extern void print_modules (void ); -extern void module_update_markers (void ); -extern void module_update_tracepoints (void );extern int module_get_iter_tracepoints (struct tracepoint_iter *iter);
@@ -651,10 +644,6 @@ static inline void print_modules(void) { } -static inline void module_update_markers (void ) -{ -} -static inline void module_update_tracepoints (void ) { }
include/linux/syscalls.h +8 -16
@@ -100,33 +100,25 @@ struct perf_counter_attr;#ifdef CONFIG_EVENT_PROFILE #define TRACE_SYS_ENTER_PROFILE (sname) \ -static int prof_sysenter_enable_##sname(struct ftrace_event_call *event_call) \ +static int prof_sysenter_enable_##sname(void) \ { \ - int ret = 0; \ - if (!atomic_inc_return(&event_enter_##sname.profile_count)) \ - ret = reg_prof_syscall_enter("sys"#sname); \ - return ret; \ + return reg_prof_syscall_enter("sys"#sname); \ } \ \ -static void prof_sysenter_disable_##sname(struct ftrace_event_call *event_call)\ +static void prof_sysenter_disable_##sname(void) \ { \ - if (atomic_add_negative(-1, &event_enter_##sname.profile_count)) \ - unreg_prof_syscall_enter("sys"#sname); \ + unreg_prof_syscall_enter("sys"#sname); \ }#define TRACE_SYS_EXIT_PROFILE (sname) \ -static int prof_sysexit_enable_##sname(struct ftrace_event_call *event_call) \ +static int prof_sysexit_enable_##sname(void) \ { \ - int ret = 0; \ - if (!atomic_inc_return(&event_exit_##sname.profile_count)) \ - ret = reg_prof_syscall_exit("sys"#sname); \ - return ret; \ + return reg_prof_syscall_exit("sys"#sname); \ } \ \ -static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \ +static void prof_sysexit_disable_##sname(void) \ { \ - if (atomic_add_negative(-1, &event_exit_##sname.profile_count)) \ - unreg_prof_syscall_exit("sys"#sname); \ + unreg_prof_syscall_exit("sys"#sname); \ }#define TRACE_SYS_ENTER_PROFILE_INIT (sname) \
include/trace/ftrace.h +63 -48
173 lines not on this page · raw message
init/Kconfig +0 -7
@@ -1054,13 +1054,6 @@ config PROFILING config TRACEPOINTS bool -config MARKERS - bool "Activate markers" - select TRACEPOINTS - help - Place an empty function call at each marker site. Can be - dynamically changed for a probe function. - source "arch/Kconfig" config SLOW_WORK
kernel/Makefile +0 -1
@@ -87,7 +87,6 @@ obj-$(CONFIG_RELAY) += relay.o obj-$(CONFIG_SYSCTL) += utsname_sysctl.o obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o -obj-$(CONFIG_MARKERS) += marker.o obj-$(CONFIG_TRACEPOINTS) += tracepoint.o obj-$(CONFIG_LATENCYTOP) += latencytop.o obj-$(CONFIG_FUNCTION_TRACER) += trace/
kernel/marker.c deleted +0 -930
930 lines not on this page · raw message
kernel/module.c +0 -18
@@ -2237,10 +2237,6 @@ static noinline struct module *load_module(void __user *umod, sizeof(*mod->ctors), &mod->num_ctors);#endif -#ifdef CONFIG_MARKERS - mod->markers =section_objs (hdr, sechdrs, secstrings,"__markers" , -sizeof (*mod->markers), &mod->num_markers); -#endif #ifdef CONFIG_TRACEPOINTS mod->tracepoints = section_objs(hdr, sechdrs, secstrings, "__tracepoints",
@@ -2958,20 +2954,6 @@ void module_layout(struct module *mod,EXPORT_SYMBOL (module_layout);#endif -#ifdef CONFIG_MARKERS -void module_update_markers (void ) -{ -struct module *mod; - -mutex_lock (&module_mutex); -list_for_each_entry (mod, &modules, list) -if (!mod->taints) -marker_update_probe_range (mod->markers, - mod->markers + mod->num_markers); -mutex_unlock (&module_mutex); -} -#endif -#ifdef CONFIG_TRACEPOINTS void module_update_tracepoints (void ) {
kernel/profile.c +24 -21
72 lines not on this page · raw message
kernel/trace/ftrace.c +4 -19
@@ -2414,11 +2414,9 @@ unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly;static void *__g_next (struct seq_file *m,loff_t *pos) { -unsigned long *array = m->private; -if (*pos >= ftrace_graph_count)return NULL ; -return &array[*pos]; +return &ftrace_graph_funcs[*pos]; } static void *
@@ -2482,16 +2480,10 @@ ftrace_graph_open(struct inode *inode, struct file *file) ftrace_graph_count =0 ;memset (ftrace_graph_funcs,0 ,sizeof (ftrace_graph_funcs)); } +mutex_unlock (&graph_lock); -if (file->f_mode &FMODE_READ ) { +if (file->f_mode &FMODE_READ ) ret =seq_open (file, &ftrace_graph_seq_ops); -if (!ret) { -struct seq_file *m = file->private_data; - m->private = ftrace_graph_funcs; - } - }else - file->private_data = ftrace_graph_funcs; -mutex_unlock (&graph_lock);return ret; }
@@ -2560,7 +2552,6 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct trace_parser parser; -unsigned long *array;size_t read =0 ;ssize_t ret;
@@ -2574,12 +2565,6 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, goto out; } -if (file->f_mode &FMODE_READ ) { -struct seq_file *m = file->private_data; - array = m->private; - }else - array = file->private_data; -if (trace_parser_get_init (&parser,FTRACE_BUFF_MAX )) { ret = -ENOMEM ; goto out;
@@ -2591,7 +2576,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, parser.buffer[parser.idx] =0 ;/* we allow only one expression at a time */ - ret =ftrace_set_func (array, &ftrace_graph_count, + ret =ftrace_set_func (ftrace_graph_funcs, &ftrace_graph_count, parser.buffer);if (ret) goto out;
kernel/trace/trace.c +16 -33
131 lines not on this page · raw message
kernel/trace/trace_event_profile.c +80 -2
106 lines not on this page · raw message
kernel/trace/trace_events.c +15 -34
94 lines not on this page · raw message
kernel/trace/trace_printk.c +0 -1
@@ -11,7 +11,6 @@#include <linux/ftrace.h> #include <linux/string.h> #include <linux/module.h> -#include <linux/marker.h> #include <linux/mutex.h> #include <linux/ctype.h> #include <linux/list.h>
kernel/trace/trace_syscalls.c +78 -19
128 lines not on this page · raw message
samples/Kconfig +0 -6
@@ -7,12 +7,6 @@ menuconfig SAMPLES if SAMPLES -config SAMPLE_MARKERS - tristate "Build markers examples -- loadable modules only" - depends on MARKERS && m - help - This build markers example modules. - config SAMPLE_TRACEPOINTS tristate "Build tracepoints examples -- loadable modules only" depends on TRACEPOINTS && m
samples/Makefile +1 -1
@@ -1,3 +1,3 @@ # Makefile for Linux samples code -obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/ trace_events/ +obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ tracepoints/ trace_events/
samples/markers/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -# builds the kprobes example kernel modules; -# then to use one (as root): insmod <module_name.ko> - -obj-$(CONFIG_SAMPLE_MARKERS) += probe-example.o marker-example.o
samples/markers/marker-example.c deleted +0 -53
53 lines not on this page · raw message
samples/markers/probe-example.c deleted +0 -92
92 lines not on this page · raw message
scripts/Makefile.modpost +0 -12
@@ -13,7 +13,6 @@ # 2) modpost is then used to # 3) create one <module>.mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols -# 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers # 5) compile all <module>.mod.c files # 6) final link of the module to a <module.ko> file
@@ -59,10 +58,6 @@ include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -kernelmarkersfile := $(objtree)/Module.markers -modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers - -markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) # Step 1), find all modules listed in $(MODVERDIR)/ __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
@@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ - $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ - $(if $(CONFIG_MARKERS),-M $(markersfile)) \ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ $(if $(cross_build),-c)
@@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ cmd_kernel-mod = $(modpost) $@ vmlinux.o: FORCE - @rm -fr $(kernelmarkersfile) $(call cmd,kernel-mod) # Declare generated files as targets for modpost $(symverfile): __modpost ; $(modules:.ko=.mod.c): __modpost ; -ifdef CONFIG_MARKERS -$(markersfile): __modpost ; -endif - # Step 5), compile all *.mod.c files
Quoted 3 lines · Ingo Molnar
Christoph Hellwig (1):
tracing: Remove markers
This seems to result in:
kernel/module.c:2951: warning: ‘struct marker’ declared inside parameter list kernel/module.c:2951: warning: its scope is only this definition or declaration, which is probably not what you want
Hmm? Incomplete removal?
Linus
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Ingo Molnar
Christoph Hellwig (1):
tracing: Remove markersThis seems to result in:
kernel/module.c:2951: warning: ?struct marker? declared inside parameter listkernel/module.c:2951: warning: its scope is only this definition or declaration, which is probably not what you wantHmm? Incomplete removal?
Hm, yes, you are right, we missed that. I noticed the modpost dependency:
http://marc.info/?l=linux-kernel&m=125326944223679&w=2
but thought that it's safe and didnt notice that dangling module_layout() reference and the build warning it generates in the kernel.
I _think_ the patch below should do the trick - module_layout() appears to be an artificial symbol with 'significant' symbols listed in its argument list so that it gets a proper signature. Removing the marker symbol should thus be the solution, but i'm not 100% sure. Thoughts?
Ingo
kernel/module.c +0 -1
@@ -2947,7 +2947,6 @@ void module_layout(struct module *mod,struct modversion_info *ver, struct kernel_param *kp, struct kernel_symbol *ks, - struct marker *marker, struct tracepoint *tp) { }
Quoted 9 lines · Ingo Molnar
Hm, yes, you are right, we missed that. I noticed the modpost dependency:
http://marc.info/?l=linux-kernel&m=125326944223679&w=2
but thought that it's safe and didnt notice that dangling
module_layout()reference and the build warning it generates in the kernel.
Quoted 6 lines
I _think_ the patch below should do the trick -
module_layout()appears to be an artificial symbol with 'significant' symbols listed in its argument list so that it gets a proper signature. Removing the marker symbol should thus be the solution, but i'm not 100% sure. Thoughts?Ingo
Looks good to me, Linus?
kernel/module.c void module_layout(struct module *mod, · line 2952
Quoted 12 lines
kernel/module.c +0
-1@@ -2947,7 +2947,6 @@ void module_layout(struct module *mod,struct modversion_info *ver, struct kernel_param *kp, struct kernel_symbol *ks, - struct marker *marker, struct tracepoint *tp) { }
---end quoted text---
Quoted 19 lines · Christoph Hellwig
Quoted 9 lines · Ingo Molnar
Hm, yes, you are right, we missed that. I noticed the modpost dependency:
http://marc.info/?l=linux-kernel&m=125326944223679&w=2
but thought that it's safe and didnt notice that dangling
module_layout()reference and the build warning it generates in the kernel.Quoted 6 lines
I _think_ the patch below should do the trick -
module_layout()appears to be an artificial symbol with 'significant' symbols listed in its argument list so that it gets a proper signature. Removing the marker symbol should thus be the solution, but i'm not 100% sure. Thoughts?Ingo
Looks good to me, Linus?
Quoted 13 lines
kernel/module.c void module_layout(struct module *mod, · line 2952
Quoted 12 lines
kernel/module.c +0
-1@@ -2947,7 +2947,6 @@ void module_layout(struct module *mod,struct modversion_info *ver, struct kernel_param *kp, struct kernel_symbol *ks, - struct marker *marker, struct tracepoint *tp) { }---end quoted text---
Yep, already pushed that to Linus some time ago:
115e8a2: modules, tracing: Remove stale struct marker signature from module_layout()
Ingo
[tip:tracing/urgent] modules, tracing: Remove stale struct marker signature from module_layout()
In reply to Linus TorvaldsCommit-ID: 115e8a288252ef748f34f8b7c1115c563d702eda Gitweb: http://git.kernel.org/tip/115e8a288252ef748f34f8b7c1115c563d702eda Author: Ingo Molnar <[email protected]> AuthorDate: Mon, 21 Sep 2009 18:22:11 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 23 Sep 2009 10:34:21 +0200
modules, tracing: Remove stale struct marker signature from module_layout()
Linus reported this new build warning:
kernel/module.c:2951: warning: ?struct marker? declared inside parameter list kernel/module.c:2951: warning: its scope is only this definition or declaration, which is probably not what you want
Caused by:
fc53776: tracing: Remove markers
module_layout() is an artificial symbol with 'significant' symbols listed in its argument list so that it gets a proper argument types signature that modversions can pick up to decide whether a module is version-compatible or not. If these dont match then we wont even look at a module.
Remove the stale marker symbol.
LKML-Reference: <[email protected]>
--- kernel/module.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/module.c +0 -1
@@ -2947,7 +2947,6 @@ void module_layout(struct module *mod,struct modversion_info *ver, struct kernel_param *kp, struct kernel_symbol *ks, - struct marker *marker, struct tracepoint *tp) { }