Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140867
b: refs/heads/master
c: 1609743
h: refs/heads/master
i:
  140865: 44e4f6b
  140863: 35dcd73
v: v3
  • Loading branch information
Ingo Molnar committed Mar 6, 2009
1 parent 7c2cb47 commit 24b52db
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 173 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: 0012693ad4f636c720fed3802027f9427962f540
refs/heads/master: 16097439703bcd38e9fe5608c12add6dacb825ea
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
ftrace_printk() For example, if you want to put a comment inside
trace_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 ftrace_printk() inside __might_sleep()
<linux/ftrace.h> and call trace_printk() inside __might_sleep()

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

will produce:

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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
58 changes: 2 additions & 56 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,62 +319,6 @@ 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 @@ -543,6 +487,8 @@ 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: 58 additions & 0 deletions trunk/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,64 @@ 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: 16 additions & 13 deletions trunk/kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,22 @@ 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 @@ -91,7 +101,6 @@ 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 @@ -114,7 +123,6 @@ 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 @@ -142,7 +150,6 @@ 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 @@ -152,7 +159,6 @@ config SCHED_TRACER

config CONTEXT_SWITCH_TRACER
bool "Trace process context switches"
depends on DEBUG_KERNEL
select TRACING
select MARKERS
help
Expand All @@ -161,7 +167,6 @@ 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 @@ -170,7 +175,6 @@ config EVENT_TRACER

config BOOT_TRACER
bool "Trace boot initcalls"
depends on DEBUG_KERNEL
select TRACING
select CONTEXT_SWITCH_TRACER
help
Expand All @@ -188,7 +192,6 @@ 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 @@ -241,7 +244,6 @@ config BRANCH_TRACER

config POWER_TRACER
bool "Trace power consumption behavior"
depends on DEBUG_KERNEL
depends on X86
select TRACING
help
Expand All @@ -253,7 +255,6 @@ 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 @@ -343,7 +344,6 @@ 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 && DEBUG_KERNEL
depends on TRACING
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 && DEBUG_KERNEL && PCI
depends on HAVE_MMIOTRACE_SUPPORT && PCI
select TRACING
help
Mmiotrace traces Memory Mapped I/O access and is meant for
Expand All @@ -401,3 +401,6 @@ config MMIOTRACE_TEST
Say N, unless you absolutely know what you are doing.

endmenu

endif # TRACING_SUPPORT

1 change: 0 additions & 1 deletion trunk/kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,6 @@ 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: 5 additions & 1 deletion trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,7 @@ 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 @@ -2515,6 +2516,9 @@ 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 @@ -2531,7 +2535,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer,

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

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

0 comments on commit 24b52db

Please sign in to comment.