Re: register_timer_hook use in arch/sh/oprofile

Paul Mundt
2009-06-24T12:35:29Z

On Wed, Jun 24, 2009 at 02:28:28PM +0200, Martin Schwidefsky wrote:
> On Wed, 24 Jun 2009 20:29:29 +0900
> Paul Mundt <lethal@linux-sh.org> wrote:
> > No. oprofile_timer_init() is only entered if the performance counters
> > fail to register in the SH7750 case, so there is only one timer hook user
> > at a time:
> >
> > static int __init oprofile_init(void)
> > {
> > int err;
> >
> > err = oprofile_arch_init(&oprofile_ops);
> >
> > if (err < 0 || timer) {
> > printk(KERN_INFO "oprofile: using timer interrupt.\n");
> > oprofile_timer_init(&oprofile_ops);
> > }
> > ...
>
> Oh, I see. That is the reason why the s390 version of
> oprofile_arch_init returns -ENODEV. It does so to trigger the fallback
> to the timer_hook. That should work for sh as well, no?
>
It would, yes, but it would also disable access to the SH7750 counters at
the same time, so we don't really want to do that. The sh7750 counters
are more like timer based profiling with some extra events that can be
set and read, so reverting to oprofile_timer_init() would reduce
functionality.

My current plan is to migrate things over to the perf_counter API and
annoy Ingo with my interrupt deprived counters ;-)

Given that hrtimers are already generically supported there, it should
tie in much cleaner there than in the oprofile case at least.