Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7740612imm; Thu, 28 Jun 2018 08:38:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKpNMMesY4S7HqKJo0wJM6pCZ7T4ASBVlFkk0V+kRRefmiZDGop9QU5s7jKTumYjF4G4hCu X-Received: by 2002:a17:902:5ac3:: with SMTP id g3-v6mr10871648plm.90.1530200322029; Thu, 28 Jun 2018 08:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530200321; cv=none; d=google.com; s=arc-20160816; b=XHaPrpmmtocBUWdULQKu7CnzEkQbWgMQnJAwFENRuUurXw/6X5uSkoMrsD8wxUr+ZF pq08N/rFP/c3sOIhp0aIHjwEEanisiuoPePRH/I1AzjaoLNcJWMyVurIxnqBsgLG6EVl hcx/dGVxAR8se+dFJrHAGqGANEUedNxwxFftx7s2h3/3w7LpZtCfT8RWnaoEth4Bgzvx nypndh2KtQT8tByuFJmZwviXe88YhSVao4tTLGjAz5Qgn9n0exw1GMKKBW9jfhUcbx9t f2Iftv91cYSYhZ232SvnG5CHdo85FjMR/OBMFrcjvzhUlQhrRIRj3JnviKp0orKBRpwy 2zog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=TcAM7vpWeW9JbkdbBEj1QaU68boBMzAQSJAhI1EDWOU=; b=FAv2oN2ZVGYowT4ZrItwm2vyVACTBMw834tfQ8P2ZTIjKGd8294MHE0pwahez1ts2f smE02+KY1N1Onazm3dtnbTdiENUPWH9qgV7J/zGY2ze7p2OqbuNGAtBUDdmoiLgtNYZS KsQ5xFlEAAiGPu/hVZ8g5Q5iDwBaTWl7B55nJmy0AoBVtlM8HspA33fSXh8W7Dg2+jYL DusoUl+F+Zotu0WqS3IA2IfpR56pxn3a4WxQCRCTWMoJAus/5F4rytSJSuaQlfZe+6Gy MKVs6cTltmzxZmramLUUisejUmmSOPScanOrfSC0YD0aJ1eTvR/CIqShJJjb0Pf+P1yD o1Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dKoAnec0; 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 i1-v6si6630002plt.183.2018.06.28.08.38.27; Thu, 28 Jun 2018 08:38:41 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dKoAnec0; 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 S965527AbeF1LrH (ORCPT + 99 others); Thu, 28 Jun 2018 07:47:07 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58750 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933933AbeF1LrE (ORCPT ); Thu, 28 Jun 2018 07:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TcAM7vpWeW9JbkdbBEj1QaU68boBMzAQSJAhI1EDWOU=; b=dKoAnec0CaNRMfEK51clWgjMd NKxr6cR5C4quKtH0bxmTsW1AfkIT/CsNCK97v4gRxZFLbWDTYNt43DmAAiLv4KBwPoFOclrlNNzW4 fv7Is1Gxq0TcgAlNUikLASOj07ticyMEPXvU37N7maQnPmUHq9IF/W8ORU93WkIFOd8AC2CwpCcWU kMnVoBJmUNnznlDuO+TKy4ZRSpiJOVR727nAwL9OzXTxIQLst/+vcImw3oJovP6GlPFdbz4wbbKWY mY/eCt0TIs7AVvyidElMrc83CegCyiy72aK/SHfNGAdgETBHrk90kLjJbfJ/f/OcwImzmWdDn1NPm zqva22NUg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fYVNT-0002jb-93; Thu, 28 Jun 2018 11:46:19 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E4D2220289CE5; Thu, 28 Jun 2018 13:46:15 +0200 (CEST) Date: Thu, 28 Jun 2018 13:46:15 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: Pavel Tatashin , Steven Sistare , Daniel Jordan , linux@armlinux.org.uk, Martin Schwidefsky , Heiko Carstens , John Stultz , sboyd@codeaurora.org, x86@kernel.org, LKML , mingo@redhat.com, "H. Peter Anvin" , douly.fnst@cn.fujitsu.com, Prarit Bhargava , feng.tang@intel.com, Petr Mladek , gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, Andy Shevchenko , Boris Ostrovsky Subject: Re: [PATCH v12 09/11] x86/tsc: prepare for early sched_clock Message-ID: <20180628114615.GF2494@hirez.programming.kicks-ass.net> References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-10-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 12:43:59PM +0200, Thomas Gleixner wrote: > init_hypervisor_platform() > vmware: > Retrieves frequency and store it for the > calibration function > > khz = vmware_get_khz_magic() > vmware_tsc_khz = khz > calibrate_cpu = vmware_get_tsc_khz > calibrate_tsc = vmware_get_tsc_khz > preset_lpj(khz) > > hyperv: > if special hyperv MSRs are available: > > calibrate_cpu = hv_get_tsc_khz > calibrate_tsc = hv_get_tsc_khz > > MSR is readable already in this function > > jailhouse: > > Frequency is available in this function and store > in a variable for the calibration function > > calibrate_cpu = jailhouse_get_tsc > calibrate_tsc = jailhouse_get_tsc > > ... > > kvmclock_init() > > if (magic_conditions) > calibrate_tsc = kvm_get_tsc_khz > calibrate_cpu = kvm_get_tsc_khz > > kvm_get_preset_lpj() > khz = kvm_get_tsc_khz() > preset_lpj(khz); Note that all these which get TSC values from a HV _should_ set X86_FEATURE_TSC_KNOWN_FREQ to avoid the late recalibrate. Calibrating against a virtual PIT/HPET/PMTIMER is utterly pointless. > The generic initilizaiton does everything twice, which makes no sense, > except for the unlikely case were no fast functions are available and the > quick PIT calibration fails (PMTIMER/HPET) are not available in early > calibration. HPET Incomplete; but I suspect you want to talk about how we can make HPET available early by putting it in a fixmap. And only if we fail, do we at a later stage try again using PMTIMER. Currently it all works by accident, since !hpet and acpi_pm_read_early() returns 0, but really we should not be running the fallback crap at all that early.