lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Nov 2015 10:33:09 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Peter Zijlstra <peterz@...radead.org>, x86-ml <x86@...nel.org>,
	Andy Lutomirski <luto@...capital.net>,
	Steven Rostedt <rostedt@...dmis.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH -v2.1] x86: Kill notsc

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...?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