Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
9b036389
Commit
9b036389
authored
Jan 23, 2009
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tracing/ftrace' into tracing/core
parents
03b30d15
69507c06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
37 deletions
+61
-37
kernel/trace/ring_buffer.c
kernel/trace/ring_buffer.c
+18
-0
kernel/trace/trace.c
kernel/trace/trace.c
+1
-1
kernel/trace/trace_sched_wakeup.c
kernel/trace/trace_sched_wakeup.c
+42
-36
No files found.
kernel/trace/ring_buffer.c
View file @
9b036389
...
@@ -2166,6 +2166,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
...
@@ -2166,6 +2166,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer
->
overrun
=
0
;
cpu_buffer
->
overrun
=
0
;
cpu_buffer
->
entries
=
0
;
cpu_buffer
->
entries
=
0
;
cpu_buffer
->
write_stamp
=
0
;
cpu_buffer
->
read_stamp
=
0
;
}
}
/**
/**
...
@@ -2266,9 +2269,24 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
...
@@ -2266,9 +2269,24 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
if
(
buffer_a
->
pages
!=
buffer_b
->
pages
)
if
(
buffer_a
->
pages
!=
buffer_b
->
pages
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
ring_buffer_flags
!=
RB_BUFFERS_ON
)
return
-
EAGAIN
;
if
(
atomic_read
(
&
buffer_a
->
record_disabled
))
return
-
EAGAIN
;
if
(
atomic_read
(
&
buffer_b
->
record_disabled
))
return
-
EAGAIN
;
cpu_buffer_a
=
buffer_a
->
buffers
[
cpu
];
cpu_buffer_a
=
buffer_a
->
buffers
[
cpu
];
cpu_buffer_b
=
buffer_b
->
buffers
[
cpu
];
cpu_buffer_b
=
buffer_b
->
buffers
[
cpu
];
if
(
atomic_read
(
&
cpu_buffer_a
->
record_disabled
))
return
-
EAGAIN
;
if
(
atomic_read
(
&
cpu_buffer_b
->
record_disabled
))
return
-
EAGAIN
;
/*
/*
* We can't do a synchronize_sched here because this
* We can't do a synchronize_sched here because this
* function can be called in atomic context.
* function can be called in atomic context.
...
...
kernel/trace/trace.c
View file @
9b036389
...
@@ -415,7 +415,7 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
...
@@ -415,7 +415,7 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
ftrace_enable_cpu
();
ftrace_enable_cpu
();
WARN_ON_ONCE
(
ret
);
WARN_ON_ONCE
(
ret
&&
ret
!=
-
EAGAIN
);
__update_max_tr
(
tr
,
tsk
,
cpu
);
__update_max_tr
(
tr
,
tsk
,
cpu
);
__raw_spin_unlock
(
&
ftrace_max_lock
);
__raw_spin_unlock
(
&
ftrace_max_lock
);
...
...
kernel/trace/trace_sched_wakeup.c
View file @
9b036389
...
@@ -25,6 +25,7 @@ static int __read_mostly tracer_enabled;
...
@@ -25,6 +25,7 @@ static int __read_mostly tracer_enabled;
static
struct
task_struct
*
wakeup_task
;
static
struct
task_struct
*
wakeup_task
;
static
int
wakeup_cpu
;
static
int
wakeup_cpu
;
static
unsigned
wakeup_prio
=
-
1
;
static
unsigned
wakeup_prio
=
-
1
;
static
int
wakeup_rt
;
static
raw_spinlock_t
wakeup_lock
=
static
raw_spinlock_t
wakeup_lock
=
(
raw_spinlock_t
)
__RAW_SPIN_LOCK_UNLOCKED
;
(
raw_spinlock_t
)
__RAW_SPIN_LOCK_UNLOCKED
;
...
@@ -152,6 +153,7 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
...
@@ -152,6 +153,7 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
goto
out_unlock
;
goto
out_unlock
;
trace_function
(
wakeup_trace
,
data
,
CALLER_ADDR1
,
CALLER_ADDR2
,
flags
,
pc
);
trace_function
(
wakeup_trace
,
data
,
CALLER_ADDR1
,
CALLER_ADDR2
,
flags
,
pc
);
tracing_sched_switch_trace
(
wakeup_trace
,
data
,
prev
,
next
,
flags
,
pc
);
/*
/*
* usecs conversion is slow so we try to delay the conversion
* usecs conversion is slow so we try to delay the conversion
...
@@ -213,6 +215,7 @@ static void wakeup_reset(struct trace_array *tr)
...
@@ -213,6 +215,7 @@ static void wakeup_reset(struct trace_array *tr)
static
void
static
void
probe_wakeup
(
struct
rq
*
rq
,
struct
task_struct
*
p
,
int
success
)
probe_wakeup
(
struct
rq
*
rq
,
struct
task_struct
*
p
,
int
success
)
{
{
struct
trace_array_cpu
*
data
;
int
cpu
=
smp_processor_id
();
int
cpu
=
smp_processor_id
();
unsigned
long
flags
;
unsigned
long
flags
;
long
disabled
;
long
disabled
;
...
@@ -224,7 +227,7 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
...
@@ -224,7 +227,7 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
tracing_record_cmdline
(
p
);
tracing_record_cmdline
(
p
);
tracing_record_cmdline
(
current
);
tracing_record_cmdline
(
current
);
if
(
likely
(
!
rt_task
(
p
))
||
if
(
(
wakeup_rt
&&
!
rt_task
(
p
))
||
p
->
prio
>=
wakeup_prio
||
p
->
prio
>=
wakeup_prio
||
p
->
prio
>=
current
->
prio
)
p
->
prio
>=
current
->
prio
)
return
;
return
;
...
@@ -252,9 +255,12 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
...
@@ -252,9 +255,12 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
local_save_flags
(
flags
);
local_save_flags
(
flags
);
wakeup_trace
->
data
[
wakeup_cpu
]
->
preempt_timestamp
=
ftrace_now
(
cpu
);
data
=
wakeup_trace
->
data
[
wakeup_cpu
];
trace_function
(
wakeup_trace
,
wakeup_trace
->
data
[
wakeup_cpu
],
data
->
preempt_timestamp
=
ftrace_now
(
cpu
);
CALLER_ADDR1
,
CALLER_ADDR2
,
flags
,
pc
);
tracing_sched_wakeup_trace
(
wakeup_trace
,
data
,
p
,
current
,
flags
,
pc
);
trace_function
(
wakeup_trace
,
data
,
CALLER_ADDR1
,
CALLER_ADDR2
,
flags
,
pc
);
out_locked:
out_locked:
__raw_spin_unlock
(
&
wakeup_lock
);
__raw_spin_unlock
(
&
wakeup_lock
);
...
@@ -262,12 +268,6 @@ out:
...
@@ -262,12 +268,6 @@ out:
atomic_dec
(
&
wakeup_trace
->
data
[
cpu
]
->
disabled
);
atomic_dec
(
&
wakeup_trace
->
data
[
cpu
]
->
disabled
);
}
}
/*
* save_tracer_enabled is used to save the state of the tracer_enabled
* variable when we disable it when we open a trace output file.
*/
static
int
save_tracer_enabled
;
static
void
start_wakeup_tracer
(
struct
trace_array
*
tr
)
static
void
start_wakeup_tracer
(
struct
trace_array
*
tr
)
{
{
int
ret
;
int
ret
;
...
@@ -306,13 +306,10 @@ static void start_wakeup_tracer(struct trace_array *tr)
...
@@ -306,13 +306,10 @@ static void start_wakeup_tracer(struct trace_array *tr)
register_ftrace_function
(
&
trace_ops
);
register_ftrace_function
(
&
trace_ops
);
if
(
tracing_is_enabled
())
{
if
(
tracing_is_enabled
())
tracer_enabled
=
1
;
tracer_enabled
=
1
;
save_tracer_enabled
=
1
;
else
}
else
{
tracer_enabled
=
0
;
tracer_enabled
=
0
;
save_tracer_enabled
=
0
;
}
return
;
return
;
fail_deprobe_wake_new:
fail_deprobe_wake_new:
...
@@ -324,14 +321,13 @@ fail_deprobe:
...
@@ -324,14 +321,13 @@ fail_deprobe:
static
void
stop_wakeup_tracer
(
struct
trace_array
*
tr
)
static
void
stop_wakeup_tracer
(
struct
trace_array
*
tr
)
{
{
tracer_enabled
=
0
;
tracer_enabled
=
0
;
save_tracer_enabled
=
0
;
unregister_ftrace_function
(
&
trace_ops
);
unregister_ftrace_function
(
&
trace_ops
);
unregister_trace_sched_switch
(
probe_wakeup_sched_switch
);
unregister_trace_sched_switch
(
probe_wakeup_sched_switch
);
unregister_trace_sched_wakeup_new
(
probe_wakeup
);
unregister_trace_sched_wakeup_new
(
probe_wakeup
);
unregister_trace_sched_wakeup
(
probe_wakeup
);
unregister_trace_sched_wakeup
(
probe_wakeup
);
}
}
static
int
wakeup_tracer_init
(
struct
trace_array
*
tr
)
static
int
__
wakeup_tracer_init
(
struct
trace_array
*
tr
)
{
{
tracing_max_latency
=
0
;
tracing_max_latency
=
0
;
wakeup_trace
=
tr
;
wakeup_trace
=
tr
;
...
@@ -339,6 +335,18 @@ static int wakeup_tracer_init(struct trace_array *tr)
...
@@ -339,6 +335,18 @@ static int wakeup_tracer_init(struct trace_array *tr)
return
0
;
return
0
;
}
}
static
int
wakeup_tracer_init
(
struct
trace_array
*
tr
)
{
wakeup_rt
=
0
;
return
__wakeup_tracer_init
(
tr
);
}
static
int
wakeup_rt_tracer_init
(
struct
trace_array
*
tr
)
{
wakeup_rt
=
1
;
return
__wakeup_tracer_init
(
tr
);
}
static
void
wakeup_tracer_reset
(
struct
trace_array
*
tr
)
static
void
wakeup_tracer_reset
(
struct
trace_array
*
tr
)
{
{
stop_wakeup_tracer
(
tr
);
stop_wakeup_tracer
(
tr
);
...
@@ -350,28 +358,11 @@ static void wakeup_tracer_start(struct trace_array *tr)
...
@@ -350,28 +358,11 @@ static void wakeup_tracer_start(struct trace_array *tr)
{
{
wakeup_reset
(
tr
);
wakeup_reset
(
tr
);
tracer_enabled
=
1
;
tracer_enabled
=
1
;
save_tracer_enabled
=
1
;
}
}
static
void
wakeup_tracer_stop
(
struct
trace_array
*
tr
)
static
void
wakeup_tracer_stop
(
struct
trace_array
*
tr
)
{
{
tracer_enabled
=
0
;
tracer_enabled
=
0
;
save_tracer_enabled
=
0
;
}
static
void
wakeup_tracer_open
(
struct
trace_iterator
*
iter
)
{
/* stop the trace while dumping */
tracer_enabled
=
0
;
}
static
void
wakeup_tracer_close
(
struct
trace_iterator
*
iter
)
{
/* forget about any processes we were recording */
if
(
save_tracer_enabled
)
{
wakeup_reset
(
iter
->
tr
);
tracer_enabled
=
1
;
}
}
}
static
struct
tracer
wakeup_tracer
__read_mostly
=
static
struct
tracer
wakeup_tracer
__read_mostly
=
...
@@ -381,8 +372,19 @@ static struct tracer wakeup_tracer __read_mostly =
...
@@ -381,8 +372,19 @@ static struct tracer wakeup_tracer __read_mostly =
.
reset
=
wakeup_tracer_reset
,
.
reset
=
wakeup_tracer_reset
,
.
start
=
wakeup_tracer_start
,
.
start
=
wakeup_tracer_start
,
.
stop
=
wakeup_tracer_stop
,
.
stop
=
wakeup_tracer_stop
,
.
open
=
wakeup_tracer_open
,
.
print_max
=
1
,
.
close
=
wakeup_tracer_close
,
#ifdef CONFIG_FTRACE_SELFTEST
.
selftest
=
trace_selftest_startup_wakeup
,
#endif
};
static
struct
tracer
wakeup_rt_tracer
__read_mostly
=
{
.
name
=
"wakeup_rt"
,
.
init
=
wakeup_rt_tracer_init
,
.
reset
=
wakeup_tracer_reset
,
.
start
=
wakeup_tracer_start
,
.
stop
=
wakeup_tracer_stop
,
.
print_max
=
1
,
.
print_max
=
1
,
#ifdef CONFIG_FTRACE_SELFTEST
#ifdef CONFIG_FTRACE_SELFTEST
.
selftest
=
trace_selftest_startup_wakeup
,
.
selftest
=
trace_selftest_startup_wakeup
,
...
@@ -397,6 +399,10 @@ __init static int init_wakeup_tracer(void)
...
@@ -397,6 +399,10 @@ __init static int init_wakeup_tracer(void)
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
ret
=
register_tracer
(
&
wakeup_rt_tracer
);
if
(
ret
)
return
ret
;
return
0
;
return
0
;
}
}
device_initcall
(
init_wakeup_tracer
);
device_initcall
(
init_wakeup_tracer
);
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