ftrace, v16
Subsystems (19)
while all ftrace patches are submitted to lkml i thought it might not hurt to post the full ftrace tree to lkml as well, for those who'd like to follow its general evolution.
The latest ftrace git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git auto-ftrace-next
there is a further topical splitup as well within the -tip tree, with these topic branches:
tip/tracing/ftrace
tip/tracing/sched_markers
tip/tracing/mmiotrace
tip/tracing/sysprof
auto-ftrace-next is their integration. These are all the bits that are in linux-next as well.
the shortlog and diffstat can be found below. I'll send the full patch as well in the next mail - hopefully the 300K mail gets through vger :-)
Ingo
------------------>
Abhishek Sagar (9):
ftrace: safe traversal of ftrace_hash hlist
ftrace: fix updating of ftrace_update_cnt
ftrace: core support for ARM
ftrace: distinguish kretprobe'd functions in trace logs
ftrace: export kretprobe_trampoline for function tracer
ftrace: prevent freeing of all failed updates
ftrace: remove ftrace_ip_converted()
ftrace: add debugfs entry 'failures'
ftrace: prevent freeing of all failed updates
Ankita Garg (2):
ftrace: fix conversion of task state to char in latency tracer
ftrace: disable tracing when current_tracer is set to "none"
Arnaldo Carvalho de Melo (2):
ftrace: annotate core code that should not be traced
ftrace: add basic support for gcc profiler instrumentation
David Miller (2):
ftrace: remove packed attribute on ftrace_page.
sparc64: add ftrace support.
Ingo Molnar (65):
sched: add latency tracer callbacks to the scheduler
tracing: add notrace to linkage.h
ftrace: fix kexec
ftrace: cleanups
ftrace: add README
ftrace: fix time offset
ftrace: fix locking
ftrace: cleanups
ftrace: timestamp syncing, prepare
ftrace: fast, scalable, synchronized timestamps
ftrace: remove-idx-sync
ftrace: clean-up-pipe-iteration
ftrace: add raw output
ftrace: bin-output
ftrace: add trace_special()
ftrace, locking fix
ftrace: use cpu clock again
ftrace: build fix
ftrace: introduce the "hex" output method
ftrace: build fix
ftrace: build fix
ftrace: cleanups
ftrace: disable -pg for the tracer itself
ftrace: remove notrace
ftrace: add wakeup events to sched tracer
ftrace: add stack tracing
ftrace: sched tracer fix
ftrace: make nostacktrace the default
ftrace: sched tracer, trace full rbtree
ftrace: trace curr/next tasks
ftrace: fix wakeups
ftrace: fix __trace_special()
ftrace: trace scheduler rbtree
ftrace: add tracing_cpumask
ftrace: make use of tracing_cpumask
ftrace: fix cmdline tracing
ftrace: iter ctrl fix
ftrace: include cpu in stacktrace
ftrace: sched tree fix
ftrace: sched special
ftrace: make it more available in the Kconfig
ftrace: remove add-hoc code
ftrace: restrict tracing to HAVE_FTRACE architectures
ftrace: cleanups
ftrace: trace faster
ftrace: special stacktrace
ftrace: stacktrace fix
ftrace: fix mcount export bug
ftrace: cleanups
ftrace: fix include file dependency
ftrace: fix build bug
ftrace: add sysprof plugin
ftrace: extend sysprof plugin
ftrace: extend sysprof plugin some more
ftrace: sysprof-plugin, add self-tests
ftrace: sysprof plugin improvement
ftrace: make sysprof dependent on x86 for now
ftrace: sysprof fix
ftrace: sysprof updates
sysprof: update copyrights
mmiotrace: ftrace fix
mmiotrace: cleanup
sched: do not trace sched_clock
ftrace: fix merge
sched: sched_clock() lockdep fix
Mathieu Desnoyers (3):
Markers - remove extra format argument
Markers - define non optimized marker
Port ftrace to markers
Pekka Paalanen (29):
x86: add a list for custom page fault handlers.
x86_64: fix kernel rodata NX setting
x86: fix SMP alternatives: use mutex instead of spinlock, text_poke is sleepable
ftrace: add readpos to struct trace_seq; add trace_seq_to_user()
x86: mmiotrace - trace memory mapped IO
x86 mmiotrace: use lookup_address()
x86 mmiotrace: fix relay-buffer-full flag for SMP
x86 mmiotrace: comment about user space ABI
x86: explicit call to mmiotrace in do_page_fault()
x86 mmiotrace: Use percpu instead of arrays.
x86: mmiotrace full patch, preview 1
x86: mmiotrace, preview 2
ftrace: add mmiotrace plugin
ftrace: mmiotrace, updates
ftrace: mmiotrace update, #2
x86 mmiotrace: move files into arch/x86/mm/.
x86 mmiotrace: remove ISA_trace parameter.
x86 mmiotrace: Do not print bogus pid
mmiotrace: add user documentation
x86 mmiotrace: dynamically disable non-boot CPUs
mmiotrace: print header using the read hook.
mmiotrace: print overrun counts
mmiotrace: do not print bogus pid for maps either
doc: update mmiotrace doc to current status
mmiotrace: code style cleanups
x86 mmiotrace: fix page-unaligned ioremaps
x86 mmiotrace: use resource_size_t for phys addresses
mmiotrace: rename kmmio_probe::user_data to :private.
x86 mmiotrace: page level is unsigned
Peter Zijlstra (3):
ftrace: trace next state
ftrace: fix wakeup callback
sched: clean up scheduler markers
Randy Dunlap (2):
mmiotrace: fix printk format
x86/mmiotrace: uses/depends on PCI
Soeren Sandmann (1):
ftrace/sysprof: don't trace the user stack if we are a kernel thread.
Soeren Sandmann Pedersen (2):
ftrace: allow the event pipe to be polled
sysprof: kernel trace
Steven Rostedt (82):
ftrace: make the task state char-string visible to all
ftrace: add preempt_enable/disable notrace macros
x86: add notrace annotations to vsyscall.
ftrace: latency tracer infrastructure
ftrace: function tracer
ftrace: add tracing of context switches
ftrace: tracer for scheduler wakeup latency
ftrace: trace irq disabled critical timings
ftrace: trace preempt off critical timings
ftrace: dynamic enabling/disabling of function calls
ftrace: add ftrace_enabled sysctl to disable mcount function
ftrace: use nops instead of jmp
ftrace: move memory management out of arch code
ftrace: use dynamic patching for updating mcount calls
ftrace: add filter select functions to trace
ftrace: convert single large buffer into single pages.
ftrace: debug smp_processor_id, use notrace preempt disable
ftrace: irqs off smp_processor_id() fix
ftrace: lockdep notrace annotations
ftrace: don't use raw_local_irq_save/restore
ftrace: fix updates to max trace
ftrace: fix max latency
ftrace: force recording
ftrace: add self-tests
ftrace: startup tester on dynamic tracing.
ftrace: disable all tracers on corrupted buffer
ftrace: reset selftests
ftrace: change buffers to producer consumer
ftrace: add a buffer for output
ftrace: user run time file reading
ftrace: pipe fixes
ftrace - fix dynamic ftrace memory leak
ftrace: disable tracing on failure
ftrace: enabled tracing by default
ftrace: add trace_function api for other tracers to use
ftrace: remove address of function names
ftrace: do not profile lib/string.o
ftrace: remove wakeup from function trace
ftrace: printk and trace irqsoff and wakeups
ftrace: add TRACE_STACK and TRACE_SPECIAL to selftest validation
ftrace: fix dynamic ftrace selftest
ftrace: irqsoff use raw_smp_processor_id
ftrace: user raw_spin_lock in tracing
ftrace: remove function tracing from spinlock debug
ftrace: use Makefile to remove tracing from lockdep
ftrace: add UNINTERRUPTIBLE state for kftraced on disable
ftrace: fix mutex unlock in trace output
ftrace: selftest protect againt max flip
ftrace: fix the fault label in updating code
ftrace: dont write protect kernel text
ftrace: allow trace_pipe to block on all reads
ftrace: restore iterator trace in pipe read
ftrace: return EOF in trace_pipe on change of tracer
ftrace: trace_pipe implement NONBLOCK
ftrace: user proper API for setting RT prios in selftest
ftrace: trace_entries to dynamically change trace buffer size
lockdep: update lockdep_recursion on graph_lock
ftrace: simple clean ups
ftrace: replace simple_strtoul with strict_strtoul
ftrace: modulize the number of CPU buffers
ftrace: comment code
ftrace: fix comm on function trace output
ftrace: add logic to record overruns
ftrace: add trace pipe header pluggin
ftrace: fix setting of pos in read_pipe
ftrace: use raw_smp_processor_id for mcount functions
ftrace: limit trace entries
ftrace, POWERPC: add irqs_disabled_flags to ppc
ftrace: support for PowerPC
kbuild: create new CFLAGS_REMOVE_(basename).o option
ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory
ftrace: use the new kbuild CFLAGS_REMOVE for lib directory
ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory
ftrace: add have dynamic ftrace config for archs
ftrace: limit use of check pages
ftrace: move ftrace_special to trace.c
ftrace: add function tracing to wake up tracing
ftrace: remove printks from irqsoff trace
ftrace: set_ftrace_notrace feature
ftrace: fix up cmdline recording
ftrace: powerpc clean ups
ftrace: user update and disable dynamic ftrace daemon
Thomas Gleixner (7):
ftrace: move enums to ftrace.h and make helper function global
ftrace: simplify hexprint
ftrace: remove notrace
ftrace: fix __trace_special()
ftrace: make it more available in the Kconfig
sysprof: make it depend on X86
markers: pick scheduler trace marks from lttng
Documentation/tracers/mmiotrace.txt | 164 ++ Makefile | 4 + arch/arm/Kconfig | 2 + arch/arm/boot/compressed/Makefile | 6 + arch/arm/kernel/Makefile | 5 + arch/arm/kernel/armksyms.c | 5 + arch/arm/kernel/entry-common.S | 47 + arch/arm/kernel/ftrace.c | 118 ++ arch/arm/kernel/kprobes.c | 2 +- arch/powerpc/Kconfig | 4 +- arch/powerpc/kernel/Makefile | 14 + arch/powerpc/kernel/entry_32.S | 123 ++ arch/powerpc/kernel/entry_64.S | 62 + arch/powerpc/kernel/ftrace.c | 161 ++ arch/powerpc/kernel/io.c | 3 +- arch/powerpc/kernel/irq.c | 6 +- arch/powerpc/kernel/ppc_ksyms.c | 5 + arch/powerpc/kernel/setup_32.c | 6 +- arch/powerpc/platforms/powermac/Makefile | 5 + arch/sparc64/Kconfig | 2 + arch/sparc64/Kconfig.debug | 2 +- arch/sparc64/kernel/Makefile | 1 + arch/sparc64/kernel/ftrace.c | 92 + arch/sparc64/lib/mcount.S | 58 +- arch/x86/Kconfig | 2 + arch/x86/Kconfig.debug | 28 + arch/x86/kernel/Makefile | 8 + arch/x86/kernel/alternative.c | 22 +- arch/x86/kernel/entry_32.S | 68 + arch/x86/kernel/entry_64.S | 102 + arch/x86/kernel/ftrace.c | 149 ++ arch/x86/kernel/i386_ksyms_32.c | 9 +- arch/x86/kernel/machine_kexec_32.c | 4 + arch/x86/kernel/machine_kexec_64.c | 4 + arch/x86/kernel/process_32.c | 3 + arch/x86/kernel/process_64.c | 3 + arch/x86/kernel/vsyscall_64.c | 3 +- arch/x86/kernel/x8664_ksyms_64.c | 11 +- arch/x86/lib/Makefile | 1 + arch/x86/lib/thunk_32.S | 47 + arch/x86/lib/thunk_64.S | 19 +- arch/x86/mm/Makefile | 5 + arch/x86/mm/fault.c | 13 + arch/x86/mm/init_32.c | 4 + arch/x86/mm/init_64.c | 10 +- arch/x86/mm/ioremap.c | 11 +- arch/x86/mm/kmmio.c | 509 +++++ arch/x86/mm/mmio-mod.c | 515 +++++ arch/x86/mm/pageattr.c | 1 + arch/x86/mm/pf_in.c | 489 +++++ arch/x86/mm/pf_in.h | 39 + arch/x86/mm/testmmiotrace.c | 71 + arch/x86/vdso/vclock_gettime.c | 15 +- arch/x86/vdso/vgetcpu.c | 3 +- include/asm-arm/kprobes.h | 1 + include/asm-powerpc/ftrace.h | 6 + include/asm-powerpc/hw_irq.h | 10 + include/asm-x86/alternative.h | 2 + include/asm-x86/irqflags.h | 24 +- include/asm-x86/vsyscall.h | 3 +- include/linux/ftrace.h | 140 ++ include/linux/irqflags.h | 13 +- include/linux/linkage.h | 2 + include/linux/marker.h | 40 +- include/linux/mmiotrace.h | 85 + include/linux/preempt.h | 34 +- include/linux/sched.h | 16 + include/linux/writeback.h | 2 + kernel/Makefile | 14 + kernel/fork.c | 2 +- kernel/lockdep.c | 33 +- kernel/marker.c | 30 +- kernel/printk.c | 2 + kernel/sched.c | 54 +- kernel/sched_trace.h | 41 + kernel/semaphore.c | 2 + kernel/spinlock.c | 2 +- kernel/sysctl.c | 11 + kernel/trace/Kconfig | 135 ++ kernel/trace/Makefile | 24 + kernel/trace/ftrace.c | 1599 +++++++++++++++ kernel/trace/trace.c | 3143 ++++++++++++++++++++++++++++++ kernel/trace/trace.h | 333 ++++ kernel/trace/trace_functions.c | 78 + kernel/trace/trace_irqsoff.c | 486 +++++ kernel/trace/trace_mmiotrace.c | 295 +++ kernel/trace/trace_sched_switch.c | 286 +++ kernel/trace/trace_sched_wakeup.c | 447 +++++ kernel/trace/trace_selftest.c | 563 ++++++ kernel/trace/trace_selftest_dynamic.c | 7 + kernel/trace/trace_sysprof.c | 363 ++++ lib/Kconfig.debug | 2 + lib/Makefile | 9 + lib/smp_processor_id.c | 6 +- mm/page-writeback.c | 10 +- scripts/Makefile.lib | 3 +- 96 files changed, 11309 insertions(+), 114 deletions(-) create mode 100644 Documentation/tracers/mmiotrace.txt create mode 100644 arch/arm/kernel/ftrace.c create mode 100644 arch/powerpc/kernel/ftrace.c create mode 100644 arch/sparc64/kernel/ftrace.c create mode 100644 arch/x86/kernel/ftrace.c create mode 100644 arch/x86/lib/thunk_32.S create mode 100644 arch/x86/mm/kmmio.c create mode 100644 arch/x86/mm/mmio-mod.c create mode 100644 arch/x86/mm/pf_in.c create mode 100644 arch/x86/mm/pf_in.h create mode 100644 arch/x86/mm/testmmiotrace.c create mode 100644 include/asm-powerpc/ftrace.h create mode 100644 include/linux/ftrace.h create mode 100644 include/linux/mmiotrace.h create mode 100644 kernel/sched_trace.h create mode 100644 kernel/trace/Kconfig create mode 100644 kernel/trace/Makefile create mode 100644 kernel/trace/ftrace.c create mode 100644 kernel/trace/trace.c create mode 100644 kernel/trace/trace.h create mode 100644 kernel/trace/trace_functions.c create mode 100644 kernel/trace/trace_irqsoff.c create mode 100644 kernel/trace/trace_mmiotrace.c create mode 100644 kernel/trace/trace_sched_switch.c create mode 100644 kernel/trace/trace_sched_wakeup.c create mode 100644 kernel/trace/trace_selftest.c create mode 100644 kernel/trace/trace_selftest_dynamic.c create mode 100644 kernel/trace/trace_sysprof.c
Quoted 3 lines · Ingo Molnar
the shortlog and diffstat can be found below. I'll send the full patch as well in the next mail - hopefully the 300K mail gets through vger :-)
here it is:
------------------>
Abhishek Sagar (9):
ftrace: safe traversal of ftrace_hash hlist
ftrace: fix updating of ftrace_update_cnt
ftrace: core support for ARM
ftrace: distinguish kretprobe'd functions in trace logs
ftrace: export kretprobe_trampoline for function tracer
ftrace: prevent freeing of all failed updates
ftrace: remove ftrace_ip_converted()
ftrace: add debugfs entry 'failures'
ftrace: prevent freeing of all failed updates
Ankita Garg (2):
ftrace: fix conversion of task state to char in latency tracer
ftrace: disable tracing when current_tracer is set to "none"
Arnaldo Carvalho de Melo (2):
ftrace: annotate core code that should not be traced
ftrace: add basic support for gcc profiler instrumentation
David Miller (2):
ftrace: remove packed attribute on ftrace_page.
sparc64: add ftrace support.
Ingo Molnar (65):
sched: add latency tracer callbacks to the scheduler
tracing: add notrace to linkage.h
ftrace: fix kexec
ftrace: cleanups
ftrace: add README
ftrace: fix time offset
ftrace: fix locking
ftrace: cleanups
ftrace: timestamp syncing, prepare
ftrace: fast, scalable, synchronized timestamps
ftrace: remove-idx-sync
ftrace: clean-up-pipe-iteration
ftrace: add raw output
ftrace: bin-output
ftrace: add trace_special()
ftrace, locking fix
ftrace: use cpu clock again
ftrace: build fix
ftrace: introduce the "hex" output method
ftrace: build fix
ftrace: build fix
ftrace: cleanups
ftrace: disable -pg for the tracer itself
ftrace: remove notrace
ftrace: add wakeup events to sched tracer
ftrace: add stack tracing
ftrace: sched tracer fix
ftrace: make nostacktrace the default
ftrace: sched tracer, trace full rbtree
ftrace: trace curr/next tasks
ftrace: fix wakeups
ftrace: fix __trace_special()
ftrace: trace scheduler rbtree
ftrace: add tracing_cpumask
ftrace: make use of tracing_cpumask
ftrace: fix cmdline tracing
ftrace: iter ctrl fix
ftrace: include cpu in stacktrace
ftrace: sched tree fix
ftrace: sched special
ftrace: make it more available in the Kconfig
ftrace: remove add-hoc code
ftrace: restrict tracing to HAVE_FTRACE architectures
ftrace: cleanups
ftrace: trace faster
ftrace: special stacktrace
ftrace: stacktrace fix
ftrace: fix mcount export bug
ftrace: cleanups
ftrace: fix include file dependency
ftrace: fix build bug
ftrace: add sysprof plugin
ftrace: extend sysprof plugin
ftrace: extend sysprof plugin some more
ftrace: sysprof-plugin, add self-tests
ftrace: sysprof plugin improvement
ftrace: make sysprof dependent on x86 for now
ftrace: sysprof fix
ftrace: sysprof updates
sysprof: update copyrights
mmiotrace: ftrace fix
mmiotrace: cleanup
sched: do not trace sched_clock
ftrace: fix merge
sched: sched_clock() lockdep fix
Mathieu Desnoyers (3):
Markers - remove extra format argument
Markers - define non optimized marker
Port ftrace to markers
Pekka Paalanen (29):
x86: add a list for custom page fault handlers.
x86_64: fix kernel rodata NX setting
x86: fix SMP alternatives: use mutex instead of spinlock, text_poke is sleepable
ftrace: add readpos to struct trace_seq; add trace_seq_to_user()
x86: mmiotrace - trace memory mapped IO
x86 mmiotrace: use lookup_address()
x86 mmiotrace: fix relay-buffer-full flag for SMP
x86 mmiotrace: comment about user space ABI
x86: explicit call to mmiotrace in do_page_fault()
x86 mmiotrace: Use percpu instead of arrays.
x86: mmiotrace full patch, preview 1
x86: mmiotrace, preview 2
ftrace: add mmiotrace plugin
ftrace: mmiotrace, updates
ftrace: mmiotrace update, #2
x86 mmiotrace: move files into arch/x86/mm/.
x86 mmiotrace: remove ISA_trace parameter.
x86 mmiotrace: Do not print bogus pid
mmiotrace: add user documentation
x86 mmiotrace: dynamically disable non-boot CPUs
mmiotrace: print header using the read hook.
mmiotrace: print overrun counts
mmiotrace: do not print bogus pid for maps either
doc: update mmiotrace doc to current status
mmiotrace: code style cleanups
x86 mmiotrace: fix page-unaligned ioremaps
x86 mmiotrace: use resource_size_t for phys addresses
mmiotrace: rename kmmio_probe::user_data to :private.
x86 mmiotrace: page level is unsigned
Peter Zijlstra (3):
ftrace: trace next state
ftrace: fix wakeup callback
sched: clean up scheduler markers
Randy Dunlap (2):
mmiotrace: fix printk format
x86/mmiotrace: uses/depends on PCI
Soeren Sandmann (1):
ftrace/sysprof: don't trace the user stack if we are a kernel thread.
Soeren Sandmann Pedersen (2):
ftrace: allow the event pipe to be polled
sysprof: kernel trace
Steven Rostedt (82):
ftrace: make the task state char-string visible to all
ftrace: add preempt_enable/disable notrace macros
x86: add notrace annotations to vsyscall.
ftrace: latency tracer infrastructure
ftrace: function tracer
ftrace: add tracing of context switches
ftrace: tracer for scheduler wakeup latency
ftrace: trace irq disabled critical timings
ftrace: trace preempt off critical timings
ftrace: dynamic enabling/disabling of function calls
ftrace: add ftrace_enabled sysctl to disable mcount function
ftrace: use nops instead of jmp
ftrace: move memory management out of arch code
ftrace: use dynamic patching for updating mcount calls
ftrace: add filter select functions to trace
ftrace: convert single large buffer into single pages.
ftrace: debug smp_processor_id, use notrace preempt disable
ftrace: irqs off smp_processor_id() fix
ftrace: lockdep notrace annotations
ftrace: don't use raw_local_irq_save/restore
ftrace: fix updates to max trace
ftrace: fix max latency
ftrace: force recording
ftrace: add self-tests
ftrace: startup tester on dynamic tracing.
ftrace: disable all tracers on corrupted buffer
ftrace: reset selftests
ftrace: change buffers to producer consumer
ftrace: add a buffer for output
ftrace: user run time file reading
ftrace: pipe fixes
ftrace - fix dynamic ftrace memory leak
ftrace: disable tracing on failure
ftrace: enabled tracing by default
ftrace: add trace_function api for other tracers to use
ftrace: remove address of function names
ftrace: do not profile lib/string.o
ftrace: remove wakeup from function trace
ftrace: printk and trace irqsoff and wakeups
ftrace: add TRACE_STACK and TRACE_SPECIAL to selftest validation
ftrace: fix dynamic ftrace selftest
ftrace: irqsoff use raw_smp_processor_id
ftrace: user raw_spin_lock in tracing
ftrace: remove function tracing from spinlock debug
ftrace: use Makefile to remove tracing from lockdep
ftrace: add UNINTERRUPTIBLE state for kftraced on disable
ftrace: fix mutex unlock in trace output
ftrace: selftest protect againt max flip
ftrace: fix the fault label in updating code
ftrace: dont write protect kernel text
ftrace: allow trace_pipe to block on all reads
ftrace: restore iterator trace in pipe read
ftrace: return EOF in trace_pipe on change of tracer
ftrace: trace_pipe implement NONBLOCK
ftrace: user proper API for setting RT prios in selftest
ftrace: trace_entries to dynamically change trace buffer size
lockdep: update lockdep_recursion on graph_lock
ftrace: simple clean ups
ftrace: replace simple_strtoul with strict_strtoul
ftrace: modulize the number of CPU buffers
ftrace: comment code
ftrace: fix comm on function trace output
ftrace: add logic to record overruns
ftrace: add trace pipe header pluggin
ftrace: fix setting of pos in read_pipe
ftrace: use raw_smp_processor_id for mcount functions
ftrace: limit trace entries
ftrace, POWERPC: add irqs_disabled_flags to ppc
ftrace: support for PowerPC
kbuild: create new CFLAGS_REMOVE_(basename).o option
ftrace: use the new kbuild CFLAGS_REMOVE for kernel directory
ftrace: use the new kbuild CFLAGS_REMOVE for lib directory
ftrace: use the new kbuild CFLAGS_REMOVE for x86/kernel directory
ftrace: add have dynamic ftrace config for archs
ftrace: limit use of check pages
ftrace: move ftrace_special to trace.c
ftrace: add function tracing to wake up tracing
ftrace: remove printks from irqsoff trace
ftrace: set_ftrace_notrace feature
ftrace: fix up cmdline recording
ftrace: powerpc clean ups
ftrace: user update and disable dynamic ftrace daemon
Thomas Gleixner (7):
ftrace: move enums to ftrace.h and make helper function global
ftrace: simplify hexprint
ftrace: remove notrace
ftrace: fix __trace_special()
ftrace: make it more available in the Kconfig
sysprof: make it depend on X86
markers: pick scheduler trace marks from lttng
Documentation/tracers/mmiotrace.txt | 164 ++ Makefile | 4 + arch/arm/Kconfig | 2 + arch/arm/boot/compressed/Makefile | 6 + arch/arm/kernel/Makefile | 5 + arch/arm/kernel/armksyms.c | 5 + arch/arm/kernel/entry-common.S | 47 + arch/arm/kernel/ftrace.c | 118 ++ arch/arm/kernel/kprobes.c | 2 +- arch/powerpc/Kconfig | 4 +- arch/powerpc/kernel/Makefile | 14 + arch/powerpc/kernel/entry_32.S | 123 ++ arch/powerpc/kernel/entry_64.S | 62 + arch/powerpc/kernel/ftrace.c | 161 ++ arch/powerpc/kernel/io.c | 3 +- arch/powerpc/kernel/irq.c | 6 +- arch/powerpc/kernel/ppc_ksyms.c | 5 + arch/powerpc/kernel/setup_32.c | 6 +- arch/powerpc/platforms/powermac/Makefile | 5 + arch/sparc64/Kconfig | 2 + arch/sparc64/Kconfig.debug | 2 +- arch/sparc64/kernel/Makefile | 1 + arch/sparc64/kernel/ftrace.c | 92 + arch/sparc64/lib/mcount.S | 58 +- arch/x86/Kconfig | 2 + arch/x86/Kconfig.debug | 28 + arch/x86/kernel/Makefile | 8 + arch/x86/kernel/alternative.c | 22 +- arch/x86/kernel/entry_32.S | 68 + arch/x86/kernel/entry_64.S | 102 + arch/x86/kernel/ftrace.c | 149 ++ arch/x86/kernel/i386_ksyms_32.c | 9 +- arch/x86/kernel/machine_kexec_32.c | 4 + arch/x86/kernel/machine_kexec_64.c | 4 + arch/x86/kernel/process_32.c | 3 + arch/x86/kernel/process_64.c | 3 + arch/x86/kernel/vsyscall_64.c | 3 +- arch/x86/kernel/x8664_ksyms_64.c | 11 +- arch/x86/lib/Makefile | 1 + arch/x86/lib/thunk_32.S | 47 + arch/x86/lib/thunk_64.S | 19 +- arch/x86/mm/Makefile | 5 + arch/x86/mm/fault.c | 13 + arch/x86/mm/init_32.c | 4 + arch/x86/mm/init_64.c | 10 +- arch/x86/mm/ioremap.c | 11 +- arch/x86/mm/kmmio.c | 509 +++++ arch/x86/mm/mmio-mod.c | 515 +++++ arch/x86/mm/pageattr.c | 1 + arch/x86/mm/pf_in.c | 489 +++++ arch/x86/mm/pf_in.h | 39 + arch/x86/mm/testmmiotrace.c | 71 + arch/x86/vdso/vclock_gettime.c | 15 +- arch/x86/vdso/vgetcpu.c | 3 +- include/asm-arm/kprobes.h | 1 + include/asm-powerpc/ftrace.h | 6 + include/asm-powerpc/hw_irq.h | 10 + include/asm-x86/alternative.h | 2 + include/asm-x86/irqflags.h | 24 +- include/asm-x86/vsyscall.h | 3 +- include/linux/ftrace.h | 140 ++ include/linux/irqflags.h | 13 +- include/linux/linkage.h | 2 + include/linux/marker.h | 40 +- include/linux/mmiotrace.h | 85 + include/linux/preempt.h | 34 +- include/linux/sched.h | 16 + include/linux/writeback.h | 2 + kernel/Makefile | 14 + kernel/fork.c | 2 +- kernel/lockdep.c | 33 +- kernel/marker.c | 30 +- kernel/printk.c | 2 + kernel/sched.c | 54 +- kernel/sched_trace.h | 41 + kernel/semaphore.c | 2 + kernel/spinlock.c | 2 +- kernel/sysctl.c | 11 + kernel/trace/Kconfig | 135 ++ kernel/trace/Makefile | 24 + kernel/trace/ftrace.c | 1599 +++++++++++++++ kernel/trace/trace.c | 3143 ++++++++++++++++++++++++++++++ kernel/trace/trace.h | 333 ++++ kernel/trace/trace_functions.c | 78 + kernel/trace/trace_irqsoff.c | 486 +++++ kernel/trace/trace_mmiotrace.c | 295 +++ kernel/trace/trace_sched_switch.c | 286 +++ kernel/trace/trace_sched_wakeup.c | 447 +++++ kernel/trace/trace_selftest.c | 563 ++++++ kernel/trace/trace_selftest_dynamic.c | 7 + kernel/trace/trace_sysprof.c | 363 ++++ lib/Kconfig.debug | 2 + lib/Makefile | 9 + lib/smp_processor_id.c | 6 +- mm/page-writeback.c | 10 +- scripts/Makefile.lib | 3 +- 96 files changed, 11309 insertions(+), 114 deletions(-) create mode 100644 Documentation/tracers/mmiotrace.txt create mode 100644 arch/arm/kernel/ftrace.c create mode 100644 arch/powerpc/kernel/ftrace.c create mode 100644 arch/sparc64/kernel/ftrace.c create mode 100644 arch/x86/kernel/ftrace.c create mode 100644 arch/x86/lib/thunk_32.S create mode 100644 arch/x86/mm/kmmio.c create mode 100644 arch/x86/mm/mmio-mod.c create mode 100644 arch/x86/mm/pf_in.c create mode 100644 arch/x86/mm/pf_in.h create mode 100644 arch/x86/mm/testmmiotrace.c create mode 100644 include/asm-powerpc/ftrace.h create mode 100644 include/linux/ftrace.h create mode 100644 include/linux/mmiotrace.h create mode 100644 kernel/sched_trace.h create mode 100644 kernel/trace/Kconfig create mode 100644 kernel/trace/Makefile create mode 100644 kernel/trace/ftrace.c create mode 100644 kernel/trace/trace.c create mode 100644 kernel/trace/trace.h create mode 100644 kernel/trace/trace_functions.c create mode 100644 kernel/trace/trace_irqsoff.c create mode 100644 kernel/trace/trace_mmiotrace.c create mode 100644 kernel/trace/trace_sched_switch.c create mode 100644 kernel/trace/trace_sched_wakeup.c create mode 100644 kernel/trace/trace_selftest.c create mode 100644 kernel/trace/trace_selftest_dynamic.c create mode 100644 kernel/trace/trace_sysprof.c
Documentation/tracers/mmiotrace.txt new file +164 -0
@@ -0,0 +1,164 @@ + In-kernel memory-mapped I/O tracing + + +Home page and links to optional user space tools: + + http://nouveau.freedesktop.org/wiki/MmioTrace + +MMIO tracing was originally developed by Intel around 2003 for their Fault +Injection Test Harness. In Dec 2006 - Jan 2007, using the code from Intel, +Jeff Muizelaar created a tool for tracing MMIO accesses with the Nouveau +project in mind. Since then many people have contributed. + +Mmiotrace was built for reverse engineering any memory-mapped IO device with +the Nouveau project as the first real user. Only x86 and x86_64 architectures +are supported. + +Out-of-tree mmiotrace was originally modified for mainline inclusion and +ftrace framework by Pekka Paalanen <[email protected]>. + + +Preparation +----------- + +Mmiotrace feature is compiled in by the CONFIG_MMIOTRACE option. Tracing is +disabled by default, so it is safe to have this set to yes. SMP systems are +supported, but tracing is unreliable and may miss events if more than one CPU +is on-line, therefore mmiotrace takes all but one CPU off-line during run-time +activation. You can re-enable CPUs by hand, but you have been warned, there +is no way to automatically detect if you are losing events due to CPUs racing. + + +Usage Quick Reference +--------------------- + +$ mount -t debugfs debugfs /debug +$ echo mmiotrace > /debug/tracing/current_tracer +$ cat /debug/tracing/trace_pipe > mydump.txt & +Start X or whatever. +$ echo "X is up" > /debug/tracing/marker +$ echo none > /debug/tracing/current_tracer +Check for lost events. + + +Usage +----- + +Make sure debugfs is mounted to /debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /debug + +Check that the driver you are about to trace is not loaded. + +Activate mmiotrace (requires root privileges): +$ echo mmiotrace > /debug/tracing/current_tracer + +Start storing the trace: +$ cat /debug/tracing/trace_pipe > mydump.txt & +The 'cat' process should stay running (sleeping) in the background. + +Load the driver you want to trace and use it. Mmiotrace will only catch MMIO +accesses to areas that are ioremapped while mmiotrace is active. + +[Unimplemented feature:] +During tracing you can place comments (markers) into the trace by +$ echo "X is up" > /debug/tracing/marker +This makes it easier to see which part of the (huge) trace corresponds to +which action. It is recommended to place descriptive markers about what you +do. + +Shut down mmiotrace (requires root privileges): +$ echo none > /debug/tracing/current_tracer +The 'cat' process exits. If it does not, kill it by issuing 'fg' command and +pressing ctrl+c. + +Check that mmiotrace did not lose events due to a buffer filling up. Either +$ grep -i lost mydump.txt +which tells you exactly how many events were lost, or use +$ dmesg +to view your kernel log and look for "mmiotrace has lost events" warning. If +events were lost, the trace is incomplete. You should enlarge the buffers and +try again. Buffers are enlarged by first seeing how large the current buffers +are: +$ cat /debug/tracing/trace_entries +gives you a number. Approximately double this number and write it back, for +instance: +$ echo 128000 > /debug/tracing/trace_entries +Then start again from the top. + +If you are doing a trace for a driver project, e.g. Nouveau, you should also +do the following before sending your results: +$ lspci -vvv > lspci.txt +$ 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. + + +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 +are not caught, since the mapping always exists and is returned directly. + +MMIO accesses are recorded via page faults. Just before __ioremap() returns, +the mapped pages are marked as not present. Any access to the pages causes a +fault. The page fault handler calls mmiotrace to handle the fault. Mmiotrace +marks the page present, sets TF flag to achieve single stepping and exits the +fault handler. The instruction that faulted is executed and debug trap is +entered. Here mmiotrace again marks the page as not present. The instruction +is decoded to get the type of operation (read/write), data width and the value +read or written. These are stored to the trace log. + +Setting the page present in the page fault handler has a race condition on SMP +machines. During the single stepping other CPUs may run freely on that page +and events can be missed without a notice. Re-enabling other CPUs during +tracing is discouraged. + + +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 +end of line. The format for version 20070824 is as follows: + +Explanation Keyword Space separated arguments +--------------------------------------------------------------------------- + +read event R width, timestamp, map id, physical, value, PC, PID +write event W width, timestamp, map id, physical, value, PC, PID +ioremap event MAP timestamp, map id, physical, virtual, length, PC, PID +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 +unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID + +Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual +is a kernel virtual address. Width is the data width in bytes and value is the +data value. Map id is an arbitrary id number identifying the mapping that was +used in an operation. PC is the program counter and PID is process id. PC is +zero if it is not recorded. PID is always zero as tracing MMIO accesses +originating in user space memory is not yet supported. + +For instance, the following awk filter will pass all 32-bit writes that target +physical addresses in the range [0xfb73ce40, 0xfb800000[ + +$ awk '/W 4 / { adr=strtonum($5); if (adr >= 0xfb73ce40 && +adr < 0xfb800000) print; }' + + +Tools for Developers +-------------------- + +The user space tools include utilities for: +- replacing numeric addresses and values with hardware register names +- replaying MMIO logs, i.e., re-executing the recorded writes + +
Makefile +4 -0
@@ -528,6 +528,10 @@ KBUILD_CFLAGS += -g KBUILD_AFLAGS += -gdwarf-2 endif +ifdef CONFIG_FTRACE +KBUILD_CFLAGS += -pg +endif + # We trigger additional mismatches with less inlining ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
arch/arm/Kconfig +2 -0
@@ -14,6 +14,8 @@ config ARM select HAVE_OPROFILE select HAVE_KPROBES if (!XIP_KERNEL) select HAVE_KRETPROBES if (HAVE_KPROBES) + select HAVE_FTRACE if (!XIP_KERNEL) + select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE) help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
arch/arm/boot/compressed/Makefile +6 -0
@@ -69,6 +69,12 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ head.o misc.o $(OBJS) + +ifeq ($(CONFIG_FTRACE),y) +ORIG_CFLAGS := $(KBUILD_CFLAGS) +KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) +endif + EXTRA_CFLAGS := -fpic -fno-builtin EXTRA_AFLAGS :=
arch/arm/kernel/Makefile +5 -0
@@ -4,6 +4,10 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) +ifdef CONFIG_DYNAMIC_FTRACE +CFLAGS_REMOVE_ftrace.o = -pg +endif + # Object file lists. obj-y := compat.o entry-armv.o entry-common.o irq.o \
@@ -18,6 +22,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o obj-$(CONFIG_ISA_DMA) += dma-isa.o obj-$(CONFIG_PCI) += bios32.o isa.o obj-$(CONFIG_SMP) += smp.o +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o obj-$(CONFIG_ATAGS_PROC) += atags.o
arch/arm/kernel/armksyms.c +5 -0
@@ -48,6 +48,11 @@ extern void __aeabi_ulcmp(void);extern void fpundefinstr (void );extern void fp_enter (void ); +#ifdef CONFIG_FTRACE +extern void mcount (void ); +EXPORT_SYMBOL (mcount); +#endif +/* * This has a special calling convention; it doesn't * modify any of the usual registers, except for LR.
arch/arm/kernel/entry-common.S +47 -0
53 lines not on this page · raw message
arch/arm/kernel/ftrace.c new file +118 -0
118 lines not on this page · raw message
arch/arm/kernel/kprobes.c +1 -1
@@ -274,7 +274,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,* for kretprobe handlers which should normally be interested in r0 only * anyway. */ -static void __attribute__((naked))__kprobes kretprobe_trampoline (void ) +void __naked __kprobes kretprobe_trampoline (void ) { __asm__ __volatile__ ( "stmdb sp!, {r0 - r11} \n\t"
arch/powerpc/Kconfig +3 -1
@@ -105,11 +105,13 @@ config ARCH_NO_VIRT_TO_BUS config PPC bool default y + select HAVE_DYNAMIC_FTRACE + select HAVE_FTRACE select HAVE_IDE - select HAVE_OPROFILE select HAVE_KPROBES select HAVE_KRETPROBES select HAVE_LMB + select HAVE_OPROFILE config EARLY_PRINTK bool
arch/powerpc/kernel/Makefile +14 -0
@@ -12,6 +12,18 @@ CFLAGS_prom_init.o += -fPIC CFLAGS_btext.o += -fPIC endif +ifdef CONFIG_FTRACE +# Do not trace early boot code +CFLAGS_REMOVE_cputable.o = -pg +CFLAGS_REMOVE_prom_init.o = -pg + +ifdef CONFIG_DYNAMIC_FTRACE +# dynamic ftrace setup. +CFLAGS_REMOVE_ftrace.o = -pg +endif + +endif + obj-y := cputable.o ptrace.o syscalls.o \ irq.o align.o signal_32.o pmc.o vdso.o \ init_task.o process.o systbl.o idle.o \
@@ -78,6 +90,8 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o \ obj-$(CONFIG_AUDIT) += audit.o obj64-$(CONFIG_AUDIT) += compat_audit.o +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o + obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o ifneq ($(CONFIG_PPC_INDIRECT_IO),y)
arch/powerpc/kernel/entry_32.S +123 -0
126 lines not on this page · raw message
arch/powerpc/kernel/entry_64.S +62 -0
65 lines not on this page · raw message
arch/powerpc/kernel/ftrace.c new file +161 -0
161 lines not on this page · raw message
arch/powerpc/kernel/io.c +2 -1
@@ -120,7 +120,8 @@ EXPORT_SYMBOL(_outsl_ns);#define IO_CHECK_ALIGN (v,a) ((((unsigned long)(v)) & ((a) - 1)) == 0) -void _memset_io (volatile void __iomem *addr,int c,unsigned long n) +notrace void +_memset_io (volatile void __iomem *addr,int c,unsigned long n) {void *p = (void __force *)addr;u32 lc = c;
arch/powerpc/kernel/irq.c +3 -3
@@ -98,7 +98,7 @@ EXPORT_SYMBOL(irq_desc);int distribute_irqs =1 ; -static inline unsigned long get_hard_enabled (void ) +static inline notrace unsigned long get_hard_enabled (void ) {unsigned long enabled;
@@ -108,13 +108,13 @@ static inline unsigned long get_hard_enabled(void)return enabled; } -static inline void set_soft_enabled (unsigned long enable) +static inline notrace void set_soft_enabled(unsigned long enable) { __asm__ __volatile__("stb %0,%1(13)" : :"r" (enable),"i" (offsetof(struct paca_struct , soft_enabled))); } -void raw_local_irq_restore (unsigned long en) +notrace void raw_local_irq_restore(unsigned long en) {/* * get_paca()->soft_enabled = en;
arch/powerpc/kernel/ppc_ksyms.c +5 -0
@@ -43,6 +43,7 @@#include <asm/div64.h> #include <asm/signal.h> #include <asm/dcr.h> +#include <asm/ftrace.h> #ifdef CONFIG_PPC32 extern void transfer_to_handler (void );
@@ -68,6 +69,10 @@ EXPORT_SYMBOL(single_step_exception);EXPORT_SYMBOL (sys_sigreturn);#endif +#ifdef CONFIG_FTRACE +EXPORT_SYMBOL (_mcount); +#endif +EXPORT_SYMBOL (strcpy);EXPORT_SYMBOL (strncpy);EXPORT_SYMBOL (strcat);
arch/powerpc/kernel/setup_32.c +3 -3
@@ -81,7 +81,7 @@ int ucache_bsize;* from the address that it was linked at, so we must use RELOC/PTRRELOC * to access static data (including strings). -- paulus */ -unsigned long __init early_init (unsigned long dt_ptr) +notrace unsigned long __init early_init (unsigned long dt_ptr) {unsigned long offset =reloc_offset ();struct cpu_spec *spec;
@@ -111,7 +111,7 @@ unsigned long __init early_init(unsigned long dt_ptr)* This is called very early on the boot process, after a minimal * MMU environment has been set up but before MMU_init is called. */ -void __init machine_init (unsigned long dt_ptr,unsigned long phys) +notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys) {/* Enable early debugging if any specified (see udbg.h) */ udbg_early_init ();
@@ -133,7 +133,7 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)#ifdef CONFIG_BOOKE_WDT /* Checks wdt=x and wdt_period=xx command-line option */ -int __init early_parse_wdt (char *p) +notrace int __init early_parse_wdt(char *p) {if (p &&strncmp (p,"0" ,1 ) !=0 ) booke_wdt_enabled =1 ;
arch/powerpc/platforms/powermac/Makefile +5 -0
@@ -1,5 +1,10 @@ CFLAGS_bootx_init.o += -fPIC +ifdef CONFIG_FTRACE +# Do not trace early boot code +CFLAGS_REMOVE_bootx_init.o = -pg +endif + obj-y += pic.o setup.o time.o feature.o pci.o \ sleep.o low_i2c.o cache.o pfunc_core.o \ pfunc_base.o
arch/sparc64/Kconfig +2 -0
@@ -11,6 +11,8 @@ config SPARC config SPARC64 bool default y + select HAVE_DYNAMIC_FTRACE + select HAVE_FTRACE select HAVE_IDE select HAVE_LMB select HAVE_ARCH_KGDB
arch/sparc64/Kconfig.debug +1 -1
@@ -33,7 +33,7 @@ config DEBUG_PAGEALLOC config MCOUNT bool - depends on STACK_DEBUG + depends on STACK_DEBUG || FTRACE default y config FRAME_POINTER
arch/sparc64/kernel/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-y := process.o setup.o cpu.o idprom.o \ power.o sbus.o sparc64_ksyms.o chmc.o \ visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_PCI) += ebus.o pci_common.o \ pci_psycho.o pci_sabre.o pci_schizo.o \
arch/sparc64/kernel/ftrace.c new file +92 -0
92 lines not on this page · raw message
arch/sparc64/lib/mcount.S +54 -4
70 lines not on this page · raw message
arch/x86/Kconfig +2 -0
@@ -23,6 +23,8 @@ config X86 select HAVE_OPROFILE select HAVE_KPROBES select HAVE_KRETPROBES + select HAVE_DYNAMIC_FTRACE + select HAVE_FTRACE select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) select HAVE_ARCH_KGDB if !X86_VOYAGER
arch/x86/Kconfig.debug +28 -0
@@ -172,6 +172,34 @@ config IOMMU_LEAK Add a simple leak tracer to the IOMMU code. This is useful when you are debugging a buggy device driver that leaks IOMMU mappings. +config MMIOTRACE_HOOKS + bool + +config MMIOTRACE + bool "Memory mapped IO tracing" + depends on DEBUG_KERNEL && PCI + select TRACING + select MMIOTRACE_HOOKS + default y + help + Mmiotrace traces Memory Mapped I/O access and is meant for + debugging and reverse engineering. It is called from the ioremap + implementation and works via page faults. Tracing is disabled by + default and can be enabled at run-time. + + See Documentation/tracers/mmiotrace.txt. + If you are not helping to develop drivers, say N. + +config MMIOTRACE_TEST + tristate "Test module for mmiotrace" + depends on MMIOTRACE && m + help + This is a dumb module for testing mmiotrace. It is very dangerous + as it will write garbage to IO memory starting at a given address. + However, it should be safe to use on e.g. unused portion of VRAM. + + Say N, unless you absolutely know what you are doing. + # # IO delay types: #
arch/x86/kernel/Makefile +8 -0
@@ -6,6 +6,13 @@ extra-y := head_$(BITS).o head$(BITS).o init_task.o vmlinux.lds CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) +ifdef CONFIG_FTRACE +# Do not profile debug utilities +CFLAGS_REMOVE_tsc_64.o = -pg +CFLAGS_REMOVE_tsc_32.o = -pg +CFLAGS_REMOVE_rtc.o = -pg +endif + # # vsyscalls (which work on the user stack) should have # no stack-protector checks:
@@ -56,6 +63,7 @@ obj-$(CONFIG_X86_MPPARSE) += mpparse.o obj-$(CONFIG_X86_LOCAL_APIC) += apic_$(BITS).o nmi_$(BITS).o obj-$(CONFIG_X86_IO_APIC) += io_apic_$(BITS).o obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o +obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
arch/x86/kernel/alternative.c +11 -11
@@ -1,6 +1,6 @@#include <linux/module.h> #include <linux/sched.h> -#include <linux/spinlock.h> +#include <linux/mutex.h> #include <linux/list.h> #include <linux/kprobes.h> #include <linux/mm.h>
@@ -143,7 +143,7 @@ static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = {#ifdef CONFIG_X86_64 extern char __vsyscall_0; -static inline const unsigned char *const *find_nop_table (void ) +const unsigned char *const *find_nop_table (void ) {return boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL || boot_cpu_data.x86 <6 ? k8_nops : p6_nops;
@@ -162,7 +162,7 @@ static const struct nop { { -1, NULL } }; -static const unsigned char *const *find_nop_table (void ) +const unsigned char *const *find_nop_table (void ) {const unsigned char *const *noptable = intel_nops;int i;
@@ -279,7 +279,7 @@ struct smp_alt_module {struct list_head next; };static LIST_HEAD (smp_alt_modules); -static DEFINE_SPINLOCK (smp_alt); +static DEFINE_MUTEX (smp_alt);static int smp_mode =1 ;/* protected by smp_alt */ void alternatives_smp_module_add(struct module *mod, char *name,
@@ -312,12 +312,12 @@ void alternatives_smp_module_add(struct module *mod, char *name, __func__, smp->locks, smp->locks_end, smp->text, smp->text_end, smp->name); -spin_lock (&smp_alt); +mutex_lock (&smp_alt);list_add_tail (&smp->next, &smp_alt_modules);if (boot_cpu_has (X86_FEATURE_UP ))alternatives_smp_unlock (smp->locks, smp->locks_end, smp->text, smp->text_end); -spin_unlock (&smp_alt); +mutex_unlock (&smp_alt); }void alternatives_smp_module_del (struct module *mod)
@@ -327,17 +327,17 @@ void alternatives_smp_module_del(struct module *mod)if (smp_alt_once || noreplace_smp)return ; -spin_lock (&smp_alt); +mutex_lock (&smp_alt);list_for_each_entry (item, &smp_alt_modules, next) {if (mod != item->mod)continue ;list_del (&item->next); -spin_unlock (&smp_alt); +mutex_unlock (&smp_alt);DPRINTK ("%s: %s\n" , __func__, item->name);kfree (item);return ; } -spin_unlock (&smp_alt); +mutex_unlock (&smp_alt); }void alternatives_smp_switch (int smp)
@@ -359,7 +359,7 @@ void alternatives_smp_switch(int smp)return ;BUG_ON (!smp && (num_online_cpus () >1 )); -spin_lock (&smp_alt); +mutex_lock (&smp_alt);/* * Avoid unnecessary switches because it forces JIT based VMs to
@@ -383,7 +383,7 @@ void alternatives_smp_switch(int smp) mod->text, mod->text_end); } smp_mode = smp; -spin_unlock (&smp_alt); +mutex_unlock (&smp_alt); }#endif
arch/x86/kernel/entry_32.S +68 -0
74 lines not on this page · raw message
arch/x86/kernel/entry_64.S +102 -0
108 lines not on this page · raw message
arch/x86/kernel/ftrace.c new file +149 -0
149 lines not on this page · raw message
arch/x86/kernel/i386_ksyms_32.c +8 -1
@@ -1,7 +1,14 @@ +#include <linux/ftrace.h> #include <linux/module.h> +#include <asm/checksum.h> -#include <asm/desc.h> #include <asm/pgtable.h> +#include <asm/desc.h> + +#ifdef CONFIG_FTRACE +/* mcount is defined in assembly */ +EXPORT_SYMBOL (mcount); +#endif /* Networking helper routines. */ EXPORT_SYMBOL (csum_partial_copy_generic);
arch/x86/kernel/machine_kexec_32.c +4 -0
@@ -11,6 +11,8 @@#include <linux/delay.h> #include <linux/init.h> #include <linux/numa.h> +#include <linux/ftrace.h> +#include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h>
@@ -107,6 +109,8 @@ NORET_TYPE void machine_kexec(struct kimage *image)unsigned long page_list[PAGES_NR ];void *control_page; +tracer_disable (); +/* Interrupts aren't acceptable while we reboot */ local_irq_disable ();
arch/x86/kernel/machine_kexec_64.c +4 -0
@@ -11,6 +11,8 @@#include <linux/string.h> #include <linux/reboot.h> #include <linux/numa.h> +#include <linux/ftrace.h> +#include <asm/pgtable.h> #include <asm/tlbflush.h> #include <asm/mmu_context.h>
@@ -184,6 +186,8 @@ NORET_TYPE void machine_kexec(struct kimage *image)unsigned long page_list[PAGES_NR ];void *control_page; +tracer_disable (); +/* Interrupts aren't acceptable while we reboot */ local_irq_disable ();
arch/x86/kernel/process_32.c +3 -0
@@ -185,7 +185,10 @@ void cpu_idle(void)local_irq_disable ();__get_cpu_var (irq_stat).idle_timestamp = jiffies; +/* Don't trace irqs off for idle */ +stop_critical_timings ();idle (); +start_critical_timings (); }tick_nohz_restart_sched_tick ();preempt_enable_no_resched ();
arch/x86/kernel/process_64.c +3 -0
@@ -165,7 +165,10 @@ void cpu_idle(void)*/ local_irq_disable ();enter_idle (); +/* Don't trace irqs off for idle */ +stop_critical_timings ();idle (); +start_critical_timings ();/* In many cases the interrupt that ended idle has already called exit_idle. But some idle loops can be woken up without interrupt. */
arch/x86/kernel/vsyscall_64.c +2 -1
@@ -42,7 +42,8 @@#include <asm/topology.h> #include <asm/vgtod.h> -#define __vsyscall (nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) +#define __vsyscall (nr) \ + __attribute__ ((unused, __section__(".vsyscall_" #nr))) notrace#define __syscall_clobber "r11","cx","memory"/*
arch/x86/kernel/x8664_ksyms_64.c +9 -2
@@ -1,15 +1,22 @@/* Exports for assembly files. All C exports should go in the respective C files. */ +#include <linux/ftrace.h> #include <linux/module.h> -#include <net/checksum.h> #include <linux/smp.h> +#include <net/checksum.h> +#include <asm/processor.h> -#include <asm/uaccess.h> #include <asm/pgtable.h> +#include <asm/uaccess.h> #include <asm/desc.h> +#ifdef CONFIG_FTRACE +/* mcount is defined in assembly */ +EXPORT_SYMBOL (mcount); +#endif +EXPORT_SYMBOL (kernel_thread);EXPORT_SYMBOL (__get_user_1);
arch/x86/lib/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_SMP) := msr-on-cpu.o lib-y := delay_$(BITS).o +lib-y += thunk_$(BITS).o lib-y += usercopy_$(BITS).o getuser_$(BITS).o putuser_$(BITS).o lib-y += memcpy_$(BITS).o
arch/x86/lib/thunk_32.S new file +47 -0
47 lines not on this page · raw message
arch/x86/lib/thunk_64.S +17 -2
@@ -2,6 +2,7 @@ * Save registers before calling assembly functions. This avoids * disturbance of register allocation in some inline assembly constructs. * Copyright 2001,2002 by Andi Kleen, SuSE Labs. + * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc. * Subject to the GNU public license, v.2. No warranty of any kind. */
@@ -42,8 +43,22 @@ #endif #ifdef CONFIG_TRACE_IRQFLAGS - thunk trace_hardirqs_on_thunk,trace_hardirqs_on - thunk trace_hardirqs_off_thunk,trace_hardirqs_off + /* put return address in rdi (arg1) */ + .macro thunk_ra name,func + .globl \name +\name: + CFI_STARTPROC + SAVE_ARGS + /* SAVE_ARGS pushs 9 elements */ + /* the next element would be the rip */ + movq 9*8(%rsp), %rdi + call \func + jmp restore + CFI_ENDPROC + .endm + + thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller + thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC
arch/x86/mm/Makefile +5 -0
@@ -8,6 +8,11 @@ obj-$(CONFIG_X86_PTDUMP) += dump_pagetables.o obj-$(CONFIG_HIGHMEM) += highmem_32.o +obj-$(CONFIG_MMIOTRACE_HOOKS) += kmmio.o +obj-$(CONFIG_MMIOTRACE) += mmiotrace.o +mmiotrace-y := pf_in.o mmio-mod.o +obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o + ifeq ($(CONFIG_X86_32),y) obj-$(CONFIG_NUMA) += discontig_32.o else
arch/x86/mm/fault.c +13 -0
@@ -10,6 +10,7 @@#include <linux/string.h> #include <linux/types.h> #include <linux/ptrace.h> +#include <linux/mmiotrace.h> #include <linux/mman.h> #include <linux/mm.h> #include <linux/smp.h>
@@ -49,6 +50,16 @@#define PF_RSVD (1<<3)#define PF_INSTR (1<<4) +static inline int kmmio_fault (struct pt_regs *regs,unsigned long addr) +{ +#ifdef CONFIG_MMIOTRACE_HOOKS +if (unlikely (is_kmmio_active ())) +if (kmmio_handler (regs, addr) ==1 ) +return -1 ; +#endif +return 0 ; +} +static inline int notify_page_fault (struct pt_regs *regs) {#ifdef CONFIG_KPROBES
@@ -601,6 +612,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)if (notify_page_fault (regs))return ; +if (unlikely (kmmio_fault (regs, address))) +return ;/* * We fault-in kernel-space virtual memory on-demand. The
arch/x86/mm/init_32.c +4 -0
@@ -710,6 +710,8 @@ void mark_rodata_ro(void)unsigned long start =PFN_ALIGN (_text);unsigned long size =PFN_ALIGN (_etext) - start; +#ifndef CONFIG_DYNAMIC_FTRACE +/* Dynamic tracing modifies the kernel text section */ set_pages_ro (virt_to_page (start), size >>PAGE_SHIFT );printk (KERN_INFO "Write protecting the kernel text: %luk\n" , size >>10 );
@@ -722,6 +724,8 @@ void mark_rodata_ro(void)printk (KERN_INFO "Testing CPA: write protecting again\n" );set_pages_ro (virt_to_page (start), size>>PAGE_SHIFT );#endif +#endif /* CONFIG_DYNAMIC_FTRACE */ + start += size; size = (unsigned long )__end_rodata - start;set_pages_ro (virt_to_page (start), size >>PAGE_SHIFT );
arch/x86/mm/init_64.c +8 -2
@@ -766,6 +766,13 @@ EXPORT_SYMBOL_GPL(rodata_test_data);void mark_rodata_ro (void ) {unsigned long start =PFN_ALIGN (_stext), end =PFN_ALIGN (__end_rodata); +unsigned long rodata_start = + ((unsigned long )__start_rodata +PAGE_SIZE -1 ) &PAGE_MASK ; + +#ifdef CONFIG_DYNAMIC_FTRACE +/* Dynamic tracing modifies the kernel text section */ + start = rodata_start; +#endif printk (KERN_INFO "Write protecting the kernel read-only data: %luk\n" , (end - start) >>10 );
@@ -775,8 +782,7 @@ void mark_rodata_ro(void)* The rodata section (but not the kernel text!) should also be * not-executable. */ - start = ((unsigned long )__start_rodata +PAGE_SIZE -1 ) &PAGE_MASK ; -set_memory_nx (start, (end - start) >>PAGE_SHIFT ); +set_memory_nx (rodata_start, (end - rodata_start) >>PAGE_SHIFT );rodata_test ();
arch/x86/mm/ioremap.c +10 -1
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/mmiotrace.h> #include <asm/cacheflush.h> #include <asm/e820.h>
@@ -122,10 +123,13 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, {unsigned long pfn, offset, vaddr;resource_size_t last_addr; +const resource_size_t unaligned_phys_addr = phys_addr; +const unsigned long unaligned_size = size;struct vm_struct *area;unsigned long new_prot_val;pgprot_t prot;int retval; +void __iomem *ret_addr;/* Don't allow wraparound or zero size */ last_addr = phys_addr + size -1 ;
@@ -233,7 +237,10 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,return NULL ; } -return (void __iomem *) (vaddr + offset); + ret_addr = (void __iomem *) (vaddr + offset); +mmiotrace_ioremap (unaligned_phys_addr, unaligned_size, ret_addr); + +return ret_addr; }/**
@@ -325,6 +332,8 @@ void iounmap(volatile void __iomem *addr) addr = (volatile void __iomem *) (PAGE_MASK & (unsigned long __force )addr); +mmiotrace_iounmap (addr); +/* Use the vm area unlocked, assuming the caller ensures there isn't another iounmap for the same address in parallel. Reuse of the virtual address is prevented by
arch/x86/mm/kmmio.c new file +509 -0
509 lines not on this page · raw message
arch/x86/mm/mmio-mod.c new file +515 -0
515 lines not on this page · raw message
arch/x86/mm/pageattr.c +1 -0
@@ -227,6 +227,7 @@ pte_t *lookup_address(unsigned long address, unsigned int *level)return pte_offset_kernel (pmd, address); } +EXPORT_SYMBOL_GPL (lookup_address);/* * Set the new pmd in all the pgds we know about:
arch/x86/mm/pf_in.c new file +489 -0
130 lines not on this page · raw message
arch/x86/mm/testmmiotrace.c new file +71 -0
71 lines not on this page · raw message
include/linux/ftrace.h new file +140 -0
140 lines not on this page · raw message
include/linux/mmiotrace.h new file +85 -0
85 lines not on this page · raw message
kernel/sched.c +51 -3
54 lines not on this page · raw message
kernel/sched_trace.h new file +41 -0
41 lines not on this page · raw message
kernel/trace/Kconfig new file +135 -0
135 lines not on this page · raw message
kernel/trace/ftrace.c new file +1599 -0
1,599 lines not on this page · raw message
kernel/trace/trace.c new file +3143 -0
3,143 lines not on this page · raw message
kernel/trace/trace.h new file +333 -0
333 lines not on this page · raw message
kernel/trace/trace_functions.c new file +78 -0
78 lines not on this page · raw message
kernel/trace/trace_irqsoff.c new file +486 -0
486 lines not on this page · raw message
kernel/trace/trace_mmiotrace.c new file +295 -0
295 lines not on this page · raw message
kernel/trace/trace_sched_switch.c new file +286 -0
286 lines not on this page · raw message
kernel/trace/trace_sched_wakeup.c new file +447 -0
447 lines not on this page · raw message
kernel/trace/trace_selftest.c new file +563 -0
563 lines not on this page · raw message
kernel/trace/trace_selftest_dynamic.c new file +7 -0
Lines of this file are not shown. View the raw message.
kernel/trace/trace_sysprof.c new file +363 -0
363 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Hi Ingo
Quoted 1 line
kbuild: create new CFLAGS_REMOVE_(basename).o option
But no changes to Documentation/kbuild/makefiles.txt
Documentation must be included for new kbuild features.
arch/arm/kernel/Makefile line 9
Quoted 3 lines
arch/arm/kernel/Makefile +3
-0+ifdef CONFIG_DYNAMIC_FTRACE +CFLAGS_REMOVE_ftrace.o = -pg +endif
I can see where this comes from as we have:
CFLAGS_ftrace.o := -foobar
But in all cases below I see the pattern:
ifdef CONFIG_FOO_BAR
CFLAGS_REMOVE_foobar.o = -pg
endif
And it would be nice to get this on one line instead. And use a syntax we can somehow remember.
Today we have:
ccflags-y := -foobar
to add options valid for the whole file.
So we should then add:
- possibility to remove an option valid for the whole file
- add/remove an option for a single file
The suggested syntax:
ccflags-remove-y := -foobar
ccflags-<file.o>-y := -foobar
ccflags-remove-<file.o>-y := -foobar
So in the case above for ftrace we would use:
ccflags-remove-ftrace.o-$(CONFIG_DYNAMIC_FTRACE) := -pg
Comments?
PS. Yes - I saw the patches when they were sent to linux-kbuild but I just never came around commenting them.
Sam
Quoted 39 lines · Sam Ravnborg
Hi Ingo
Quoted 1 line
kbuild: create new CFLAGS_REMOVE_(basename).o option
But no changes to
Documentation/kbuild/makefiles.txtDocumentation must be included for new kbuild features.
arch/arm/kernel/Makefile line 9
Quoted 3 lines
arch/arm/kernel/Makefile +3
-0+ifdef CONFIG_DYNAMIC_FTRACE +CFLAGS_REMOVE_ftrace.o = -pg +endifI can see where this comes from as we have:
CFLAGS_ftrace.o := -foobar
But in all cases below I see the pattern:
ifdef
CONFIG_FOO_BAR
CFLAGS_REMOVE_foobar.o = -pg
endifAnd it would be nice to get this on one line instead. And use a syntax we can somehow remember.
Today we have:
ccflags-y := -foobarto add options valid for the whole file.
So we should then add:
- possibility to remove an option valid for the whole file
- add/remove an option for a single fileThe suggested syntax:
ccflags-remove-y := -foobar
ccflags-<file.o>-y := -foobar
ccflags-remove-<file.o>-y := -foobar
Quoted 5 lines
So in the case above for ftrace we would use:
ccflags-remove-ftrace.o-$(CONFIG_DYNAMIC_FTRACE) := -pg
Comments?
sounds like a good cleanup to me. Would you be interested in sending patches for this?
Ingo
Quoted 42 lines · Ingo Molnar
Quoted 39 lines · Sam Ravnborg
Hi Ingo
Quoted 1 line
kbuild: create new CFLAGS_REMOVE_(basename).o option
But no changes to
Documentation/kbuild/makefiles.txtDocumentation must be included for new kbuild features.
arch/arm/kernel/Makefile line 9
Quoted 3 lines
arch/arm/kernel/Makefile +3
-0+ifdef CONFIG_DYNAMIC_FTRACE +CFLAGS_REMOVE_ftrace.o = -pg +endifI can see where this comes from as we have:
CFLAGS_ftrace.o := -foobar
But in all cases below I see the pattern:
ifdef
CONFIG_FOO_BAR
CFLAGS_REMOVE_foobar.o = -pg
endifAnd it would be nice to get this on one line instead. And use a syntax we can somehow remember.
Today we have:
ccflags-y := -foobarto add options valid for the whole file.
So we should then add:
- possibility to remove an option valid for the whole file
- add/remove an option for a single fileThe suggested syntax:
ccflags-remove-y := -foobar
ccflags-<file.o>-y := -foobar
ccflags-remove-<file.o>-y := -foobar
Quoted 8 lines
Quoted 5 lines
So in the case above for ftrace we would use:
ccflags-remove-ftrace.o-$(CONFIG_DYNAMIC_FTRACE) := -pg
Comments?
sounds like a good cleanup to me. Would you be interested in sending patches for this?
Will do - but need to fix -next breakage first and a few other things.
Sam