tracing updates
Subsystems (4)
Ingo,
Please pull the tracing/core branch that can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core
It is based on top of tip:perf/core.
The next that are soon to join the removal list are sysprof and blktrace (from which we only want to remove the ftrace plugin part, unused by the userspace app).
And probably the workqueue profiler and ksym tracer too.
Thanks,
Frederic
---
Américo Wang (1):
tracing: Remove boot tracer
Li Zefan (1):
tracing: Remove kmemtrace ftrace plugin
Documentation/ABI/testing/debugfs-kmemtrace | 71 ---- Documentation/trace/kmemtrace.txt | 126 ------- MAINTAINERS | 7 - include/linux/kmemtrace.h | 25 -- include/linux/slab_def.h | 3 +- include/linux/slub_def.h | 3 +- include/trace/boot.h | 60 --- init/main.c | 29 +- kernel/trace/Kconfig | 37 -- kernel/trace/Makefile | 2 - kernel/trace/kmemtrace.c | 529 --------------------------- kernel/trace/trace.c | 3 - kernel/trace/trace.h | 20 - kernel/trace/trace_boot.c | 185 ---------- kernel/trace/trace_entries.h | 62 ---- mm/slab.c | 1 - mm/slub.c | 1 - 17 files changed, 14 insertions(+), 1150 deletions(-)
PATCH 1/2 tracing: Remove boot tracer
From: Américo Wang <[email protected]>
The boot tracer is useless. It simply logs the initcalls but in fact these initcalls are also logged through printk while using the initcall_debug kernel parameter.
Nobody seem to be using it so far. Then just remove it.
LKML-Reference: <[email protected]>
--- include/trace/boot.h | 60 -------------- init/main.c | 27 +++---- kernel/trace/Kconfig | 17 ---- kernel/trace/Makefile | 1 - kernel/trace/trace.c | 3 - kernel/trace/trace.h | 8 -- kernel/trace/trace_boot.c | 185 ------------------------------------------ kernel/trace/trace_entries.h | 27 ------ 8 files changed, 10 insertions(+), 318 deletions(-) delete mode 100644 include/trace/boot.h delete mode 100644 kernel/trace/trace_boot.c
include/trace/boot.h deleted +0 -60
@@ -1,60 +0,0 @@ -#ifndef _LINUX_TRACE_BOOT_H -#define _LINUX_TRACE_BOOT_H - -#include <linux/module.h> -#include <linux/kallsyms.h> -#include <linux/init.h> - -/* -* Structure which defines the trace of an initcall -* while it is called. -* You don't have to fill the func field since it is -* only used internally by the tracer. -*/ -struct boot_trace_call { -pid_t caller; -char func[KSYM_SYMBOL_LEN ]; -}; - -/* -* Structure which defines the trace of an initcall -* while it returns. -*/ -struct boot_trace_ret { -char func[KSYM_SYMBOL_LEN ]; -int result; -unsigned long long duration;/* nsecs */ -}; - -#ifdef CONFIG_BOOT_TRACER -/* Append the traces on the ring-buffer */ -extern void trace_boot_call (struct boot_trace_call *bt,initcall_t fn); -extern void trace_boot_ret (struct boot_trace_ret *bt,initcall_t fn); - -/* Tells the tracer that smp_pre_initcall is finished. -* So we can start the tracing -*/ -extern void start_boot_trace (void ); - -/* Resume the tracing of other necessary events -* such as sched switches -*/ -extern void enable_boot_trace (void ); - -/* Suspend this tracing. Actually, only sched_switches tracing have -* to be suspended. Initcalls doesn't need it.) -*/ -extern void disable_boot_trace (void ); -#else -static inline -void trace_boot_call (struct boot_trace_call *bt,initcall_t fn) { } - -static inline -void trace_boot_ret (struct boot_trace_ret *bt,initcall_t fn) { } - -static inline void start_boot_trace (void ) { } -static inline void enable_boot_trace (void ) { } -static inline void disable_boot_trace (void ) { } -#endif /* CONFIG_BOOT_TRACER */ - -#endif /* __LINUX_TRACE_BOOT_H */
init/main.c +10 -17
@@ -69,7 +69,6 @@#include <linux/sfi.h> #include <linux/shmem_fs.h> #include <linux/slab.h> -#include <trace/boot.h> #include <asm/io.h> #include <asm/bugs.h>
@@ -713,38 +712,33 @@ int initcall_debug;core_param (initcall_debug, initcall_debug, bool,0644 );static char msgbuf[64 ]; -static struct boot_trace_call call; -static struct boot_trace_ret ret;int do_one_initcall (initcall_t fn) {int count =preempt_count ();ktime_t calltime, delta, rettime; +unsigned long long duration; +int ret;if (initcall_debug) { - call.caller =task_pid_nr (current); -printk ("calling %pF @ %i\n" , fn, call.caller); +printk ("calling %pF @ %i\n" , fn,task_pid_nr (current)); calltime =ktime_get (); -trace_boot_call (&call, fn); -enable_boot_trace (); } - ret.result =fn (); + ret =fn ();if (initcall_debug) { -disable_boot_trace (); rettime =ktime_get (); delta =ktime_sub (rettime, calltime); - ret.duration = (unsigned long long )ktime_to_ns (delta) >>10 ; -trace_boot_ret (&ret, fn); -printk ("initcall %pF returned %d after %Ld usecs\n" , fn, - ret.result, ret.duration); + duration = (unsigned long long )ktime_to_ns (delta) >>10 ; +printk ("initcall %pF returned %d after %lld usecs\n" , fn, + ret, duration); } msgbuf[0 ] =0 ; -if (ret.result && ret.result != -ENODEV && initcall_debug) -sprintf (msgbuf,"error code %d " , ret.result); +if (ret && ret != -ENODEV && initcall_debug) +sprintf (msgbuf,"error code %d " , ret);if (preempt_count () != count) {strlcat (msgbuf,"preemption imbalance " ,sizeof (msgbuf));
@@ -758,7 +752,7 @@ int do_one_initcall(initcall_t fn)printk ("initcall %pF returned with %s\n" , fn, msgbuf); } -return ret.result; +return ret; }
@@ -878,7 +872,6 @@ static int __init kernel_init(void * unused)smp_prepare_cpus (setup_max_cpus);do_pre_smp_initcalls (); -start_boot_trace ();smp_init ();sched_init_smp ();
kernel/trace/Kconfig +0 -17
@@ -229,23 +229,6 @@ config FTRACE_SYSCALLS help Basic tracer to catch the syscall entry and exit events. -config BOOT_TRACER - bool "Trace boot initcalls" - select GENERIC_TRACER - select CONTEXT_SWITCH_TRACER - help - This tracer helps developers to optimize boot times: it records - the timings of the initcalls and traces key events and the identity - of tasks that can cause boot delays, such as context-switches. - - Its aim is to be parsed by the scripts/bootgraph.pl tool to - produce pretty graphics about boot inefficiencies, giving a visual - representation of the delays during initcalls - but the raw - /debug/tracing/trace text output is readable too. - - You must pass in initcall_debug and ftrace=initcall to the kernel - command line to enable this on bootup. - config TRACE_BRANCH_PROFILING bool select GENERIC_TRACER
kernel/trace/Makefile +0 -1
@@ -38,7 +38,6 @@ obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o obj-$(CONFIG_NOP_TRACER) += trace_nop.o obj-$(CONFIG_STACK_TRACER) += trace_stack.o obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o -obj-$(CONFIG_BOOT_TRACER) += trace_boot.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o obj-$(CONFIG_KMEMTRACE) += kmemtrace.o
kernel/trace/trace.c +0 -3
@@ -4591,9 +4591,6 @@ __init static int tracer_alloc_buffers(void)register_tracer (&nop_trace); current_trace = &nop_trace; -#ifdef CONFIG_BOOT_TRACER -register_tracer (&boot_tracer); -#endif /* All seems OK, enable tracing */ tracing_disabled =0 ;
kernel/trace/trace.h +0 -8
@@ -9,10 +9,8 @@#include <linux/mmiotrace.h> #include <linux/tracepoint.h> #include <linux/ftrace.h> -#include <trace/boot.h> #include <linux/kmemtrace.h> #include <linux/hw_breakpoint.h> -#include <linux/trace_seq.h> #include <linux/ftrace_event.h>
@@ -29,8 +27,6 @@ enum trace_type {TRACE_MMIO_RW ,TRACE_MMIO_MAP ,TRACE_BRANCH , -TRACE_BOOT_CALL , -TRACE_BOOT_RET ,TRACE_GRAPH_RET ,TRACE_GRAPH_ENT , TRACE_USER_STACK,
@@ -48,8 +44,6 @@ enum kmemtrace_type_id { KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ }; -extern struct tracer boot_tracer; -#undef __field#define __field (type, item) type item;
@@ -209,8 +203,6 @@ extern void __ftrace_bad_type(void); TRACE_MMIO_RW); \ IF_ASSIGN(var, ent, struct trace_mmiotrace_map, \TRACE_MMIO_MAP ); \ - IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\ - IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\ IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \ IF_ASSIGN(var, ent, struct ftrace_graph_ent_entry, \TRACE_GRAPH_ENT ); \
kernel/trace/trace_boot.c deleted +0 -185
185 lines not on this page · raw message
kernel/trace/trace_entries.h +0 -27
@@ -271,33 +271,6 @@ FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map, __entry->map_id, __entry->opcode) ); -FTRACE_ENTRY (boot_call, trace_boot_call, - -TRACE_BOOT_CALL , - -F_STRUCT ( - __field_struct( struct boot_trace_call, boot_call ) - __field_desc( pid_t, boot_call, caller ) -__array_desc ( char, boot_call, func,KSYM_SYMBOL_LEN ) - ), - -F_printk ("%d %s" , __entry->caller, __entry->func) -); - -FTRACE_ENTRY (boot_ret, trace_boot_ret, - -TRACE_BOOT_RET , - -F_STRUCT ( - __field_struct( struct boot_trace_ret, boot_ret ) - __array_desc( char, boot_ret, func, KSYM_SYMBOL_LEN) - __field_desc( int, boot_ret, result ) - __field_desc( unsigned long, boot_ret, duration ) - ), - -F_printk ("%s %d %lx" , - __entry->func, __entry->result, __entry->duration) -);#define TRACE_FUNC_SIZE 30#define TRACE_FILE_SIZE 20
Signature · 1 line
1.6.2.3
PATCH 2/2 tracing: Remove kmemtrace ftrace plugin
In reply to Frederic WeisbeckerFrom: Li Zefan <[email protected]>
We have been resisting new ftrace plugins and removing existing ones, and kmemtrace has been superseded by kmem trace events and perf-kmem, so we remove it.
--- Documentation/ABI/testing/debugfs-kmemtrace | 71 ---- Documentation/trace/kmemtrace.txt | 126 ------- MAINTAINERS | 7 - include/linux/kmemtrace.h | 25 -- include/linux/slab_def.h | 3 +- include/linux/slub_def.h | 3 +- init/main.c | 2 - kernel/trace/Kconfig | 20 - kernel/trace/Makefile | 1 - kernel/trace/kmemtrace.c | 529 --------------------------- kernel/trace/trace.h | 12 - kernel/trace/trace_entries.h | 35 -- mm/slab.c | 1 - mm/slub.c | 1 - 14 files changed, 4 insertions(+), 832 deletions(-) delete mode 100644 Documentation/ABI/testing/debugfs-kmemtrace delete mode 100644 Documentation/trace/kmemtrace.txt delete mode 100644 include/linux/kmemtrace.h delete mode 100644 kernel/trace/kmemtrace.c
Documentation/ABI/testing/debugfs-kmemtrace deleted +0 -71
@@ -1,71 +0,0 @@ -What: /sys/kernel/debug/kmemtrace/ -Date: July 2008 -Contact: Eduard - Gabriel Munteanu <[email protected]> -Description: - -In kmemtrace-enabled kernels, the following files are created: - -/sys/kernel/debug/kmemtrace/ - cpu<n> (0400) Per-CPU tracing data, see below. (binary) - total_overruns (0400) Total number of bytes which were dropped from - cpu<n> files because of full buffer condition, - non-binary. (text) - abi_version (0400) Kernel's kmemtrace ABI version. (text) - -Each per-CPU file should be read according to the relay interface. That is, -the reader should set affinity to that specific CPU and, as currently done by -the userspace application (though there are other methods), use poll() with -an infinite timeout before every read(). Otherwise, erroneous data may be -read. The binary data has the following _core_ format: - - Event ID (1 byte) Unsigned integer, one of: - 0 - represents an allocation (KMEMTRACE_EVENT_ALLOC) - 1 - represents a freeing of previously allocated memory - (KMEMTRACE_EVENT_FREE) - Type ID (1 byte) Unsigned integer, one of: - 0 - this is a kmalloc() / kfree() - 1 - this is a kmem_cache_alloc() / kmem_cache_free() - 2 - this is a __get_free_pages() et al. - Event size (2 bytes) Unsigned integer representing the - size of this event. Used to extend - kmemtrace. Discard the bytes you - don't know about. - Sequence number (4 bytes) Signed integer used to reorder data - logged on SMP machines. Wraparound - must be taken into account, although - it is unlikely. - Caller address (8 bytes) Return address to the caller. - Pointer to mem (8 bytes) Pointer to target memory area. Can be - NULL, but not all such calls might be - recorded. - -In case of KMEMTRACE_EVENT_ALLOC events, the next fields follow: - - Requested bytes (8 bytes) Total number of requested bytes, - unsigned, must not be zero. - Allocated bytes (8 bytes) Total number of actually allocated - bytes, unsigned, must not be lower - than requested bytes. - Requested flags (4 bytes) GFP flags supplied by the caller. - Target CPU (4 bytes) Signed integer, valid for event id 1. - If equal to -1, target CPU is the same - as origin CPU, but the reverse might - not be true. - -The data is made available in the same endianness the machine has. - -Other event ids and type ids may be defined and added. Other fields may be -added by increasing event size, but see below for details. -Every modification to the ABI, including new id definitions, are followed -by bumping the ABI version by one. - -Adding new data to the packet (features) is done at the end of the mandatory -data: - Feature size (2 byte) - Feature ID (1 byte) - Feature data (Feature size - 3 bytes) - - -Users: - kmemtrace-user - git://repo.or.cz/kmemtrace-user.git -
Documentation/trace/kmemtrace.txt deleted +0 -126
126 lines not on this page · raw message
MAINTAINERS +0 -7
@@ -3323,13 +3323,6 @@ F: include/linux/kmemleak.h F: mm/kmemleak.c F: mm/kmemleak-test.c -KMEMTRACE -M: Eduard - Gabriel Munteanu <[email protected]> -S: Maintained -F: Documentation/trace/kmemtrace.txt -F: include/linux/kmemtrace.h -F: kernel/trace/kmemtrace.c - KPROBES M: Ananth N Mavinakayanahalli <[email protected]> M: Anil S Keshavamurthy <[email protected]>
include/linux/kmemtrace.h deleted +0 -25
@@ -1,25 +0,0 @@ -/* -* Copyright (C) 2008 Eduard - Gabriel Munteanu -* -* This file is released under GPL version 2. -*/ - -#ifndef _LINUX_KMEMTRACE_H -#define _LINUX_KMEMTRACE_H - -#ifdef __KERNEL__ - -#include <trace/events/kmem.h> - -#ifdef CONFIG_KMEMTRACE -extern void kmemtrace_init (void ); -#else -static inline void kmemtrace_init (void ) -{ -} -#endif - -#endif /* __KERNEL__ */ - -#endif /* _LINUX_KMEMTRACE_H */ -
include/linux/slab_def.h +2 -1
@@ -14,7 +14,8 @@#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ #include <linux/compiler.h> -#include <linux/kmemtrace.h> + +#include <trace/events/kmem.h> /* * struct kmem_cache
include/linux/slub_def.h +2 -1
@@ -10,9 +10,10 @@#include <linux/gfp.h> #include <linux/workqueue.h> #include <linux/kobject.h> -#include <linux/kmemtrace.h> #include <linux/kmemleak.h> +#include <trace/events/kmem.h> +enum stat_item {ALLOC_FASTPATH ,/* Allocation from cpu slab */ ALLOC_SLOWPATH ,/* Allocation by getting a new cpu slab */
init/main.c +0 -2
@@ -65,7 +65,6 @@#include <linux/ftrace.h> #include <linux/async.h> #include <linux/kmemcheck.h> -#include <linux/kmemtrace.h> #include <linux/sfi.h> #include <linux/shmem_fs.h> #include <linux/slab.h>
@@ -651,7 +650,6 @@ asmlinkage void __init start_kernel(void)#endif page_cgroup_init ();enable_debug_pagealloc (); -kmemtrace_init ();kmemleak_init ();debug_objects_mem_init ();idr_init_cache ();
kernel/trace/Kconfig +0 -20
@@ -354,26 +354,6 @@ config STACK_TRACER Say N if unsure. -config KMEMTRACE - bool "Trace SLAB allocations" - select GENERIC_TRACER - help - kmemtrace provides tracing for slab allocator functions, such as - kmalloc, kfree, kmem_cache_alloc, kmem_cache_free, etc. Collected - data is then fed to the userspace application in order to analyse - allocation hotspots, internal fragmentation and so on, making it - possible to see how well an allocator performs, as well as debug - and profile kernel code. - - This requires an userspace application to use. See - Documentation/trace/kmemtrace.txt for more information. - - Saying Y will make the kernel somewhat larger and slower. However, - if you disable kmemtrace at run-time or boot-time, the performance - impact is minimal (depending on the arch the kernel is built for). - - If unsure, say N. - config WORKQUEUE_TRACER bool "Trace workqueues" select GENERIC_TRACER
kernel/trace/Makefile +0 -1
@@ -40,7 +40,6 @@ obj-$(CONFIG_STACK_TRACER) += trace_stack.o obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o -obj-$(CONFIG_KMEMTRACE) += kmemtrace.o obj-$(CONFIG_WORKQUEUE_TRACER) += trace_workqueue.o obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o ifeq ($(CONFIG_BLOCK),y)
kernel/trace/kmemtrace.c deleted +0 -529
529 lines not on this page · raw message
kernel/trace/trace.h +0 -12
@@ -9,7 +9,6 @@#include <linux/mmiotrace.h> #include <linux/tracepoint.h> #include <linux/ftrace.h> -#include <linux/kmemtrace.h> #include <linux/hw_breakpoint.h> #include <linux/trace_seq.h> #include <linux/ftrace_event.h>
@@ -30,19 +29,12 @@ enum trace_type {TRACE_GRAPH_RET ,TRACE_GRAPH_ENT ,TRACE_USER_STACK , -TRACE_KMEM_ALLOC , -TRACE_KMEM_FREE ,TRACE_BLK ,TRACE_KSYM , __TRACE_LAST_TYPE, }; -enum kmemtrace_type_id { -KMEMTRACE_TYPE_KMALLOC =0 ,/* kmalloc() or kfree(). */ -KMEMTRACE_TYPE_CACHE ,/* kmem_cache_*(). */ -KMEMTRACE_TYPE_PAGES ,/* __get_free_pages() and friends. */ -};#undef __field#define __field (type, item) type item;
@@ -208,10 +200,6 @@ extern void __ftrace_bad_type(void); TRACE_GRAPH_ENT); \ IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \TRACE_GRAPH_RET ); \ - 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 ksym_trace_entry, TRACE_KSYM);\__ftrace_bad_type (); \ }while (0 )
kernel/trace/trace_entries.h +0 -35
@@ -291,41 +291,6 @@ FTRACE_ENTRY(branch, trace_branch, __entry->func, __entry->file, __entry->correct) ); -FTRACE_ENTRY (kmem_alloc, kmemtrace_alloc_entry, - -TRACE_KMEM_ALLOC , - -F_STRUCT ( - __field( enum kmemtrace_type_id, type_id ) - __field( unsigned long, call_site ) - __field( const void *, ptr ) - __field( size_t, bytes_req ) - __field( size_t, bytes_alloc ) - __field( gfp_t, gfp_flags ) -__field ( int, node ) - ), - -F_printk ("type:%u call_site:%lx ptr:%p req:%zi alloc:%zi" -" flags:%x node:%d" , - __entry->type_id, __entry->call_site, __entry->ptr, - __entry->bytes_req, __entry->bytes_alloc, - __entry->gfp_flags, __entry->node) -); - -FTRACE_ENTRY (kmem_free, kmemtrace_free_entry, - -TRACE_KMEM_FREE , - -F_STRUCT ( - __field( enum kmemtrace_type_id, type_id ) - __field( unsigned long, call_site ) - __field( const void *, ptr ) - ), - -F_printk ("type:%u call_site:%lx ptr:%p" , - __entry->type_id, __entry->call_site, __entry->ptr) -); - FTRACE_ENTRY(ksym_trace, ksym_trace_entry, TRACE_KSYM,
mm/slab.c +0 -1
@@ -102,7 +102,6 @@#include <linux/cpu.h> #include <linux/sysctl.h> #include <linux/module.h> -#include <linux/kmemtrace.h> #include <linux/rcupdate.h> #include <linux/string.h> #include <linux/uaccess.h>
mm/slub.c +0 -1
@@ -17,7 +17,6 @@#include <linux/slab.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> -#include <linux/kmemtrace.h> #include <linux/kmemcheck.h> #include <linux/cpu.h> #include <linux/cpuset.h>
Signature · 1 line
1.6.2.3