lkml.org 
[lkml]   [2021]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/2] KVM: x86: use x86_get_freq to get freq for kvmclock
Date
On Wed, Dec 01 2021 at 10:46, zhenwei pi wrote:
> If the host side supports APERF&MPERF feature, the guest side may get
> mismatched frequency.
>
> KVM uses x86_get_cpufreq_khz() to get the same frequency for guest side.
>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
> arch/x86/kvm/x86.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5a403d92833f..125ed3c8b21a 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8305,10 +8305,8 @@ static void tsc_khz_changed(void *data)
>
> if (data)
> khz = freq->new;
> - else if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
> - khz = cpufreq_quick_get(raw_smp_processor_id());
> if (!khz)
> - khz = tsc_khz;
> + khz = x86_get_cpufreq_khz(raw_smp_processor_id());

my brain compiler tells me that this is broken.

\
 
 \ /
  Last update: 2021-12-02 03:49    [W:0.100 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site