public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* register_timer_hook use in arch/sh/oprofile
@ 2009-06-24 11:11 Martin Schwidefsky
  2009-06-24 11:29 ` Paul Mundt
  0 siblings, 1 reply; 19+ messages in thread
From: Martin Schwidefsky @ 2009-06-24 11:11 UTC (permalink / raw)
  To: lethal; +Cc: Ingo Molnar, linux-kernel

Hi Paul,
following Ingo's suggestion I'm working on a patch to use a per-cpu
hrtimer instead of the timer_hook for the oprofile ticks. Given that
oprofile is the only user of the timer_hook I want to remove it
completely. That way I came across the register_timer_hook call in
arch/sh/oprofile/op_model_sh7750.c. Did this ever work? The startup
of oprofile is done in two steps, on module load oprofile_init is
called, on profiling start oprofile_start is called.
Now for SH7750 this happens:

oprofile_init()
	...
	oprofile_arch_init(&oprofile_ops);
		...
		lmodel->init(); 
		/* init() is sh7750_ppc_init for CPU_SH7750/CPU_7750S */
			sh7750_ppc_reset();
			register_timer_hook(sh7750_timer_notify);
			...
		...
	oprofile_timer_init(&oprofile_ops);
		...
		ops->start = timer_start;
		...
	...

oprofile_start()
	...
	oprofile_ops.start();
	/* start() is timer_start set by oprofile_timer_init */
		register_timer_hook(timer_notify);
	...

As far as I can see the second register_timer_hook will fail
because sh7750_timer_notify is already registered. That will cause
oprofile_start to fail with -EBUSY, no?

My proposed solution for that particular problem would be to remove the
sh7750_timer_notify function together with the register/unregister
calls, see patch below. Then the sole caller of register_timer_hook
would be in drivers/oprofile/timer_int.c and after that has been
converted to hrtimer the whole timer_hook stuff could go away.

---
diff -urpN linux-2.6/arch/sh/oprofile/op_model_sh7750.c linux-2.6-patched/arch/sh/oprofile/op_model_sh7750.c
--- linux-2.6/arch/sh/oprofile/op_model_sh7750.c	2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6-patched/arch/sh/oprofile/op_model_sh7750.c	2009-06-24 13:07:08.000000000 +0200
@@ -95,12 +95,6 @@ static struct sh7750_ppc_register_config
  * behavior.
  */
 
-static int sh7750_timer_notify(struct pt_regs *regs)
-{
-	oprofile_add_sample(regs, 0);
-	return 0;
-}
-
 static u64 sh7750_read_counter(int counter)
 {
 	return (u64)((u64)(__raw_readl(PMCTRH(counter)) & 0xffff) << 32) |
@@ -231,14 +225,11 @@ static inline void sh7750_ppc_reset(void
 static int sh7750_ppc_init(void)
 {
 	sh7750_ppc_reset();
-
-	return register_timer_hook(sh7750_timer_notify);
+	return 0;
 }
 
 static void sh7750_ppc_exit(void)
 {
-	unregister_timer_hook(sh7750_timer_notify);
-
 	sh7750_ppc_reset();
 }
 
---

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2009-12-16  7:22 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-24 11:11 register_timer_hook use in arch/sh/oprofile Martin Schwidefsky
2009-06-24 11:29 ` Paul Mundt
2009-06-24 12:17   ` Ingo Molnar
2009-06-24 12:25     ` Paul Mundt
2009-06-24 12:37       ` Ingo Molnar
2009-06-24 12:40       ` Paul Mackerras
2009-06-24 12:47         ` Ingo Molnar
2009-06-24 12:28   ` Martin Schwidefsky
2009-06-24 12:34     ` Paul Mundt
2009-06-24 12:45       ` Ingo Molnar
2009-06-24 13:14         ` Paul Mundt
2009-06-24 13:24           ` Ingo Molnar
2009-06-26  7:01             ` Peter Zijlstra
2009-06-26  7:23               ` Ingo Molnar
2009-06-26  7:26                 ` Paul Mundt
2009-06-26  7:36                 ` Peter Zijlstra
2009-06-24 12:54       ` Martin Schwidefsky
2009-12-16  4:52         ` Paul Mundt
2009-12-16  7:21           ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox