File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -239,26 +239,45 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val)
239
239
return err ;
240
240
}
241
241
242
+ static int timer_mode ;
243
+
242
244
static int __init oprofile_init (void )
243
245
{
244
246
int err ;
245
247
248
+ /* always init architecture to setup backtrace support */
246
249
err = oprofile_arch_init (& oprofile_ops );
247
- if (err < 0 || timer ) {
248
- printk (KERN_INFO "oprofile: using timer interrupt.\n" );
250
+
251
+ timer_mode = err || timer ; /* fall back to timer mode on errors */
252
+ if (timer_mode ) {
253
+ if (!err )
254
+ oprofile_arch_exit ();
249
255
err = oprofile_timer_init (& oprofile_ops );
250
256
if (err )
251
257
return err ;
252
258
}
253
- return oprofilefs_register ();
259
+
260
+ err = oprofilefs_register ();
261
+ if (!err )
262
+ return 0 ;
263
+
264
+ /* failed */
265
+ if (timer_mode )
266
+ oprofile_timer_exit ();
267
+ else
268
+ oprofile_arch_exit ();
269
+
270
+ return err ;
254
271
}
255
272
256
273
257
274
static void __exit oprofile_exit (void )
258
275
{
259
- oprofile_timer_exit ();
260
276
oprofilefs_unregister ();
261
- oprofile_arch_exit ();
277
+ if (timer_mode )
278
+ oprofile_timer_exit ();
279
+ else
280
+ oprofile_arch_exit ();
262
281
}
263
282
264
283
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ int oprofile_timer_init(struct oprofile_operations *ops)
110
110
ops -> start = oprofile_hrtimer_start ;
111
111
ops -> stop = oprofile_hrtimer_stop ;
112
112
ops -> cpu_type = "timer" ;
113
+ printk (KERN_INFO "oprofile: using timer interrupt.\n" );
113
114
return 0 ;
114
115
}
115
116
You can’t perform that action at this time.
0 commit comments