Re: [PATCH] arch/tile: new multi-core architecture for Linux

From: Arnd Bergmann
Date: Wed May 26 2010 - 13:09:51 EST


On Wednesday 26 May 2010 18:22:33 Chris Metcalf wrote:
> On 5/25/2010 4:12 PM, Thomas Gleixner wrote:
> > +unsigned long long sched_clock(void)
> > +{
> > + u64 cycles;
> > + u32 cyc_hi, cyc_lo;
> > +
> > + if (unlikely(cyc2ns_mult == 0))
> > + setup_clock();
> >
> > Please initialize stuff before it is called the first time and not
> > at some arbitrary point conditionally in a hotpath.
> >
>
> Looking more closely at this, the reason for this lazy initialization
> was that sched_clock() can be called from lockdep_init(), which runs way
> before any tasteful architecture-specific initialization can happen.
> Perhaps the correct model is that during the early stages of boot, we
> are happy to shift by zero, multiply by zero, and claim the time is zero :-)

Yes, that is what other architectures do. The time remains zero during
early boot. setup_arch is probably a good place to start the clock.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/