From: Alexey Makhalov <amakhalov@vmware.com>
To: <corbet@lwn.net>, <akataria@vmware.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <hpa@zytor.com>, <x86@kernel.org>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<virtualization@lists.linux-foundation.org>,
<pv-drivers@vmware.com>, Alexey Makhalov <amakhalov@vmware.com>
Subject: [RESEND PATCH 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu()
Date: Thu, 27 Oct 2016 12:44:52 -0700 [thread overview]
Message-ID: <20161027194454.9729-1-amakhalov@vmware.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1610262247030.5013@nanos>
After aa297292d708, there are separate native calibrations for cpu_khz and
tsc_khz. The code sets x86_platform.calibrate_cpu to native_calibrate_cpu()
which looks in cpuid leaf 0x16 or msrs for the cpu frequency. Since we keep
the tsc_khz constant (even after vmotion), the cpu_khz and tsc_khz may
start diverging.
tsc_init() now does
cpu_khz = x86_platform.calibrate_cpu();
tsc_khz = x86_platform.calibrate_tsc();
if (tsc_khz == 0)
tsc_khz = cpu_khz;
else if (abs(cpu_khz - tsc_khz) * 10 > tsc_khz)
cpu_khz = tsc_khz;
We want the cpu_khz and tsc_khz to be sync even if they diverge less then
10%.
This patch resolves this issue by setting x86_platform.calibrate_cpu to
vmware_get_tsc_khz().
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Acked-by: Alok N Kataria <akataria@vmware.com>
---
arch/x86/kernel/cpu/vmware.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 4e34da4b..480790f 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -83,6 +83,7 @@ static void __init vmware_platform_setup(void)
vmware_tsc_khz = tsc_khz;
x86_platform.calibrate_tsc = vmware_get_tsc_khz;
+ x86_platform.calibrate_cpu = vmware_get_tsc_khz;
#ifdef CONFIG_X86_LOCAL_APIC
/* Skip lapic calibration since we know the bus frequency. */
--
2.10.1
next prev parent reply other threads:[~2016-10-27 19:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 5:20 [PATCH 0/3] x86/vmware guest improvements Alexey Makhalov
2016-10-26 5:20 ` [PATCH 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu() Alexey Makhalov
2016-10-26 5:26 ` [PATCH 2/3] x86/vmware: Add basic paravirt ops support Alexey Makhalov
2016-10-26 20:47 ` Tim Mann
2016-10-26 20:47 ` Thomas Gleixner
2016-10-27 19:44 ` Alexey Makhalov [this message]
2016-10-27 19:44 ` [RESEND PATCH " Alexey Makhalov
2016-10-27 19:44 ` [RESEND PATCH 3/3] x86/vmware: Add paravirt sched clock Alexey Makhalov
2016-10-27 22:10 ` Thomas Gleixner
2016-10-27 21:44 ` [RESEND PATCH 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu() Thomas Gleixner
2016-10-28 7:54 ` [PATCH v3 0/3] x86/vmware guest improvements Alexey Makhalov
2016-10-28 7:54 ` [PATCH v3 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu() Alexey Makhalov
2016-10-31 1:17 ` [tip:x86/platform] " tip-bot for Alexey Makhalov
2016-10-28 7:54 ` [PATCH v3 2/3] x86/vmware: Add basic paravirt ops support Alexey Makhalov
2016-10-31 1:17 ` [tip:x86/platform] " tip-bot for Alexey Makhalov
2016-10-28 7:54 ` [PATCH v3 3/3] x86/vmware: Add paravirt sched clock Alexey Makhalov
2016-10-31 1:18 ` [tip:x86/platform] " tip-bot for Alexey Makhalov
2016-10-26 5:26 ` [PATCH 3/3] " Alexey Makhalov
2016-10-26 10:18 ` Thomas Gleixner
2016-10-26 16:51 ` [PATCH v2 " Alexey Makhalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161027194454.9729-1-amakhalov@vmware.com \
--to=amakhalov@vmware.com \
--cc=akataria@vmware.com \
--cc=corbet@lwn.net \
--cc=hpa@zytor.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pv-drivers@vmware.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®