* [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups
@ 2009-09-10 4:12 Steven Rostedt
2009-09-10 4:12 ` [PATCH 1/6] ring-buffer: consolidate interface of rb_buffer_peek() Steven Rostedt
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker
Ingo,
Please pull the latest tip/tracing/core tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core
Li Zefan (4):
tracing: remove dead code
tracing: format clean ups
tracing: remove stats from struct tracer
tracing: move PRED macros to trace_events_filter.c
Robert Richter (1):
ring-buffer: consolidate interface of rb_buffer_peek()
Steven Rostedt (1):
tracing: do not grab lock in wakeup latency function tracing
----
kernel/trace/ring_buffer.c | 11 ++---
kernel/trace/trace.h | 86 +++++-------------------------------
kernel/trace/trace_events_filter.c | 41 +++++++++++++++++
kernel/trace/trace_sched_wakeup.c | 36 +++++++++------
4 files changed, 78 insertions(+), 96 deletions(-)
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] ring-buffer: consolidate interface of rb_buffer_peek()
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
2009-09-10 4:12 ` [PATCH 2/6] tracing: do not grab lock in wakeup latency function tracing Steven Rostedt
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Robert Richter
[-- Attachment #1: 0001-ring-buffer-consolidate-interface-of-rb_buffer_peek.patch --]
[-- Type: text/plain, Size: 2218 bytes --]
From: Robert Richter <robert.richter@amd.com>
rb_buffer_peek() operates with struct ring_buffer_per_cpu *cpu_buffer
only. Thus, instead of passing variables buffer and cpu it is better
to use cpu_buffer directly. This also reduces the risk of races since
cpu_buffer is not calculated twice.
Signed-off-by: Robert Richter <robert.richter@amd.com>
LKML-Reference: <1249045084-3028-1-git-send-email-robert.richter@amd.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ring_buffer.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 454e74e..8786c35 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2997,15 +2997,12 @@ static void rb_advance_iter(struct ring_buffer_iter *iter)
}
static struct ring_buffer_event *
-rb_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
+rb_buffer_peek(struct ring_buffer_per_cpu *cpu_buffer, u64 *ts)
{
- struct ring_buffer_per_cpu *cpu_buffer;
struct ring_buffer_event *event;
struct buffer_page *reader;
int nr_loops = 0;
- cpu_buffer = buffer->buffers[cpu];
-
again:
/*
* We repeat when a timestamp is encountered. It is possible
@@ -3049,7 +3046,7 @@ rb_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
case RINGBUF_TYPE_DATA:
if (ts) {
*ts = cpu_buffer->read_stamp + event->time_delta;
- ring_buffer_normalize_time_stamp(buffer,
+ ring_buffer_normalize_time_stamp(cpu_buffer->buffer,
cpu_buffer->cpu, ts);
}
return event;
@@ -3168,7 +3165,7 @@ ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts)
local_irq_save(flags);
if (dolock)
spin_lock(&cpu_buffer->reader_lock);
- event = rb_buffer_peek(buffer, cpu, ts);
+ event = rb_buffer_peek(cpu_buffer, ts);
if (event && event->type_len == RINGBUF_TYPE_PADDING)
rb_advance_reader(cpu_buffer);
if (dolock)
@@ -3237,7 +3234,7 @@ ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts)
if (dolock)
spin_lock(&cpu_buffer->reader_lock);
- event = rb_buffer_peek(buffer, cpu, ts);
+ event = rb_buffer_peek(cpu_buffer, ts);
if (event)
rb_advance_reader(cpu_buffer);
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] tracing: do not grab lock in wakeup latency function tracing
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
2009-09-10 4:12 ` [PATCH 1/6] ring-buffer: consolidate interface of rb_buffer_peek() Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
2009-09-10 4:12 ` [PATCH 3/6] tracing: remove dead code Steven Rostedt
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker
[-- Attachment #1: 0002-tracing-do-not-grab-lock-in-wakeup-latency-function-.patch --]
[-- Type: text/plain, Size: 4252 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The wakeup tracer, when enabled, has its own function tracer.
It only traces the functions on the CPU where the task it is following
is on. If a task is woken on one CPU but then migrates to another CPU
before it wakes up, the latency tracer will then start tracing functions
on the other CPU.
To find which CPU the task is on, the wakeup function tracer performs
a task_cpu(wakeup_task). But to make sure the task does not disappear
it grabs the wakeup_lock, which is also taken when the task wakes up.
By taking this lock, the function tracer does not need to worry about
the task being freed as it checks its cpu.
Jan Blunck found a problem with this approach on his 32 CPU box. When
a task is being traced by the wakeup tracer, all functions take this
lock. That means that on all 32 CPUs, each function call is taking
this one lock to see if the task is on that CPU. This lock has just
serialized all functions on all 32 CPUs. Needless to say, this caused
major issues on that box. It would even lockup.
This patch changes the wakeup latency to insert a probe on the migrate task
tracepoint. When a task changes its CPU that it will run on, the
probe will take note. Now the wakeup function tracer no longer needs
to take the lock. It only compares the current CPU with a variable that
holds the current CPU the task is on. We don't worry about races since
it is OK to add or miss a function trace.
Reported-by: Jan Blunck <jblunck@suse.de>
Tested-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_sched_wakeup.c | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index ad69f10..cf43bdb 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -24,6 +24,7 @@ static int __read_mostly tracer_enabled;
static struct task_struct *wakeup_task;
static int wakeup_cpu;
+static int wakeup_current_cpu;
static unsigned wakeup_prio = -1;
static int wakeup_rt;
@@ -56,33 +57,23 @@ wakeup_tracer_call(unsigned long ip, unsigned long parent_ip)
resched = ftrace_preempt_disable();
cpu = raw_smp_processor_id();
+ if (cpu != wakeup_current_cpu)
+ goto out_enable;
+
data = tr->data[cpu];
disabled = atomic_inc_return(&data->disabled);
if (unlikely(disabled != 1))
goto out;
local_irq_save(flags);
- __raw_spin_lock(&wakeup_lock);
-
- if (unlikely(!wakeup_task))
- goto unlock;
-
- /*
- * The task can't disappear because it needs to
- * wake up first, and we have the wakeup_lock.
- */
- if (task_cpu(wakeup_task) != cpu)
- goto unlock;
trace_function(tr, ip, parent_ip, flags, pc);
- unlock:
- __raw_spin_unlock(&wakeup_lock);
local_irq_restore(flags);
out:
atomic_dec(&data->disabled);
-
+ out_enable:
ftrace_preempt_enable(resched);
}
@@ -107,6 +98,14 @@ static int report_latency(cycle_t delta)
return 1;
}
+static void probe_wakeup_migrate_task(struct task_struct *task, int cpu)
+{
+ if (task != wakeup_task)
+ return;
+
+ wakeup_current_cpu = cpu;
+}
+
static void notrace
probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)
@@ -244,6 +243,7 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
__wakeup_reset(wakeup_trace);
wakeup_cpu = task_cpu(p);
+ wakeup_current_cpu = wakeup_cpu;
wakeup_prio = p->prio;
wakeup_task = p;
@@ -293,6 +293,13 @@ static void start_wakeup_tracer(struct trace_array *tr)
goto fail_deprobe_wake_new;
}
+ ret = register_trace_sched_migrate_task(probe_wakeup_migrate_task);
+ if (ret) {
+ pr_info("wakeup trace: Couldn't activate tracepoint"
+ " probe to kernel_sched_migrate_task\n");
+ return;
+ }
+
wakeup_reset(tr);
/*
@@ -325,6 +332,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)
unregister_trace_sched_switch(probe_wakeup_sched_switch);
unregister_trace_sched_wakeup_new(probe_wakeup);
unregister_trace_sched_wakeup(probe_wakeup);
+ unregister_trace_sched_migrate_task(probe_wakeup_migrate_task);
}
static int __wakeup_tracer_init(struct trace_array *tr)
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] tracing: remove dead code
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
2009-09-10 4:12 ` [PATCH 1/6] ring-buffer: consolidate interface of rb_buffer_peek() Steven Rostedt
2009-09-10 4:12 ` [PATCH 2/6] tracing: do not grab lock in wakeup latency function tracing Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
2009-09-10 4:12 ` [PATCH 4/6] tracing: format clean ups Steven Rostedt
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0003-tracing-remove-dead-code.patch --]
[-- Type: text/plain, Size: 1355 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
Removes unreachable code.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AA8579B.4020706@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 22 ----------------------
1 files changed, 0 insertions(+), 22 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index fa1dccb..536ae1d 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -120,14 +120,6 @@ struct print_entry {
char buf[];
};
-#define TRACE_OLD_SIZE 88
-
-struct trace_field_cont {
- unsigned char type;
- /* Temporary till we get rid of this completely */
- char buf[TRACE_OLD_SIZE - 1];
-};
-
struct trace_mmiotrace_rw {
struct trace_entry ent;
struct mmiotrace_rw rw;
@@ -509,20 +501,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,
extern cycle_t ftrace_now(int cpu);
-#ifdef CONFIG_CONTEXT_SWITCH_TRACER
-typedef void
-(*tracer_switch_func_t)(void *private,
- void *__rq,
- struct task_struct *prev,
- struct task_struct *next);
-
-struct tracer_switch_ops {
- tracer_switch_func_t func;
- void *private;
- struct tracer_switch_ops *next;
-};
-#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
-
extern void trace_find_cmdline(int pid, char comm[]);
#ifdef CONFIG_DYNAMIC_FTRACE
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] tracing: format clean ups
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
` (2 preceding siblings ...)
2009-09-10 4:12 ` [PATCH 3/6] tracing: remove dead code Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
2009-09-10 4:12 ` [PATCH 5/6] tracing: remove stats from struct tracer Steven Rostedt
2009-09-10 4:12 ` [PATCH 6/6] tracing: move PRED macros to trace_events_filter.c Steven Rostedt
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0004-tracing-format-clean-ups.patch --]
[-- Type: text/plain, Size: 1541 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
Fix white-space formatting.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AA8579B.4020706@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 536ae1d..86a0523 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -169,20 +169,20 @@ enum kmemtrace_type_id {
struct kmemtrace_alloc_entry {
struct trace_entry ent;
- enum kmemtrace_type_id type_id;
- unsigned long call_site;
- const void *ptr;
- size_t bytes_req;
- size_t bytes_alloc;
- gfp_t gfp_flags;
- int node;
+ enum kmemtrace_type_id type_id;
+ unsigned long call_site;
+ const void *ptr;
+ size_t bytes_req;
+ size_t bytes_alloc;
+ gfp_t gfp_flags;
+ int node;
};
struct kmemtrace_free_entry {
struct trace_entry ent;
- enum kmemtrace_type_id type_id;
- unsigned long call_site;
- const void *ptr;
+ enum kmemtrace_type_id type_id;
+ unsigned long call_site;
+ const void *ptr;
};
struct syscall_trace_enter {
@@ -203,7 +203,7 @@ struct syscall_trace_exit {
* states when a trace occurs. These are:
* IRQS_OFF - interrupts were disabled
* IRQS_NOSUPPORT - arch does not support irqs_disabled_flags
- * NEED_RESCED - reschedule is requested
+ * NEED_RESCHED - reschedule is requested
* HARDIRQ - inside an interrupt handler
* SOFTIRQ - inside a softirq handler
*/
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] tracing: remove stats from struct tracer
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
` (3 preceding siblings ...)
2009-09-10 4:12 ` [PATCH 4/6] tracing: format clean ups Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
2009-09-10 4:12 ` [PATCH 6/6] tracing: move PRED macros to trace_events_filter.c Steven Rostedt
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0005-tracing-remove-stats-from-struct-tracer.patch --]
[-- Type: text/plain, Size: 624 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
Remove unused field @stats from struct tracer.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AA8579B.4020706@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 86a0523..2163d18 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -382,7 +382,6 @@ struct tracer {
struct tracer *next;
int print_max;
struct tracer_flags *flags;
- struct tracer_stat *stats;
};
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] tracing: move PRED macros to trace_events_filter.c
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
` (4 preceding siblings ...)
2009-09-10 4:12 ` [PATCH 5/6] tracing: remove stats from struct tracer Steven Rostedt
@ 2009-09-10 4:12 ` Steven Rostedt
5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-10 4:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan
[-- Attachment #1: 0006-tracing-move-PRED-macros-to-trace_events_filter.c.patch --]
[-- Type: text/plain, Size: 3336 bytes --]
From: Li Zefan <lizf@cn.fujitsu.com>
Move DEFINE_COMPARISON_PRED() and DEFINE_EQUALITY_PRED()
to kernel/trace/trace_events_filter.c
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AA8579B.4020706@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.h | 41 ------------------------------------
kernel/trace/trace_events_filter.c | 41 ++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 2163d18..acaa680 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -800,47 +800,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,
return 0;
}
-#define DEFINE_COMPARISON_PRED(type) \
-static int filter_pred_##type(struct filter_pred *pred, void *event, \
- int val1, int val2) \
-{ \
- type *addr = (type *)(event + pred->offset); \
- type val = (type)pred->val; \
- int match = 0; \
- \
- switch (pred->op) { \
- case OP_LT: \
- match = (*addr < val); \
- break; \
- case OP_LE: \
- match = (*addr <= val); \
- break; \
- case OP_GT: \
- match = (*addr > val); \
- break; \
- case OP_GE: \
- match = (*addr >= val); \
- break; \
- default: \
- break; \
- } \
- \
- return match; \
-}
-
-#define DEFINE_EQUALITY_PRED(size) \
-static int filter_pred_##size(struct filter_pred *pred, void *event, \
- int val1, int val2) \
-{ \
- u##size *addr = (u##size *)(event + pred->offset); \
- u##size val = (u##size)pred->val; \
- int match; \
- \
- match = (val == *addr) ^ pred->not; \
- \
- return match; \
-}
-
extern struct mutex event_mutex;
extern struct list_head ftrace_events;
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 93660fb..2324578 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -121,6 +121,47 @@ struct filter_parse_state {
} operand;
};
+#define DEFINE_COMPARISON_PRED(type) \
+static int filter_pred_##type(struct filter_pred *pred, void *event, \
+ int val1, int val2) \
+{ \
+ type *addr = (type *)(event + pred->offset); \
+ type val = (type)pred->val; \
+ int match = 0; \
+ \
+ switch (pred->op) { \
+ case OP_LT: \
+ match = (*addr < val); \
+ break; \
+ case OP_LE: \
+ match = (*addr <= val); \
+ break; \
+ case OP_GT: \
+ match = (*addr > val); \
+ break; \
+ case OP_GE: \
+ match = (*addr >= val); \
+ break; \
+ default: \
+ break; \
+ } \
+ \
+ return match; \
+}
+
+#define DEFINE_EQUALITY_PRED(size) \
+static int filter_pred_##size(struct filter_pred *pred, void *event, \
+ int val1, int val2) \
+{ \
+ u##size *addr = (u##size *)(event + pred->offset); \
+ u##size val = (u##size)pred->val; \
+ int match; \
+ \
+ match = (val == *addr) ^ pred->not; \
+ \
+ return match; \
+}
+
DEFINE_COMPARISON_PRED(s64);
DEFINE_COMPARISON_PRED(u64);
DEFINE_COMPARISON_PRED(s32);
--
1.6.3.3
--
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-09-10 4:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-10 4:12 [PATCH 0/6] [GIT PULL] tracing/ring-buffer: various fixes and cleanups Steven Rostedt
2009-09-10 4:12 ` [PATCH 1/6] ring-buffer: consolidate interface of rb_buffer_peek() Steven Rostedt
2009-09-10 4:12 ` [PATCH 2/6] tracing: do not grab lock in wakeup latency function tracing Steven Rostedt
2009-09-10 4:12 ` [PATCH 3/6] tracing: remove dead code Steven Rostedt
2009-09-10 4:12 ` [PATCH 4/6] tracing: format clean ups Steven Rostedt
2009-09-10 4:12 ` [PATCH 5/6] tracing: remove stats from struct tracer Steven Rostedt
2009-09-10 4:12 ` [PATCH 6/6] tracing: move PRED macros to trace_events_filter.c Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.