Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5285410imm; Tue, 26 Jun 2018 08:45:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeZVtVNrlbJQpt0se8AA0w9voDtMY0sqAETjOvER285c59IL4Fu02voszESySd0TWSiAFyK X-Received: by 2002:a62:5486:: with SMTP id i128-v6mr2089205pfb.166.1530027951863; Tue, 26 Jun 2018 08:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530027951; cv=none; d=google.com; s=arc-20160816; b=xR34L9IR4556wsxOb4orUKah9P8nvf8P1EGdaco/m3IWeFoA0cfPmCHimC4lTloTiF XMQ9CRjAcbJ0oNyVWOcQtCrxKjnwg4UcSiuxp6weh+cyYq7wzLAiBCgjcZNE3SWvDlAn A3hp9A0gn3xOZHUXHNzEo+/99s599orNIGZm7cmwvOC0yMzu6ua1oU9kydNsTCoBWgRL zfzGSEt4fwZXYK9BEF4Vvi6x6+glJc1VV/eWGnTuClV/+W6l3E77UMivKn4rkJDrOBDH rzLISZ5DCCQPhWz8DHQjseBBJj7lfaXv9XGz0E7d+ekkwK5v4IE/fPFkhbBW6DjP46B3 ueuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=KvrF34fgWp5CgXDLxU+XcsKaZWeWAyr1y3cGDWI3Dpg=; b=HSAbJUPVeGdRsi8vTmT3+0M58LgQUgyr/gHUmGLb5oEFPUd32g/xmNIFJc4RT+xMKV ftp/AkTFxYmzrnsLGeUFf0JP5gGbng418d06e/+PIyZVA/vOrA8WLSIXLVx3HQj1MH6g AsCWFGYv49+CyurL5qTo1d6JUakQP1i0koCPvBAn1Ff1ueR4VLKvAZWhJlAGz6dygbIR Hn9yTTpIiE0ZRcINuoKJSiWOIflrZK2cp0xZy2XCM3x23BBWG7t1Ogly2jMbkoAFgC9W +8x/01SSesiJaO55WPIM7QFLkrn9kkmqmH5+bkLsH2XHWBLMw7yEbUCu8ZwoX13T2Wod icBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b67-v6si1905262plb.272.2018.06.26.08.45.37; Tue, 26 Jun 2018 08:45:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752400AbeFZPmz (ORCPT + 99 others); Tue, 26 Jun 2018 11:42:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50438 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752382AbeFZPmy (ORCPT ); Tue, 26 Jun 2018 11:42:54 -0400 Received: from p4fea482e.dip0.t-ipconnect.de ([79.234.72.46] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fXq6k-0004CE-8S; Tue, 26 Jun 2018 17:42:18 +0200 Date: Tue, 26 Jun 2018 17:42:14 +0200 (CEST) From: Thomas Gleixner To: Pavel Tatashin cc: Steven Sistare , Daniel Jordan , linux@armlinux.org.uk, schwidefsky@de.ibm.com, Heiko Carstens , John Stultz , sboyd@codeaurora.org, x86@kernel.org, LKML , mingo@redhat.com, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, Petr Mladek , gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org Subject: Re: [PATCH v12 09/11] x86/tsc: prepare for early sched_clock In-Reply-To: Message-ID: References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-10-pasha.tatashin@oracle.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel, first of all, sorry for my last outburst. I just was in a lousy mood after staring into too much half baken stuff and failed to make myself stay away from the computer. On Sun, 24 Jun 2018, Thomas Gleixner wrote: > On Sat, 23 Jun 2018, Pavel Tatashin wrote: > And this early init sequence also needs to pull over the tsc adjust > magic. So tsc_early_delay_calibrate() which should btw. be renamed to > tsc_early_init() should have: > > { > cpu_khz = x86_platform.calibrate_cpu(); > tsc_khz = x86_platform.calibrate_tsc(); > > tsc_khz = tsc_khz ? : cpu_khz; > if (!tsc_khz) > return; > > /* Sanitize TSC ADJUST before cyc2ns gets initialized */ > tsc_store_and_check_tsc_adjust(true); > > calc_lpj(tsc_khz); > > tsc_sched_clock_init(); > } Peter made me look deeper into this and there are a few issues, which I missed, depending on when some of the resources become available. So we probably cannot hook all of this into tsc_early_delay_calibrate(). I have an idea how to distangle it and we'll end up in a staged approach, which looks like this: 1) Earliest one (not sure how early yet) Attempt to use MSR/CPUID. If not running on a hypervisor this can try the quick PIT calibration, but nothing else. 2) Post init_hypervisor_platform() An attempt to use the hypervisor data can be made. 3) Post early_acpi_boot_init() This can do PIT/HPET based calibration 4) Post x86_dtb_init() PIT/PMTIMER based calibration Once tsc_khz is known, no further attempts of calibration are made. I'll look into that later tonight. Thanks, tglx