From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755549AbcI2Rwc (ORCPT ); Thu, 29 Sep 2016 13:52:32 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:13537 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbcI2RwX (ORCPT ); Thu, 29 Sep 2016 13:52:23 -0400 From: Renat Valiullin To: Alok Kataria , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "x86@kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH] x86/vmware: Skip lapic calibration on VMware. Thread-Topic: [PATCH] x86/vmware: Skip lapic calibration on VMware. Thread-Index: AQHSGnoZoFDaPc4F9UOUWPVLnXsHhw== Date: Thu, 29 Sep 2016 17:51:26 +0000 Message-ID: <9FDEBA6F-7CB2-4637-BFC7-EA336B97EDAD@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rvaliullin@vmware.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [67.148.5.81] x-ms-office365-filtering-correlation-id: f7dbd8d2-0e6c-4430-7c47-08d3e8913c73 x-microsoft-exchange-diagnostics: 1;BN3PR0501MB1555;20:cB5wNt882msQ1I0bkCTvGInAqhuD0LcxSHNkcEn32ebHSyCbdUn+IDXJzxppnzK3W6S0E3EtCFSlgZp3OgzHSAgO31SV/9MrRHTIeqE0XNpETp+KlEkNsEC+0N8owbA4mRCfpMIOQ6ZMsJXX+cPG2cWt7g0cSWLAO56yom1vJ6U= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0501MB1555; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(61668805478150); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:BN3PR0501MB1555;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0501MB1555; x-forefront-prvs: 00808B16F3 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(199003)(189002)(586003)(82746002)(2900100001)(107886002)(11100500001)(66066001)(19580395003)(189998001)(97736004)(77096005)(5001770100001)(3660700001)(2501003)(3846002)(6116002)(3280700002)(83716003)(87936001)(36756003)(5002640100001)(102836003)(68736007)(2906002)(19580405001)(7846002)(8676002)(106356001)(81156014)(10400500002)(101416001)(105586002)(8936002)(81166006)(99286002)(5660300001)(106116001)(50986999)(54356999)(305945005)(92566002)(2201001)(33656002)(86362001)(229853001)(7736002)(122556002)(104396002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR0501MB1555;H:BN3PR0501MB1553.namprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <2B172A673B2F23408743AFCF49625366@namprd05.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2016 17:51:26.8232 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0501MB1555 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u8THqc7L023167 In virtualized environment the APIC timer calibration could go wrong when the host is overcommitted or the guest is running nested, this would result 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 this APIC calibration loop. Signed-off-by: Renat Valiullin Acked-by: Alok N Kataria --- arch/x86/kernel/cpu/vmware.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index 1ff0598..6316240 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,9 +83,15 @@ 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"); } -- 2.7.4