[PATCH 2/7] ftrace: move mmiotrace functions out of trace.c.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pekka Paalanen
Date: Tuesday, September 16, 2008 - 11:56 am

From 743cab2763d3e8d9f4d3b82a02fcdc5ad8a13c04 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sun, 14 Sep 2008 16:53:05 +0300
Subject: [PATCH] ftrace: move mmiotrace functions out of trace.c.

Moves the mmiotrace specific functions from trace.c to
trace_mmiotrace.c. Functions trace_wake_up(), tracing_get_trace_entry(),
and tracing_generic_entry_update() are therefore made available outside
trace.c.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
 kernel/trace/trace.c           |   46 +--------------------------------------
 kernel/trace/trace.h           |   15 +++++-------
 kernel/trace/trace_mmiotrace.c |   42 ++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 53 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7e6cb4f..d372bc5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -785,7 +785,7 @@ trace_next_page(struct trace_array_cpu *data, void *addr)
 	return page_address(page);
 }
 
-static inline struct trace_entry *
+struct trace_entry *
 tracing_get_trace_entry(struct trace_array *tr, struct trace_array_cpu *data)
 {
 	unsigned long idx, idx_next;
@@ -821,7 +821,7 @@ tracing_get_trace_entry(struct trace_array *tr, struct trace_array_cpu *data)
 	return entry;
 }
 
-static inline void
+void
 tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags)
 {
 	struct task_struct *tsk = current;
@@ -865,48 +865,6 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data,
 		trace_function(tr, data, ip, parent_ip, flags);
 }
 
