From: Alexey Makhalov <amakhalov@vmware.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: <linux-kernel@vger.kernel.org>,
<virtualization@lists.linux-foundation.org>,
"H . Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>,
<mingo@redhat.com>, <tglx@linutronix.de>, <pv-drivers@vmware.com>,
<sdeep@vmware.com>
Subject: Re: [PATCH] x86/vmware: avoid TSC recalibration
Date: Mon, 15 Mar 2021 15:24:43 -0700 [thread overview]
Message-ID: <84F586C5-EECE-4EE5-8988-64D8E0325D7A@vmware.com> (raw)
In-Reply-To: <87im8bildr.fsf@vitty.brq.redhat.com>
Hi Vitaly,
I believe, it is responsibility of each guest code to set X86_FEATURE_TSC_KNOWN_FREQ cap.
Regarding VMware guest, there is a case where vmware_tsc_khz is zero (not provided by hypervisor)
and TSC frequency should be calculated.
Sorry for late response.
Regards,
—Alexey
> On Jan 5, 2021, at 5:06 AM, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> 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
next prev parent reply other threads:[~2021-03-15 22:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 0:47 Alexey Makhalov
2021-01-05 13:06 ` Vitaly Kuznetsov
2021-03-15 22:24 ` Alexey Makhalov [this message]
2021-03-28 19:14 ` [tip: x86/vmware] x86/vmware: Avoid TSC recalibration when frequency is known tip-bot2 for 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=84F586C5-EECE-4EE5-8988-64D8E0325D7A@vmware.com \
--to=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=sdeep@vmware.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.org \
--cc=vkuznets@redhat.com \
/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®