From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755508AbbJUTDf (ORCPT ); Wed, 21 Oct 2015 15:03:35 -0400 Received: from casper.infradead.org ([85.118.1.10]:37142 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752971AbbJUTDd (ORCPT ); Wed, 21 Oct 2015 15:03:33 -0400 Date: Wed, 21 Oct 2015 21:01:09 +0200 From: Peter Zijlstra To: Borislav Petkov Cc: x86-ml , Andy Lutomirski , Steven Rostedt , lkml Subject: Re: [RFC PATCH] x86: Kill notsc Message-ID: <20151021190109.GC2508@worktop.programming.kicks-ass.net> References: <20151018142007.GA11294@pd.tnic> <20151021175803.GF3575@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151021175803.GF3575@pd.tnic> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).