public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Paul Mundt <lethal@linux-sh.org>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: register_timer_hook use in arch/sh/oprofile
Date: Wed, 24 Jun 2009 14:28:28 +0200	[thread overview]
Message-ID: <20090624142828.7c6a2337@skybase> (raw)
In-Reply-To: <20090624112929.GB2079@linux-sh.org>

On Wed, 24 Jun 2009 20:29:29 +0900
Paul Mundt <lethal@linux-sh.org> wrote:

> On Wed, Jun 24, 2009 at 01:11:04PM +0200, Martin Schwidefsky wrote:
> > 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?
> > 
> 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?

> The sh7750 performance counter code has always purposely abused the timer
> interrupt as its profiling interrupt given that the counters themselves do not
> generate IRQs on their own. There are a couple of 64-bit counters that can
> count various events, but have no real event associated with them. As long as
> they are periodically read, they return accurate statistics, but the granularity
> is never better than the timer IRQ.
> 
> In practice oprofile has never been a good fit for these sorts of counters, so
> this has fairly limited use. If there's a way to wiggle these types of counters
> in to the new perf_counter API, then I'll convert that over and just kill the
> old oprofile driver off completely. Barring that, I'll just end up converting it
> over to hrtimers as well, so don't let that stop you from ripping out the timer
> hook bits.
> 
> Most of this code predates hrtimers anyways, and it also predates the timer
> hook, which is only something that we converted to some years back.

Consider the timer_hook as history :-)

-- 
blue skies,
   Martin.

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


  parent reply	other threads:[~2009-06-24 12:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090624142828.7c6a2337@skybase \
    --to=schwidefsky@de.ibm.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox