Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271039
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH -v2.1] x86: Kill notsc |
| Date | 2015-11-17 11:10 +0100 |
| Message-ID | <qvLn4-3DL-23@gated-at.bofh.it> (permalink) |
| References | (6 earlier) <qvzvA-4cE-37@gated-at.bofh.it> <qvGGK-zE-3@gated-at.bofh.it> <qvKhk-2Hb-7@gated-at.bofh.it> <qvKAF-355-5@gated-at.bofh.it> <qvKU1-3cW-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 17 Nov 2015, Borislav Petkov wrote:
> On Tue, Nov 17, 2015 at 10:11:03AM +0100, Thomas Gleixner wrote:
> > There is an interesting problem:
> >
> > tsc_init()
> > {
> > tsc_khz = x86_platform.calibrate_tsc();
> > if (!tsc_khz) {
> > mark_tsc_unstable("could not calculate TSC khz");
> > ...
> > }
> >
> > In the current code we do NOT use TSC for sched_clock() and that's
> > correct as we have no idea what the TSC frequency is.
> >
> > With your changes that is not longer the case, so you end up with a
> > completely wreckaged sched clock.
>
> Hmm, I see it.
>
> Well, I had a related splat which bombed because cyc2ns_init() had to
> run before we do sched_init()->idle_init() which called sched_clock()
> and there we did the cycles_2_ns() thing and the percpu vars weren't
> initialized yet.
>
> That's why I did this:
>
> +void __init early_tsc_init(void)
> +{
> + int cpu;
> +
> + /*
> + * We need to init the cycles to ns conversion machinery because
> + * init_idle() below will call sched_clock() which needs it.
> + */
> + for_each_possible_cpu(cpu)
> + cyc2ns_init(cpu);
> +}
>
> Maybe I should move tsc_init() before sched_init() so that the
> calibration happens before we use the TSC in sched_clock() for the first
> time...?
How does that help if your TSC frequency is 0 after the calibration?
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH -v2.1] x86: Kill notsc Borislav Petkov <bp@alien8.de> - 2015-11-16 19:50 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Thomas Gleixner <tglx@linutronix.de> - 2015-11-16 22:30 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc "H. Peter Anvin" <hpa@zytor.com> - 2015-11-17 06:10 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Borislav Petkov <bp@alien8.de> - 2015-11-17 10:00 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Thomas Gleixner <tglx@linutronix.de> - 2015-11-17 10:20 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Borislav Petkov <bp@alien8.de> - 2015-11-17 10:40 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Thomas Gleixner <tglx@linutronix.de> - 2015-11-17 11:10 +0100
Re: [RFC PATCH -v2.1] x86: Kill notsc Borislav Petkov <bp@alien8.de> - 2015-11-17 12:20 +0100
csiph-web