Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6712e299
Commit
6712e299
authored
Jul 14, 2008
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tracing/ftrace' into auto-ftrace-next
parents
ec1bb60b
b2613e37
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
10 deletions
+54
-10
include/linux/ftrace.h
include/linux/ftrace.h
+1
-0
kernel/Makefile
kernel/Makefile
+1
-1
kernel/trace/ftrace.c
kernel/trace/ftrace.c
+17
-0
kernel/trace/trace.c
kernel/trace/trace.c
+20
-4
kernel/trace/trace.h
kernel/trace/trace.h
+8
-2
kernel/trace/trace_functions.c
kernel/trace/trace_functions.c
+3
-0
kernel/trace/trace_sched_switch.c
kernel/trace/trace_sched_switch.c
+2
-2
kernel/trace/trace_sched_wakeup.c
kernel/trace/trace_sched_wakeup.c
+2
-1
No files found.
include/linux/ftrace.h
View file @
6712e299
...
@@ -89,6 +89,7 @@ void ftrace_enable_daemon(void);
...
@@ -89,6 +89,7 @@ void ftrace_enable_daemon(void);
/* totally disable ftrace - can not re-enable after this */
/* totally disable ftrace - can not re-enable after this */
void
ftrace_kill
(
void
);
void
ftrace_kill
(
void
);
void
ftrace_kill_atomic
(
void
);
static
inline
void
tracer_disable
(
void
)
static
inline
void
tracer_disable
(
void
)
{
{
...
...
kernel/Makefile
View file @
6712e299
...
@@ -11,7 +11,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
...
@@ -11,7 +11,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o
\
hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o
\
notifier.o ksysfs.o pm_qos_params.o sched_clock.o
notifier.o ksysfs.o pm_qos_params.o sched_clock.o
CFLAGS_REMOVE_sched.o
=
-
pg
-
mno-spe
CFLAGS_REMOVE_sched.o
=
-mno-spe
ifdef
CONFIG_FTRACE
ifdef
CONFIG_FTRACE
# Do not trace debug files and internal ftrace files
# Do not trace debug files and internal ftrace files
...
...
kernel/trace/ftrace.c
View file @
6712e299
...
@@ -1601,6 +1601,23 @@ core_initcall(ftrace_dynamic_init);
...
@@ -1601,6 +1601,23 @@ core_initcall(ftrace_dynamic_init);
# define ftrace_force_shutdown() do { } while (0)
# define ftrace_force_shutdown() do { } while (0)
#endif
/* CONFIG_DYNAMIC_FTRACE */
#endif
/* CONFIG_DYNAMIC_FTRACE */
/**
* ftrace_kill_atomic - kill ftrace from critical sections
*
* This function should be used by panic code. It stops ftrace
* but in a not so nice way. If you need to simply kill ftrace
* from a non-atomic section, use ftrace_kill.
*/
void
ftrace_kill_atomic
(
void
)
{
ftrace_disabled
=
1
;
ftrace_enabled
=
0
;
#ifdef CONFIG_DYNAMIC_FTRACE
ftraced_suspend
=
-
1
;
#endif
clear_ftrace_function
();
}
/**
/**
* ftrace_kill - totally shutdown ftrace
* ftrace_kill - totally shutdown ftrace
*
*
...
...
kernel/trace/trace.c
View file @
6712e299
...
@@ -96,6 +96,9 @@ static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
...
@@ -96,6 +96,9 @@ static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
/* tracer_enabled is used to toggle activation of a tracer */
/* tracer_enabled is used to toggle activation of a tracer */
static
int
tracer_enabled
=
1
;
static
int
tracer_enabled
=
1
;
/* function tracing enabled */
int
ftrace_function_enabled
;
/*
/*
* trace_nr_entries is the number of entries that is allocated
* trace_nr_entries is the number of entries that is allocated
* for a buffer. Note, the number of entries is always rounded
* for a buffer. Note, the number of entries is always rounded
...
@@ -134,6 +137,7 @@ static notrace void no_trace_init(struct trace_array *tr)
...
@@ -134,6 +137,7 @@ static notrace void no_trace_init(struct trace_array *tr)
{
{
int
cpu
;
int
cpu
;
ftrace_function_enabled
=
0
;
if
(
tr
->
ctrl
)
if
(
tr
->
ctrl
)
for_each_online_cpu
(
cpu
)
for_each_online_cpu
(
cpu
)
tracing_reset
(
tr
->
data
[
cpu
]);
tracing_reset
(
tr
->
data
[
cpu
]);
...
@@ -1027,7 +1031,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
...
@@ -1027,7 +1031,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
long
disabled
;
long
disabled
;
int
cpu
;
int
cpu
;
if
(
unlikely
(
!
tracer
_enabled
))
if
(
unlikely
(
!
ftrace_function
_enabled
))
return
;
return
;
if
(
skip_trace
(
ip
))
if
(
skip_trace
(
ip
))
...
@@ -1052,11 +1056,15 @@ static struct ftrace_ops trace_ops __read_mostly =
...
@@ -1052,11 +1056,15 @@ static struct ftrace_ops trace_ops __read_mostly =
void
tracing_start_function_trace
(
void
)
void
tracing_start_function_trace
(
void
)
{
{
ftrace_function_enabled
=
0
;
register_ftrace_function
(
&
trace_ops
);
register_ftrace_function
(
&
trace_ops
);
if
(
tracer_enabled
)
ftrace_function_enabled
=
1
;
}
}
void
tracing_stop_function_trace
(
void
)
void
tracing_stop_function_trace
(
void
)
{
{
ftrace_function_enabled
=
0
;
unregister_ftrace_function
(
&
trace_ops
);
unregister_ftrace_function
(
&
trace_ops
);
}
}
#endif
#endif
...
@@ -1383,7 +1391,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
...
@@ -1383,7 +1391,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
"server"
,
"server"
,
#elif defined(CONFIG_PREEMPT_VOLUNTARY)
#elif defined(CONFIG_PREEMPT_VOLUNTARY)
"desktop"
,
"desktop"
,
#elif defined(CONFIG_PREEMPT
_DESKTOP
)
#elif defined(CONFIG_PREEMPT)
"preempt"
,
"preempt"
,
#else
#else
"unknown"
,
"unknown"
,
...
@@ -1892,8 +1900,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
...
@@ -1892,8 +1900,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
m
->
private
=
iter
;
m
->
private
=
iter
;
/* stop the trace while dumping */
/* stop the trace while dumping */
if
(
iter
->
tr
->
ctrl
)
if
(
iter
->
tr
->
ctrl
)
{
tracer_enabled
=
0
;
tracer_enabled
=
0
;
ftrace_function_enabled
=
0
;
}
if
(
iter
->
trace
&&
iter
->
trace
->
open
)
if
(
iter
->
trace
&&
iter
->
trace
->
open
)
iter
->
trace
->
open
(
iter
);
iter
->
trace
->
open
(
iter
);
...
@@ -1926,8 +1936,14 @@ int tracing_release(struct inode *inode, struct file *file)
...
@@ -1926,8 +1936,14 @@ int tracing_release(struct inode *inode, struct file *file)
iter
->
trace
->
close
(
iter
);
iter
->
trace
->
close
(
iter
);
/* reenable tracing if it was previously enabled */
/* reenable tracing if it was previously enabled */
if
(
iter
->
tr
->
ctrl
)
if
(
iter
->
tr
->
ctrl
)
{
tracer_enabled
=
1
;
tracer_enabled
=
1
;
/*
* It is safe to enable function tracing even if it
* isn't used
*/
ftrace_function_enabled
=
1
;
}
mutex_unlock
(
&
trace_types_lock
);
mutex_unlock
(
&
trace_types_lock
);
seq_release
(
inode
,
file
);
seq_release
(
inode
,
file
);
...
...
kernel/trace/trace.h
View file @
6712e299
...
@@ -223,8 +223,6 @@ void trace_function(struct trace_array *tr,
...
@@ -223,8 +223,6 @@ void trace_function(struct trace_array *tr,
unsigned
long
parent_ip
,
unsigned
long
parent_ip
,
unsigned
long
flags
);
unsigned
long
flags
);
void
tracing_start_function_trace
(
void
);
void
tracing_stop_function_trace
(
void
);
void
tracing_start_cmdline_record
(
void
);
void
tracing_start_cmdline_record
(
void
);
void
tracing_stop_cmdline_record
(
void
);
void
tracing_stop_cmdline_record
(
void
);
int
register_tracer
(
struct
tracer
*
type
);
int
register_tracer
(
struct
tracer
*
type
);
...
@@ -241,6 +239,14 @@ void update_max_tr_single(struct trace_array *tr,
...
@@ -241,6 +239,14 @@ void update_max_tr_single(struct trace_array *tr,
extern
cycle_t
ftrace_now
(
int
cpu
);
extern
cycle_t
ftrace_now
(
int
cpu
);
#ifdef CONFIG_FTRACE
void
tracing_start_function_trace
(
void
);
void
tracing_stop_function_trace
(
void
);
#else
# define tracing_start_function_trace() do { } while (0)
# define tracing_stop_function_trace() do { } while (0)
#endif
#ifdef CONFIG_CONTEXT_SWITCH_TRACER
#ifdef CONFIG_CONTEXT_SWITCH_TRACER
typedef
void
typedef
void
(
*
tracer_switch_func_t
)(
void
*
private
,
(
*
tracer_switch_func_t
)(
void
*
private
,
...
...
kernel/trace/trace_functions.c
View file @
6712e299
...
@@ -28,7 +28,10 @@ static void function_reset(struct trace_array *tr)
...
@@ -28,7 +28,10 @@ static void function_reset(struct trace_array *tr)
static
void
start_function_trace
(
struct
trace_array
*
tr
)
static
void
start_function_trace
(
struct
trace_array
*
tr
)
{
{
tr
->
cpu
=
get_cpu
();
function_reset
(
tr
);
function_reset
(
tr
);
put_cpu
();
tracing_start_cmdline_record
();
tracing_start_cmdline_record
();
tracing_start_function_trace
();
tracing_start_function_trace
();
}
}
...
...
kernel/trace/trace_sched_switch.c
View file @
6712e299
...
@@ -227,14 +227,14 @@ void tracing_stop_cmdline_record(void)
...
@@ -227,14 +227,14 @@ void tracing_stop_cmdline_record(void)
static
void
start_sched_trace
(
struct
trace_array
*
tr
)
static
void
start_sched_trace
(
struct
trace_array
*
tr
)
{
{
sched_switch_reset
(
tr
);
sched_switch_reset
(
tr
);
tracer_enabled
=
1
;
tracing_start_cmdline_record
();
tracing_start_cmdline_record
();
tracer_enabled
=
1
;
}
}
static
void
stop_sched_trace
(
struct
trace_array
*
tr
)
static
void
stop_sched_trace
(
struct
trace_array
*
tr
)
{
{
tracing_stop_cmdline_record
();
tracer_enabled
=
0
;
tracer_enabled
=
0
;
tracing_stop_cmdline_record
();
}
}
static
void
sched_switch_trace_init
(
struct
trace_array
*
tr
)
static
void
sched_switch_trace_init
(
struct
trace_array
*
tr
)
...
...
kernel/trace/trace_sched_wakeup.c
View file @
6712e299
...
@@ -352,9 +352,10 @@ static void start_wakeup_tracer(struct trace_array *tr)
...
@@ -352,9 +352,10 @@ static void start_wakeup_tracer(struct trace_array *tr)
*/
*/
smp_wmb
();
smp_wmb
();
tracer_enabled
=
1
;
register_ftrace_function
(
&
trace_ops
);
register_ftrace_function
(
&
trace_ops
);
tracer_enabled
=
1
;
return
;
return
;
fail_deprobe_wake_new:
fail_deprobe_wake_new:
marker_probe_unregister
(
"kernel_sched_wakeup_new"
,
marker_probe_unregister
(
"kernel_sched_wakeup_new"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment