Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140866
b: refs/heads/master
c: 0012693
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Mar 5, 2009
1 parent 44e4f6b commit 7c2cb47
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 142 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40ada30f9621fbd831ac2437b9a2a399aad34b00
refs/heads/master: 0012693ad4f636c720fed3802027f9427962f540
6 changes: 3 additions & 3 deletions trunk/Documentation/ftrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1466,11 +1466,11 @@ want, depending on your needs.


You can put some comments on specific functions by using
trace_printk() For example, if you want to put a comment inside
ftrace_printk() For example, if you want to put a comment inside
the __might_sleep() function, you just have to include
<linux/ftrace.h> and call trace_printk() inside __might_sleep()
<linux/ftrace.h> and call ftrace_printk() inside __might_sleep()

trace_printk("I'm a comment!\n")
ftrace_printk("I'm a comment!\n")

will produce:

Expand Down
1 change: 0 additions & 1 deletion trunk/arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ config OPROFILE
tristate "OProfile system profiling (EXPERIMENTAL)"
depends on PROFILING
depends on HAVE_OPROFILE
depends on TRACING_SUPPORT
select TRACING
select RING_BUFFER
help
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
return;
}

calltime = cpu_clock(raw_smp_processor_id());
calltime = trace_clock_local();

if (ftrace_push_return_trace(old, calltime,
self_addr, &trace.depth) == -EBUSY) {
Expand Down
71 changes: 63 additions & 8 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#ifndef _LINUX_FTRACE_H
#define _LINUX_FTRACE_H

#include <linux/linkage.h>
#include <linux/fs.h>
#include <linux/ktime.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/trace_clock.h>
#include <linux/kallsyms.h>
#include <linux/linkage.h>
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/ktime.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/fs.h>

#include <asm/ftrace.h>

Expand Down Expand Up @@ -318,6 +319,62 @@ static inline void __ftrace_enabled_restore(int enabled)
# define trace_preempt_off(a0, a1) do { } while (0)
#endif

#ifdef CONFIG_TRACING
extern int ftrace_dump_on_oops;

extern void tracing_start(void);
extern void tracing_stop(void);
extern void ftrace_off_permanent(void);

extern void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);

/**
* ftrace_printk - printf formatting in the ftrace buffer
* @fmt: the printf format for printing
*
* Note: __ftrace_printk is an internal function for ftrace_printk and
* the @ip is passed in via the ftrace_printk macro.
*
* This function allows a kernel developer to debug fast path sections
* that printk is not appropriate for. By scattering in various
* printk like tracing in the code, a developer can quickly see
* where problems are occurring.
*
* This is intended as a debugging tool for the developer only.
* Please refrain from leaving ftrace_printks scattered around in
* your code.
*/
# define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt)
extern int
__ftrace_printk(unsigned long ip, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
# define ftrace_vprintk(fmt, ap) __ftrace_printk(_THIS_IP_, fmt, ap)
extern int
__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
extern void ftrace_dump(void);
#else
static inline void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
static inline int
ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));

static inline void tracing_start(void) { }
static inline void tracing_stop(void) { }
static inline void ftrace_off_permanent(void) { }
static inline int
ftrace_printk(const char *fmt, ...)
{
return 0;
}
static inline int
ftrace_vprintk(const char *fmt, va_list ap)
{
return 0;
}
static inline void ftrace_dump(void) { }
#endif

#ifdef CONFIG_FTRACE_MCOUNT_RECORD
extern void ftrace_init(void);
extern void ftrace_init_module(struct module *mod,
Expand Down Expand Up @@ -486,8 +543,6 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
return tsk->trace & TSK_TRACE_FL_GRAPH;
}

extern int ftrace_dump_on_oops;

#endif /* CONFIG_TRACING */


Expand Down
58 changes: 0 additions & 58 deletions trunk/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,64 +367,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
#endif

/*
* General tracing related utility functions - trace_printk(),
* tracing_start()/tracing_stop:
*/
#ifdef CONFIG_TRACING
extern void tracing_start(void);
extern void tracing_stop(void);
extern void ftrace_off_permanent(void);

extern void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);

/**
* trace_printk - printf formatting in the ftrace buffer
* @fmt: the printf format for printing
*
* Note: __trace_printk is an internal function for trace_printk and
* the @ip is passed in via the trace_printk macro.
*
* This function allows a kernel developer to debug fast path sections
* that printk is not appropriate for. By scattering in various
* printk like tracing in the code, a developer can quickly see
* where problems are occurring.
*
* This is intended as a debugging tool for the developer only.
* Please refrain from leaving trace_printks scattered around in
* your code.
*/
# define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt)
extern int
__trace_printk(unsigned long ip, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
# define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap)
extern int
__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
extern void ftrace_dump(void);
#else
static inline void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
static inline int
trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));

static inline void tracing_start(void) { }
static inline void tracing_stop(void) { }
static inline void ftrace_off_permanent(void) { }
static inline int
trace_printk(const char *fmt, ...)
{
return 0;
}
static inline int
ftrace_vprintk(const char *fmt, va_list ap)
{
return 0;
}
static inline void ftrace_dump(void) { }
#endif

/*
* Display an IP address in readable format.
*/
Expand Down
29 changes: 13 additions & 16 deletions trunk/kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,12 @@ config TRACING
select TRACEPOINTS
select NOP_TRACER

