Re: [RFC PATCH] x86: Kill notsc

From: Peter Zijlstra
Date: Wed Oct 21 2015 - 15:03:40 EST


On Wed, Oct 21, 2015 at 07:58:03PM +0200, Borislav Petkov wrote:
> > +#ifdef CONFIG_X86_TSC
> > + /* return the value in ns */
> > + return cycles_2_ns(rdtsc());
> > +#else
>
> Ok, we have a problem here:
>
> See the splat below. On the init path
>
> start_kernel
> |-> sched_init
> |-> init_idle
>
> we're calling sched_clock() which does the cycles_2_ns() thing.
>
> However, that cycles_2_ns() thing gets called only in tsc_init() which
> comes later in start_kernel().
>
> Which means, data in this line
>
> ns += mul_u64_u32_shr(cyc, data->cyc2ns_mul, data->cyc2ns_shift);
>
> is NULL.
>
> Now, the question is, can I push only the cyc2ns_init() call up, before
> sched_init()?

I _think_ so, but its late. It would result in sched_clock() being 0
until you hit that other bit, but that should be fine (maybe).
--
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/