aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/oprof.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2008-09-24 05:08:52 -0400
committerRobert Richter <robert.richter@amd.com>2008-09-24 05:08:52 -0400
commit4c168eaf7ea39f25a45a3d8c7eebc3fedb633a1d (patch)
tree315bb66a3ce2e752749a780876e2b7b5f6a596de /drivers/oprofile/oprof.c
parent45f197ade73ba95681b9803680c75352fc0a1c0a (diff)
Revert "Oprofile Multiplexing Patch"
Reverting commit 1a960b402a51d80abf54e3f8e4972374ffe5f22d for the main branch. Multiplexing will be tracked on a separate feature branch. Conflicts: arch/x86/oprofile/nmi_int.c
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r--drivers/oprofile/oprof.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c
index b2fa5df64a62..2c645170f06e 100644
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -12,8 +12,6 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/oprofile.h> 13#include <linux/oprofile.h>
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/workqueue.h>
16#include <linux/time.h>
17#include <asm/mutex.h> 15#include <asm/mutex.h>
18 16
19#include "oprof.h" 17#include "oprof.h"
@@ -21,18 +19,13 @@
21#include "cpu_buffer.h" 19#include "cpu_buffer.h"
22#include "buffer_sync.h" 20#include "buffer_sync.h"
23#include "oprofile_stats.h" 21#include "oprofile_stats.h"
24
25static unsigned long is_setup;
26static void switch_worker(struct work_struct *work);
27static DECLARE_DELAYED_WORK(switch_work, switch_worker);
28static DEFINE_MUTEX(start_mutex);
29 22
30struct oprofile_operations oprofile_ops; 23struct oprofile_operations oprofile_ops;
31 24
32unsigned long timeout_jiffies;
33unsigned long oprofile_started; 25unsigned long oprofile_started;
34unsigned long backtrace_depth; 26unsigned long backtrace_depth;
35/* Multiplexing defaults at 1 msec*/ 27static unsigned long is_setup;
28static DEFINE_MUTEX(start_mutex);
36 29
37/* timer 30/* timer
38 0 - use performance monitoring hardware if available 31 0 - use performance monitoring hardware if available
@@ -94,16 +87,6 @@ out:
94 return err; 87 return err;
95} 88}
96 89
97static void start_switch_worker(void)
98{
99 schedule_delayed_work(&switch_work, timeout_jiffies);
100}
101
102static void switch_worker(struct work_struct *work)
103{
104 if (!oprofile_ops.switch_events())
105 start_switch_worker();
106}
107 90
108/* Actually start profiling (echo 1>/dev/oprofile/enable) */ 91/* Actually start profiling (echo 1>/dev/oprofile/enable) */
109int oprofile_start(void) 92int oprofile_start(void)
@@ -111,6 +94,7 @@ int oprofile_start(void)
111 int err = -EINVAL; 94 int err = -EINVAL;
112 95
113 mutex_lock(&start_mutex); 96 mutex_lock(&start_mutex);
97
114 if (!is_setup) 98 if (!is_setup)
115 goto out; 99 goto out;
116 100
@@ -124,9 +108,6 @@ int oprofile_start(void)
124 if ((err = oprofile_ops.start())) 108 if ((err = oprofile_ops.start()))
125 goto out; 109 goto out;
126 110
127 if (oprofile_ops.switch_events)
128 start_switch_worker();
129
130 oprofile_started = 1; 111 oprofile_started = 1;
131out: 112out:
132 mutex_unlock(&start_mutex); 113 mutex_unlock(&start_mutex);
@@ -142,7 +123,6 @@ void oprofile_stop(void)
142 goto out; 123 goto out;
143 oprofile_ops.stop(); 124 oprofile_ops.stop();
144 oprofile_started = 0; 125 oprofile_started = 0;
145 cancel_delayed_work_sync(&switch_work);
146 /* wake up the daemon to read what remains */ 126 /* wake up the daemon to read what remains */
147 wake_up_buffer_waiter(); 127 wake_up_buffer_waiter();
148out: 128out:
@@ -175,32 +155,6 @@ post_sync:
175 mutex_unlock(&start_mutex); 155 mutex_unlock(&start_mutex);
176} 156}
177 157
178/* User inputs in ms, converts to jiffies */
179int oprofile_set_timeout(unsigned long val_msec)
180{
181 int err = 0;
182
183 mutex_lock(&start_mutex);
184
185 if (oprofile_started) {
186 err = -EBUSY;
187 goto out;
188 }
189
190 if (!oprofile_ops.switch_events) {
191 err = -EINVAL;
192 goto out;
193 }
194
195 timeout_jiffies = msecs_to_jiffies(val_msec);
196 if (timeout_jiffies == MAX_JIFFY_OFFSET)
197 timeout_jiffies = msecs_to_jiffies(1);
198
199out:
200 mutex_unlock(&start_mutex);
201 return err;
202
203}
204 158
205int oprofile_set_backtrace(unsigned long val) 159int oprofile_set_backtrace(unsigned long val)
206{ 160{
@@ -225,16 +179,10 @@ out:
225 return err; 179 return err;
226} 180}
227 181
228static void __init oprofile_switch_timer_init(void)
229{
230 timeout_jiffies = msecs_to_jiffies(1);
231}
232
233static int __init oprofile_init(void) 182static int __init oprofile_init(void)
234{ 183{
235 int err; 184 int err;
236 185
237 oprofile_switch_timer_init();
238 err = oprofile_arch_init(&oprofile_ops); 186 err = oprofile_arch_init(&oprofile_ops);
239 187
240 if (err < 0 || timer) { 188 if (err < 0 || timer) {