#
# Minimum requirements an architecture has to meet for us to
# be able to offer generic tracing facilities:
#
config TRACING_SUPPORT
bool
depends on TRACE_IRQFLAGS_SUPPORT
depends on STACKTRACE_SUPPORT

if TRACING_SUPPORT

menu "Tracers"

config FUNCTION_TRACER
bool "Kernel Function Tracer"
depends on HAVE_FUNCTION_TRACER
depends on DEBUG_KERNEL
select FRAME_POINTER
select KALLSYMS
select TRACING
Expand Down Expand Up @@ -101,6 +91,7 @@ config IRQSOFF_TRACER
default n
depends on TRACE_IRQFLAGS_SUPPORT
depends on GENERIC_TIME
depends on DEBUG_KERNEL
select TRACE_IRQFLAGS
select TRACING
select TRACER_MAX_TRACE
Expand All @@ -123,6 +114,7 @@ config PREEMPT_TRACER
default n
depends on GENERIC_TIME
depends on PREEMPT
depends on DEBUG_KERNEL
select TRACING
select TRACER_MAX_TRACE
help
Expand Down Expand Up @@ -150,6 +142,7 @@ config SYSPROF_TRACER

config SCHED_TRACER
bool "Scheduling Latency Tracer"
depends on DEBUG_KERNEL
select TRACING
select CONTEXT_SWITCH_TRACER
select TRACER_MAX_TRACE
Expand All @@ -159,6 +152,7 @@ config SCHED_TRACER

config CONTEXT_SWITCH_TRACER
bool "Trace process context switches"
depends on DEBUG_KERNEL
select TRACING
select MARKERS
help
Expand All @@ -167,6 +161,7 @@ config CONTEXT_SWITCH_TRACER

config EVENT_TRACER
bool "Trace various events in the kernel"
depends on DEBUG_KERNEL
select TRACING
help
This tracer hooks to various trace points in the kernel
Expand All @@ -175,6 +170,7 @@ config EVENT_TRACER

config BOOT_TRACER
bool "Trace boot initcalls"
depends on DEBUG_KERNEL
select TRACING
select CONTEXT_SWITCH_TRACER
help
Expand All @@ -192,6 +188,7 @@ config BOOT_TRACER

config TRACE_BRANCH_PROFILING
bool "Trace likely/unlikely profiler"
depends on DEBUG_KERNEL
select TRACING
help
This tracer profiles all the the likely and unlikely macros
Expand Down Expand Up @@ -244,6 +241,7 @@ config BRANCH_TRACER

config POWER_TRACER
bool "Trace power consumption behavior"
depends on DEBUG_KERNEL
depends on X86
select TRACING
help
Expand All @@ -255,6 +253,7 @@ config POWER_TRACER
config STACK_TRACER
bool "Trace max stack"
depends on HAVE_FUNCTION_TRACER
depends on DEBUG_KERNEL
select FUNCTION_TRACER
select STACKTRACE
select KALLSYMS
Expand Down Expand Up @@ -344,6 +343,7 @@ config DYNAMIC_FTRACE
bool "enable/disable ftrace tracepoints dynamically"
depends on FUNCTION_TRACER
depends on HAVE_DYNAMIC_FTRACE
depends on DEBUG_KERNEL
default y
help
This option will modify all the calls to ftrace dynamically
Expand All @@ -369,7 +369,7 @@ config FTRACE_SELFTEST

config FTRACE_STARTUP_TEST
bool "Perform a startup test on ftrace"
depends on TRACING
depends on TRACING && DEBUG_KERNEL
select FTRACE_SELFTEST
help
This option performs a series of startup tests on ftrace. On bootup
Expand All @@ -379,7 +379,7 @@ config FTRACE_STARTUP_TEST

config MMIOTRACE
bool "Memory mapped IO tracing"
depends on HAVE_MMIOTRACE_SUPPORT && PCI
depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
select TRACING
help
Mmiotrace traces Memory Mapped I/O access and is meant for
Expand All @@ -401,6 +401,3 @@ config MMIOTRACE_TEST
Say N, unless you absolutely know what you are doing.

endmenu

endif # TRACING_SUPPORT

1 change: 1 addition & 0 deletions trunk/kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ static struct tracer blk_tracer __read_mostly = {
static struct trace_event trace_blk_event = {
.type = TRACE_BLK,
.trace = blk_trace_event_print,
.latency_trace = blk_trace_event_print,
.binary = blk_trace_event_print_binary,
};

Expand Down
6 changes: 1 addition & 5 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,6 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
unsigned long flags;
unsigned int commit;
unsigned int read;
u64 save_timestamp;
int ret = -1;

/*
Expand Down Expand Up @@ -2516,9 +2515,6 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
if (len < size)
goto out;

/* save the current timestamp, since the user will need it */
save_timestamp = cpu_buffer->read_stamp;

/* Need to copy one event at a time */
do {
memcpy(bpage->data + pos, rpage->data + rpos, size);
Expand All @@ -2535,7 +2531,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer,

/* update bpage */
local_set(&bpage->commit, pos);
bpage->time_stamp = save_timestamp;
bpage->time_stamp = rpage->time_stamp;

/* we copied everything to the beginning */
read = 0;
Expand Down
Loading

0 comments on commit 7c2cb47

Please sign in to comment.