-#ifdef CONFIG_MMIOTRACE
-void __trace_mmiotrace_rw(struct trace_array *tr, struct trace_array_cpu *data,
-						struct mmiotrace_rw *rw)
-{
-	struct trace_entry *entry;
-	unsigned long irq_flags;
-
-	raw_local_irq_save(irq_flags);
-	__raw_spin_lock(&data->lock);
-
-	entry				= tracing_get_trace_entry(tr, data);
-	tracing_generic_entry_update(entry, 0);
-	entry->type			= TRACE_MMIO_RW;
-	entry->field.mmiorw		= *rw;
-
-	__raw_spin_unlock(&data->lock);
-	raw_local_irq_restore(irq_flags);
-
-	trace_wake_up();
-}
-
-void __trace_mmiotrace_map(struct trace_array *tr, struct trace_array_cpu *data,
-						struct mmiotrace_map *map)
-{
-	struct trace_entry *entry;
-	unsigned long irq_flags;
-
-	raw_local_irq_save(irq_flags);
-	__raw_spin_lock(&data->lock);
-
-	entry				= tracing_get_trace_entry(tr, data);
-	tracing_generic_entry_update(entry, 0);
-	entry->type			= TRACE_MMIO_MAP;
-	entry->field.mmiomap		= *map;
-
-	__raw_spin_unlock(&data->lock);
-	raw_local_irq_restore(irq_flags);
-
-	trace_wake_up();
-}
-#endif
-
 void __trace_stack(struct trace_array *tr,
 		   struct trace_array_cpu *data,
 		   unsigned long flags,
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 77c265f..9d39aa0 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -213,11 +213,17 @@ struct trace_iterator {
 	long			idx;
 };
 
+void trace_wake_up(void);
 void tracing_reset(struct trace_array_cpu *data);
 int tracing_open_generic(struct inode *inode, struct file *filp);
 struct dentry *tracing_init_dentry(void);
 void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
 
+struct trace_entry *tracing_get_trace_entry(struct trace_array *tr,
+						struct trace_array_cpu *data);
+void tracing_generic_entry_update(struct trace_entry *entry,
+						unsigned long flags);
+
 void ftrace(struct trace_array *tr,
 			    struct trace_array_cpu *data,
 			    unsigned long ip,
@@ -291,15 +297,6 @@ extern unsigned long ftrace_update_tot_cnt;
 extern int DYN_FTRACE_TEST_NAME(void);
 #endif
 
-#ifdef CONFIG_MMIOTRACE
-extern void __trace_mmiotrace_rw(struct trace_array *tr,
-				struct trace_array_cpu *data,
-				struct mmiotrace_rw *rw);
-extern void __trace_mmiotrace_map(struct trace_array *tr,
-				struct trace_array_cpu *data,
-				struct mmiotrace_map *map);
-#endif
-
 #ifdef CONFIG_FTRACE_STARTUP_TEST
 #ifdef CONFIG_FTRACE
 extern int trace_selftest_startup_function(struct tracer *trace,
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index 9b7a936..ef02747 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -276,6 +276,27 @@ __init static int init_mmio_trace(void)
 }
 device_initcall(init_mmio_trace);
 
+static void __trace_mmiotrace_rw(struct trace_array *tr,
+				struct trace_array_cpu *data,
+				struct mmiotrace_rw *rw)
+{
+	struct trace_entry *entry;
+	unsigned long irq_flags;
+
+	raw_local_irq_save(irq_flags);
+	__raw_spin_lock(&data->lock);
+
+	entry				= tracing_get_trace_entry(tr, data);
+	tracing_generic_entry_update(entry, 0);
+	entry->type			= TRACE_MMIO_RW;
+	entry->field.mmiorw		= *rw;
+
+	__raw_spin_unlock(&data->lock);
+	raw_local_irq_restore(irq_flags);
+
+	trace_wake_up();
+}
+
 void mmio_trace_rw(struct mmiotrace_rw *rw)
 {
 	struct trace_array *tr = mmio_trace_array;
@@ -283,6 +304,27 @@ void mmio_trace_rw(struct mmiotrace_rw *rw)
 	__trace_mmiotrace_rw(tr, data, rw);
 }
 
+static void __trace_mmiotrace_map(struct trace_array *tr,
+				struct trace_array_cpu *data,
+				struct mmiotrace_map *map)
+{
+	struct trace_entry *entry;
+	unsigned long irq_flags;
+
+	raw_local_irq_save(irq_flags);
+	__raw_spin_lock(&data->lock);
+
+	entry				= tracing_get_trace_entry(tr, data);
+	tracing_generic_entry_update(entry, 0);
+	entry->type			= TRACE_MMIO_MAP;
+	entry->field.mmiomap		= *map;
+
+	__raw_spin_unlock(&data->lock);
+	raw_local_irq_restore(irq_flags);
+
+	trace_wake_up();
+}
+
 void mmio_trace_mapping(struct mmiotrace_map *map)
 {
 	struct trace_array *tr = mmio_trace_array;
-- 
1.5.6.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Patch] Tracing/ftrace: Adds a marker to allow user comments, Frédéric Weisbecker, (Sun Aug 24, 2:42 pm)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Mon Aug 25, 6:59 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Mon Aug 25, 10:52 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Wed Aug 27, 2:59 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Aug 28, 3:04 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Aug 28, 9:03 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Sep 4, 9:20 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Sat Sep 6, 4:39 am)
Tracing/ftrace: trouble with trace_entries and trace_pipe, Pekka Paalanen, (Mon Sep 15, 12:47 pm)
Re: Tracing/ftrace: trouble with trace_entries and trace_pipe, Frédéric Weisbecker, (Tue Sep 16, 1:57 am)
[PATCH 1/7] x86 mmiotrace: fix a rare memory leak., Pekka Paalanen, (Tue Sep 16, 11:54 am)
[PATCH 2/7] ftrace: move mmiotrace functions out of trace.c., Pekka Paalanen, (Tue Sep 16, 11:56 am)
[PATCH 3/7] ftrace: add trace_vprintk(), Pekka Paalanen, (Tue Sep 16, 11:58 am)
[PATCH 4/7] x86 mmiotrace: implement mmiotrace_printk()., Pekka Paalanen, (Tue Sep 16, 12:00 pm)
[PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Pekka Paalanen, (Tue Sep 16, 12:02 pm)
[PATCH 6/7] mmiotrace: remove left-over marker cruft., Pekka Paalanen, (Tue Sep 16, 12:03 pm)
[PATCH 7/7] ftrace: inject markers via trace_marker file., Pekka Paalanen, (Tue Sep 16, 12:06 pm)
Re: [PATCH 3/7] ftrace: add trace_vprintk(), Steven Rostedt, (Tue Sep 16, 1:06 pm)
Re: [PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Steven Rostedt, (Tue Sep 16, 1:11 pm)
Re: [PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Pekka Paalanen, (Tue Sep 16, 2:24 pm)
Re: [PATCH 3/7] ftrace: add trace_vprintk(), Ingo Molnar, (Wed Sep 17, 4:42 am)
Re: Tracing/ftrace: trouble with trace_entries and trace_pipe, Frédéric Weisbecker, (Wed Sep 17, 5:41 am)