* [for-next][PATCH 0/4] tracing: Some clean ups to the code
@ 2014-11-04 13:48 Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 1/4] tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace() Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-11-04 13:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next-next
Head SHA1: bff81446ec9f8331b6443bddb92177fe10e27cb5
Jiang Liu (1):
tracing: Add entry->next_cpu to trace_ctxwake_bin()
Oleg Nesterov (2):
tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace()
tracing: Kill the dead code in probe_sched_switch() and probe_sched_wakeup()
Steven Rostedt (Red Hat) (1):
tracing: Move tracing_sched_{switch,wakeup}() into wakeup tracer
----
kernel/trace/trace.h | 12 ----
kernel/trace/trace_output.c | 1 +
kernel/trace/trace_sched_switch.c | 144 --------------------------------------
kernel/trace/trace_sched_wakeup.c | 56 +++++++++++++++
4 files changed, 57 insertions(+), 156 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [for-next][PATCH 1/4] tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace()
2014-11-04 13:48 [for-next][PATCH 0/4] tracing: Some clean ups to the code Steven Rostedt
@ 2014-11-04 13:48 ` Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 2/4] tracing: Kill the dead code in probe_sched_switch() and probe_sched_wakeup() Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-11-04 13:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Oleg Nesterov
[-- Attachment #1: 0001-tracing-Kill-tracing_-start-stop-_sched_switch_recor.patch --]
[-- Type: text/plain, Size: 2554 bytes --]
From: Oleg Nesterov <oleg@redhat.com>
tracing_{start,stop}_sched_switch_record() have no callers since
87d80de2800d "tracing: Remove obsolete sched_switch tracer".
The last caller of tracing_sched_switch_assign_trace() was removed
by 30dbb20e68e6 "tracing: Remove boot tracer".
Link: http://lkml.kernel.org/p/20140723193501.GA30214@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 3 ---
kernel/trace/trace_sched_switch.c | 48 ---------------------------------------
2 files changed, 51 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 385391fb1d3b..a3a82d5f25dc 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -597,9 +597,6 @@ void set_graph_array(struct trace_array *tr);
void tracing_start_cmdline_record(void);
void tracing_stop_cmdline_record(void);
-void tracing_sched_switch_assign_trace(struct trace_array *tr);
-void tracing_stop_sched_switch_record(void);
-void tracing_start_sched_switch_record(void);
int register_tracer(struct tracer *type);
int is_tracing_stopped(void);
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 3f34dc9b40f3..3b60301c59d2 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -197,51 +197,3 @@ void tracing_stop_cmdline_record(void)
{
tracing_stop_sched_switch();
}
-
-/**
- * tracing_start_sched_switch_record - start tracing context switches
- *
- * Turns on context switch tracing for a tracer.
- */
-void tracing_start_sched_switch_record(void)
-{
- if (unlikely(!ctx_trace)) {
- WARN_ON(1);
- return;
- }
-
- tracing_start_sched_switch();
-
- mutex_lock(&sched_register_mutex);
- tracer_enabled++;
- mutex_unlock(&sched_register_mutex);
-}
-
-/**
- * tracing_stop_sched_switch_record - start tracing context switches
- *
- * Turns off context switch tracing for a tracer.
- */
-void tracing_stop_sched_switch_record(void)
-{
- mutex_lock(&sched_register_mutex);
- tracer_enabled--;
- WARN_ON(tracer_enabled < 0);
- mutex_unlock(&sched_register_mutex);
-
- tracing_stop_sched_switch();
-}
-
-/**
- * tracing_sched_switch_assign_trace - assign a trace array for ctx switch
- * @tr: trace array pointer to assign
- *
- * Some tracers might want to record the context switches in their
- * trace. This function lets those tracers assign the trace array
- * to use.
- */
-void tracing_sched_switch_assign_trace(struct trace_array *tr)
-{
- ctx_trace = tr;
-}
-
--
2.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-next][PATCH 2/4] tracing: Kill the dead code in probe_sched_switch() and probe_sched_wakeup()
2014-11-04 13:48 [for-next][PATCH 0/4] tracing: Some clean ups to the code Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 1/4] tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace() Steven Rostedt
@ 2014-11-04 13:48 ` Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 3/4] tracing: Move tracing_sched_{switch,wakeup}() into wakeup tracer Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 4/4] tracing: Add entry->next_cpu to trace_ctxwake_bin() Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-11-04 13:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Oleg Nesterov
[-- Attachment #1: 0002-tracing-Kill-the-dead-code-in-probe_sched_switch-and.patch --]
[-- Type: text/plain, Size: 2484 bytes --]
From: Oleg Nesterov <oleg@redhat.com>
After the previous patch it is clear that "tracer_enabled" can never be
true, we can remove the "if (tracer_enabled)" code in probe_sched_switch()
and probe_sched_wakeup(). Plus we can obviously remove tracer_enabled,
ctx_trace, and sched_stopped as well.
Link: http://lkml.kernel.org/p/20140723193503.GA30217@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_sched_switch.c | 40 ---------------------------------------
1 file changed, 40 deletions(-)
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 3b60301c59d2..f7c7f4f1544c 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -14,12 +14,8 @@
#include "trace.h"
-static struct trace_array *ctx_trace;
-static int __read_mostly tracer_enabled;
static int sched_ref;
static DEFINE_MUTEX(sched_register_mutex);
-static int sched_stopped;
-
void
tracing_sched_switch_trace(struct trace_array *tr,
@@ -52,29 +48,11 @@ tracing_sched_switch_trace(struct trace_array *tr,
static void
probe_sched_switch(void *ignore, struct task_struct *prev, struct task_struct *next)
{
- struct trace_array_cpu *data;
- unsigned long flags;
- int cpu;
- int pc;
-
if (unlikely(!sched_ref))
return;
tracing_record_cmdline(prev);
tracing_record_cmdline(next);
-
- if (!tracer_enabled || sched_stopped)
- return;
-
- pc = preempt_count();
- local_irq_save(flags);
- cpu = raw_smp_processor_id();
- data = per_cpu_ptr(ctx_trace->trace_buffer.data, cpu);
-
- if (likely(!atomic_read(&data->disabled)))
- tracing_sched_switch_trace(ctx_trace, prev, next, flags, pc);
-
- local_irq_restore(flags);
}
void
@@ -108,28 +86,10 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
static void
probe_sched_wakeup(void *ignore, struct task_struct *wakee, int success)
{
- struct trace_array_cpu *data;
- unsigned long flags;
- int cpu, pc;
-
if (unlikely(!sched_ref))
return;
tracing_record_cmdline(current);
-
- if (!tracer_enabled || sched_stopped)
- return;
-
- pc = preempt_count();
- local_irq_save(flags);
- cpu = raw_smp_processor_id();
- data = per_cpu_ptr(ctx_trace->trace_buffer.data, cpu);
-
- if (likely(!atomic_read(&data->disabled)))
- tracing_sched_wakeup_trace(ctx_trace, wakee, current,
- flags, pc);
-
- local_irq_restore(flags);
}
static int tracing_sched_register(void)
--
2.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-next][PATCH 3/4] tracing: Move tracing_sched_{switch,wakeup}() into wakeup tracer
2014-11-04 13:48 [for-next][PATCH 0/4] tracing: Some clean ups to the code Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 1/4] tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace() Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 2/4] tracing: Kill the dead code in probe_sched_switch() and probe_sched_wakeup() Steven Rostedt
@ 2014-11-04 13:48 ` Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 4/4] tracing: Add entry->next_cpu to trace_ctxwake_bin() Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-11-04 13:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
[-- Attachment #1: 0003-tracing-Move-tracing_sched_-switch-wakeup-into-wakeu.patch --]
[-- Type: text/plain, Size: 6081 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
The only code that references tracing_sched_switch_trace() and
tracing_sched_wakeup_trace() is the wakeup latency tracer. Those
two functions use to belong to the sched_switch tracer which has
long been removed. These functions were left behind because the
wakeup latency tracer used them. But since the wakeup latency tracer
is the only one to use them, they should be static functions inside
that code.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 9 -------
kernel/trace/trace_sched_switch.c | 56 ---------------------------------------
kernel/trace/trace_sched_wakeup.c | 56 +++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 65 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index a3a82d5f25dc..3376de623ea0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -569,15 +569,6 @@ void trace_init_global_iter(struct trace_iterator *iter);
void tracing_iter_reset(struct trace_iterator *iter, int cpu);
-void tracing_sched_switch_trace(struct trace_array *tr,
- struct task_struct *prev,
- struct task_struct *next,
- unsigned long flags, int pc);
-
-void tracing_sched_wakeup_trace(struct trace_array *tr,
- struct task_struct *wakee,
- struct task_struct *cur,
- unsigned long flags, int pc);
void trace_function(struct trace_array *tr,
unsigned long ip,
unsigned long parent_ip,
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index f7c7f4f1544c..2e293beb186e 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -17,34 +17,6 @@
static int sched_ref;
static DEFINE_MUTEX(sched_register_mutex);
-void
-tracing_sched_switch_trace(struct trace_array *tr,
- struct task_struct *prev,
- struct task_struct *next,
- unsigned long flags, int pc)
-{
- struct ftrace_event_call *call = &event_context_switch;
- struct ring_buffer *buffer = tr->trace_buffer.buffer;
- struct ring_buffer_event *event;
- struct ctx_switch_entry *entry;
-
- event = trace_buffer_lock_reserve(buffer, TRACE_CTX,
- sizeof(*entry), flags, pc);
- if (!event)
- return;
- entry = ring_buffer_event_data(event);
- entry->prev_pid = prev->pid;
- entry->prev_prio = prev->prio;
- entry->prev_state = prev->state;
- entry->next_pid = next->pid;
- entry->next_prio = next->prio;
- entry->next_state = next->state;
- entry->next_cpu = task_cpu(next);
-
- if (!call_filter_check_discard(call, entry, buffer, event))
- trace_buffer_unlock_commit(buffer, event, flags, pc);
-}
-
static void
probe_sched_switch(void *ignore, struct task_struct *prev, struct task_struct *next)
{
@@ -55,34 +27,6 @@ probe_sched_switch(void *ignore, struct task_struct *prev, struct task_struct *n
tracing_record_cmdline(next);
}
-void
-tracing_sched_wakeup_trace(struct trace_array *tr,
- struct task_struct *wakee,
- struct task_struct *curr,
- unsigned long flags, int pc)
-{
- struct ftrace_event_call *call = &event_wakeup;
- struct ring_buffer_event *event;
- struct ctx_switch_entry *entry;
- struct ring_buffer *buffer = tr->trace_buffer.buffer;
-
- event = trace_buffer_lock_reserve(buffer, TRACE_WAKE,
- sizeof(*entry), flags, pc);
- if (!event)
- return;
- entry = ring_buffer_event_data(event);
- entry->prev_pid = curr->pid;
- entry->prev_prio = curr->prio;
- entry->prev_state = curr->state;
- entry->next_pid = wakee->pid;
- entry->next_prio = wakee->prio;
- entry->next_state = wakee->state;
- entry->next_cpu = task_cpu(wakee);
-
- if (!call_filter_check_discard(call, entry, buffer, event))
- trace_buffer_unlock_commit(buffer, event, flags, pc);
-}
-
static void
probe_sched_wakeup(void *ignore, struct task_struct *wakee, int success)
{
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 19bd8928ce94..8fb84b362816 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -365,6 +365,62 @@ probe_wakeup_migrate_task(void *ignore, struct task_struct *task, int cpu)
wakeup_current_cpu = cpu;
}
+static void
+tracing_sched_switch_trace(struct trace_array *tr,
+ struct task_struct *prev,
+ struct task_struct *next,
+ unsigned long flags, int pc)
+{
+ struct ftrace_event_call *call = &event_context_switch;
+ struct ring_buffer *buffer = tr->trace_buffer.buffer;
+ struct ring_buffer_event *event;
+ struct ctx_switch_entry *entry;
+
+ event = trace_buffer_lock_reserve(buffer, TRACE_CTX,
+ sizeof(*entry), flags, pc);
+ if (!event)
+ return;
+ entry = ring_buffer_event_data(event);
+ entry->prev_pid = prev->pid;
+ entry->prev_prio = prev->prio;
+ entry->prev_state = prev->state;
+ entry->next_pid = next->pid;
+ entry->next_prio = next->prio;
+ entry->next_state = next->state;
+ entry->next_cpu = task_cpu(next);
+
+ if (!call_filter_check_discard(call, entry, buffer, event))
+ trace_buffer_unlock_commit(buffer, event, flags, pc);
+}
+
+static void
+tracing_sched_wakeup_trace(struct trace_array *tr,
+ struct task_struct *wakee,
+ struct task_struct *curr,
+ unsigned long flags, int pc)
+{
+ struct ftrace_event_call *call = &event_wakeup;
+ struct ring_buffer_event *event;
+ struct ctx_switch_entry *entry;
+ struct ring_buffer *buffer = tr->trace_buffer.buffer;
+
+ event = trace_buffer_lock_reserve(buffer, TRACE_WAKE,
+ sizeof(*entry), flags, pc);
+ if (!event)
+ return;
+ entry = ring_buffer_event_data(event);
+ entry->prev_pid = curr->pid;
+ entry->prev_prio = curr->prio;
+ entry->prev_state = curr->state;
+ entry->next_pid = wakee->pid;
+ entry->next_prio = wakee->prio;
+ entry->next_state = wakee->state;
+ entry->next_cpu = task_cpu(wakee);
+
+ if (!call_filter_check_discard(call, entry, buffer, event))
+ trace_buffer_unlock_commit(buffer, event, flags, pc);
+}
+
static void notrace
probe_wakeup_sched_switch(void *ignore,
struct task_struct *prev, struct task_struct *next)
--
2.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [for-next][PATCH 4/4] tracing: Add entry->next_cpu to trace_ctxwake_bin()
2014-11-04 13:48 [for-next][PATCH 0/4] tracing: Some clean ups to the code Steven Rostedt
` (2 preceding siblings ...)
2014-11-04 13:48 ` [for-next][PATCH 3/4] tracing: Move tracing_sched_{switch,wakeup}() into wakeup tracer Steven Rostedt
@ 2014-11-04 13:48 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-11-04 13:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Jiang Liu
[-- Attachment #1: 0004-tracing-Add-entry-next_cpu-to-trace_ctxwake_bin.patch --]
[-- Type: text/plain, Size: 987 bytes --]
From: Jiang Liu <jiang.liu@huawei.com>
Function trace_ctxwake_bin() misses ctx_switch_entry->next_cpu field,
so user will get stale value for "next_cpu".
Link: http://lkml.kernel.org/p/1377176379-27908-1-git-send-email-liuj97@gmail.com
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_output.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index c6977d5a9b12..cfa91de22e27 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -976,6 +976,7 @@ static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter,
SEQ_PUT_FIELD_RET(s, field->prev_pid);
SEQ_PUT_FIELD_RET(s, field->prev_prio);
SEQ_PUT_FIELD_RET(s, field->prev_state);
+ SEQ_PUT_FIELD_RET(s, field->next_cpu);
SEQ_PUT_FIELD_RET(s, field->next_pid);
SEQ_PUT_FIELD_RET(s, field->next_prio);
SEQ_PUT_FIELD_RET(s, field->next_state);
--
2.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-04 13:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 13:48 [for-next][PATCH 0/4] tracing: Some clean ups to the code Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 1/4] tracing: Kill tracing_{start,stop}_sched_switch_record() and tracing_sched_switch_assign_trace() Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 2/4] tracing: Kill the dead code in probe_sched_switch() and probe_sched_wakeup() Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 3/4] tracing: Move tracing_sched_{switch,wakeup}() into wakeup tracer Steven Rostedt
2014-11-04 13:48 ` [for-next][PATCH 4/4] tracing: Add entry->next_cpu to trace_ctxwake_bin() Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox