From: Thomas Gleixner <tglx@linutronix.de>
To: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>, x86-ml <x86@kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Steven Rostedt <rostedt@goodmis.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH -v2.1] x86: Kill notsc
Date: Tue, 17 Nov 2015 11:08:19 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1511171107390.3761@nanos> (raw)
In-Reply-To: <20151117093309.GD8819@pd.tnic>
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
next prev parent reply other threads:[~2015-11-17 10:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-18 14:20 [RFC PATCH] " Borislav Petkov
2015-10-19 4:47 ` Andy Lutomirski
2015-10-19 8:16 ` Borislav Petkov
2015-10-21 17:58 ` Borislav Petkov
2015-10-21 19:01 ` Peter Zijlstra
2015-10-22 18:51 ` [PATCH -v2] " Borislav Petkov
2015-11-04 10:21 ` Thomas Gleixner
2015-11-04 10:29 ` Borislav Petkov
2015-11-16 18:45 ` [RFC PATCH -v2.1] " Borislav Petkov
2015-11-16 21:25 ` Thomas Gleixner
2015-11-17 5:02 ` H. Peter Anvin
2015-11-17 8:53 ` Borislav Petkov
2015-11-17 9:11 ` Thomas Gleixner
2015-11-17 9:33 ` Borislav Petkov
2015-11-17 10:08 ` Thomas Gleixner [this message]
2015-11-17 11:09 ` Borislav Petkov
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=alpine.DEB.2.11.1511171107390.3761@nanos \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®