[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211204104600.GT16608@worktop.programming.kicks-ass.net>
Date: Sat, 4 Dec 2021 11:46:00 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: zhenwei pi <pizhenwei@...edance.com>
Cc: tglx@...utronix.de, pbonzini@...hat.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: Re: [PATCH v2 1/2] x86/cpu: Introduce x86_get_cpufreq_khz()
On Fri, Dec 03, 2021 at 03:34:04PM +0800, zhenwei pi wrote:
> A KVM guest overwrites the '.calibrate_tsc' and '.calibrate_cpu' if kvmclock
> is supported:
>
> in function kvmclock_init(void) (linux/arch/x86/kernel/kvmclock.c)
> ...
> x86_platform.calibrate_tsc = kvm_get_tsc_khz;
> x86_platform.calibrate_cpu = kvm_get_tsc_khz;
> ...
>
> And kvm_get_tsc_khz reads PV data from host side. Before guest reads this,
> KVM should writes the frequency into the PV data structure.
>
> And the problem is that KVM gets tsc_khz directly without aperf/mperf
> detection. So user may gets different frequency(cat /proc/cpuinfo) from
> guest & host.
>
> Or is that possible to export function 'aperfmperf_get_khz'?
TSC frequency and aperf/mperf are unrelated. You're trying to make apple
juice with carrots.
Powered by blists - more mailing lists