From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754777AbcJEJtj (ORCPT ); Wed, 5 Oct 2016 05:49:39 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42806 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754625AbcJEJth (ORCPT ); Wed, 5 Oct 2016 05:49:37 -0400 Date: Wed, 5 Oct 2016 02:49:28 -0700 From: tip-bot for Renat Valiullin Message-ID: Cc: hpa@zytor.com, akataria@vmware.com, rvaliullin@vmware.com, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, akataria@vmware.com, rvaliullin@vmware.com In-Reply-To: <20161004201148.GA1421@uu64vm> References: <20161004201148.GA1421@uu64vm> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/vmware: Skip lapic calibration on VMware Git-Commit-ID: b91688f528fe96e09d17e6d87c1b2805eb0c445e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b91688f528fe96e09d17e6d87c1b2805eb0c445e Gitweb: http://git.kernel.org/tip/b91688f528fe96e09d17e6d87c1b2805eb0c445e Author: Renat Valiullin AuthorDate: Tue, 4 Oct 2016 13:11:48 -0700 Committer: Thomas Gleixner CommitDate: Wed, 5 Oct 2016 11:43:30 +0200 x86/vmware: Skip lapic calibration on VMware In a virtualized environment the APIC timer calibration can go wrong when the host is overcommitted or the guest is running nested. This results in the APIC timers operating at an incorrect frequency. Since VMware supports a mechanism to retrieve the local APIC frequency we can ask the hypervisor for it and skip the APIC calibration loop. Signed-off-by: Renat Valiullin Acked-by: Alok N Kataria Cc: virtualization@lists.linux-foundation.org Link: http://lkml.kernel.org/r/20161004201148.GA1421@uu64vm Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/vmware.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index 1ff0598..8116057 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c @@ -27,6 +27,7 @@ #include #include #include +#include #define CPUID_VMWARE_INFO_LEAF 0x40000000 #define VMWARE_HYPERVISOR_MAGIC 0x564D5868 @@ -82,10 +83,17 @@ static void __init vmware_platform_setup(void) VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); - if (ebx != UINT_MAX) + if (ebx != UINT_MAX) { x86_platform.calibrate_tsc = vmware_get_tsc_khz; - else +#ifdef CONFIG_X86_LOCAL_APIC + /* Skip lapic calibration since we know the bus frequency. */ + lapic_timer_frequency = ecx / HZ; + pr_info("Host bus clock speed read from hypervisor : %u Hz\n", + ecx); +#endif + } else { pr_warn("Failed to get TSC freq from the hypervisor\n"); + } } /*