virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Alexey Makhalov <amakhalov@vmware.com>
Cc: pv-drivers@vmware.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, mingo@redhat.com,
	bp@alien8.de, hpa@zytor.com, tglx@linutronix.de
Subject: Re: [PATCH] x86/vmware: avoid TSC recalibration
Date: Tue, 05 Jan 2021 14:06:08 +0100	[thread overview]
Message-ID: <87im8bildr.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20210105004752.131069-1-amakhalov@vmware.com>

Alexey Makhalov <amakhalov@vmware.com> writes:

> When TSC frequency is known (retrieved from hypervisor), we should skip
> TSC refined calibration by setting X86_FEATURE_TSC_KNOWN_FREQ.
>
> Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
> ---
>  arch/x86/kernel/cpu/vmware.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
> index c6ede3b3d302..83164110ccc5 100644
> --- a/arch/x86/kernel/cpu/vmware.c
> +++ b/arch/x86/kernel/cpu/vmware.c
> @@ -378,6 +378,8 @@ static void __init vmware_set_capabilities(void)
>  {
>  	setup_force_cpu_cap(X86_FEATURE_CONSTANT_TSC);
>  	setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
> +	if (vmware_tsc_khz)
> +		setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
>  	if (vmware_hypercall_mode == CPUID_VMWARE_FEATURES_ECX_VMCALL)
>  		setup_force_cpu_cap(X86_FEATURE_VMCALL);
>  	else if (vmware_hypercall_mode == CPUID_VMWARE_FEATURES_ECX_VMMCALL)

The same trick is being used in Xen/Jailhouse/KVM code already and
Hyper-V overwrites x86_platform.calibrate_tsc/x86_platform.calibrate_cpu
hooks to basically achive the same goal. Should we maybe introduce a
flag in 'struct hypervisor_x86' or something like that to unify all
this?

Just a suggestion.

-- 
Vitaly

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-01-05 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  0:47 [PATCH] x86/vmware: avoid TSC recalibration Alexey Makhalov
2021-01-05 13:06 ` Vitaly Kuznetsov [this message]
2021-03-15 22:24   ` 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=87im8bildr.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=amakhalov@vmware.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --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 \
    /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;
as well as URLs for NNTP newsgroup(s).