diff mbox

[v2,2/2] ARM: delay: allow timer-based delay implementation to be selected

Message ID 50082598.5090706@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jonathan Austin July 19, 2012, 3:19 p.m. UTC
Hi all,

On 18/07/12 18:52, Will Deacon wrote:

> Hello,
> On Tue, Jul 17, 2012 at 08:42:36AM +0100, Shinya Kuribayashi wrote:
>> On 7/17/2012 3:11 PM, Shilimkar, Santosh wrote:
>>> Looks like you have a working patch for the clock detection. Will
>>> you able to post that patch so that this long pending calibration
>>> for secondary CPUs gets optimized.
>>
>> Something like this should work (not even build tested, can be applied
>> on top of Will's v2 patchset):
> 
> [...]
> 
>> And change your ->timer() func (called via time_init) to make use of it:
>>
>>         unsigned long freq;
>>
>>         /* For UP/SMP systems */
>>         freq = get_CPU_frequency();
>>         calibrate_delay_early(freq);
>>
>> #ifdef CONFIG_SMP
>>         /* For SMP systems */
>>         freq = get_Timer_frequency();
>>         init_current_timer_delay(freq);
>> #endif
> 
> Since this seems to be gaining some traction on platforms without the
> architected timers, Jonny and I have put together a simple registration
> mechanism for the delay timer to avoid people calling init_current_timer_delay
> (and defining the global read_current_timer symbol).


We should probably also ignore and additional registration calls, not just
those made after the delay loop has been calibrated...

Something like the patch below should do the trick.

Jonny

-----8<------

Comments

Will Deacon July 20, 2012, 10:17 a.m. UTC | #1
On Thu, Jul 19, 2012 at 04:19:52PM +0100, Jonathan Austin wrote:
> We should probably also ignore and additional registration calls, not just
> those made after the delay loop has been calibrated...
> 
> Something like the patch below should do the trick.

[...]

Cheers, pushed into my delay branch. Note that I don't plan to queue these
patches until somebody decides they want a delay source other than the
architected timers in mainline.

Will
Shinya Kuribayashi July 24, 2012, 9:06 a.m. UTC | #2
Hi Will, Jonathan,

On 7/20/2012 7:17 PM, Will Deacon wrote:
> On Thu, Jul 19, 2012 at 04:19:52PM +0100, Jonathan Austin wrote:
>> We should probably also ignore and additional registration calls, not just
>> those made after the delay loop has been calibrated...
>>
>> Something like the patch below should do the trick.
> 
> [...]
> 
> Cheers, pushed into my delay branch.

Thanks for the registration machanism.  It looks nice, and works for
me on a Cortex-A9 SMP platform with a non-arch_timer counter.

I've picked up a revised version of the patch from will/delay and
merged it into our local development branch.  We'll give it a try
in different conditions, UP and SMP, with/without DVFS and so on,
and let you know if I find anything.
Will Deacon July 24, 2012, 9:15 a.m. UTC | #3
On Tue, Jul 24, 2012 at 10:06:06AM +0100, Shinya Kuribayashi wrote:
> Hi Will, Jonathan,
> 
> On 7/20/2012 7:17 PM, Will Deacon wrote:
> > On Thu, Jul 19, 2012 at 04:19:52PM +0100, Jonathan Austin wrote:
> >> We should probably also ignore and additional registration calls, not just
> >> those made after the delay loop has been calibrated...
> >>
> >> Something like the patch below should do the trick.
> > 
> > [...]
> > 
> > Cheers, pushed into my delay branch.
> 
> Thanks for the registration machanism.  It looks nice, and works for
> me on a Cortex-A9 SMP platform with a non-arch_timer counter.

That's good to hear, thanks.

> I've picked up a revised version of the patch from will/delay and
> merged it into our local development branch.  We'll give it a try
> in different conditions, UP and SMP, with/without DVFS and so on,
> and let you know if I find anything.

Great! If everything looks good, and you're interested in using this in
mainline, I could push the registration for 3.7. I just don't want to see it
there if nobody's using it.

Will
diff mbox

Patch

diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 1b51570..fff305b 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -72,8 +72,9 @@  void __init register_current_timer_delay(struct delay_timer *timer)
                arm_delay_ops.delay             = __timer_delay;
                arm_delay_ops.const_udelay      = __timer_const_udelay;
                arm_delay_ops.udelay            = __timer_udelay;
+               delay_calibrated                = true;
        } else {
-               pr_info("Ignoring late registration of read_current_timer delay\n");
+               pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
        }
 }