Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7551577imm; Thu, 28 Jun 2018 05:46:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdV+2bi8OFAMeXJE5mJK1Pt2V4/zHcyNxOwqvaMk7nQidnUJjYSbki5tWBlW3vd+3Zdksr/ X-Received: by 2002:a62:104e:: with SMTP id y75-v6mr10038255pfi.109.1530190011670; Thu, 28 Jun 2018 05:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530190011; cv=none; d=google.com; s=arc-20160816; b=Ee47+2Nh79l4QYkpCoGfrdQnxQaAspt/ThAUxnbF758gDOJ5PmkNo4/FSHBkJRwcIk h8+twUr+uMnTncDqrXwj6kBWnrmg0gmLd8AEJZtF72SxHJU3STO+LldaaziElnk0sKpi uJ/148iJO7nDujTFzea85ktnT8zSbnHYs7bX12NejO5AtAk9vMv1eLjQtekGUgLh76vv 5tA1ng9WQWv6eefwOKjKhkWzo/Vvslv8LPDE6MVMrL7kGXtWcfJNEqhSwbsSY9rI+PsK 31HOOb4JRn04lJxdGs6T0vUETX2pQIpHgAT/vokE7yM2Lsbeq6aqoJ02HMpF3FhBE80y xgGA== 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=HnfurGehE/GdK/MZP7jObd4gR5cVAGYXlFraLL6wzcg=; b=nOKvz8tj5s+2nI1P9BnZHQZCatFWQAyZc/nsD778ey2ZmYYhSCxl7FNhNB0/AtIj3m qgsqMo2x7d9z4/oskCeMXDNnsWFGFWbQl3pX+vIwx//0GtAr2MHdlJwB6fC4ZsJVVKCK G+3PriRiNcdrap48muipAntogeVgdxjSw+UhrU8OTnKHh5j01cCt0T0sdSQKEW6o2IB6 YB3BV1QvguLe0DrsJYAyGtzS1qXp64nPmCvhb7cba0mraNkKCGJ67bzoVENrtkrr6rvx dmYSMQ3RsC6e3SID8DeXkmbjxKXTa13OfTkH/Mhn+hcEAM3TO0idmYhPxuEi9Mybop7i MeHw== 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 t189-v6si6258153pgb.440.2018.06.28.05.46.36; Thu, 28 Jun 2018 05:46: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 S935270AbeF1M2h (ORCPT + 99 others); Thu, 28 Jun 2018 08:28:37 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:56111 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932640AbeF1M2g (ORCPT ); Thu, 28 Jun 2018 08:28:36 -0400 Received: from hsi-kbw-5-158-153-55.hsi19.kabel-badenwuerttemberg.de ([5.158.153.55] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fYW1D-0006lc-Gw; Thu, 28 Jun 2018 14:27:23 +0200 Date: Thu, 28 Jun 2018 14:27:17 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra 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 In-Reply-To: <20180628114615.GF2494@hirez.programming.kicks-ass.net> Message-ID: References: <20180621212518.19914-1-pasha.tatashin@oracle.com> <20180621212518.19914-10-pasha.tatashin@oracle.com> <20180628114615.GF2494@hirez.programming.kicks-ass.net> 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 On Thu, 28 Jun 2018, Peter Zijlstra wrote: > 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. True. > Calibrating against a virtual PIT/HPET/PMTIMER is utterly pointless. It kinda works :) > > 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. As I figured out now that's only part of the picture. We also need to do that past x86_dtb_init() because early_quirks() and the early acpi/sfi/dtb stuff needs to be completed before it makes sense to access hpet. But at that point we also have the PMTIMER info. > 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. Right. Thanks, tglx