public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: tglx@linutronix.de, pbonzini@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: Re: [PATCH v2 1/2] x86/cpu: Introduce x86_get_cpufreq_khz()
Date: Sat, 4 Dec 2021 11:46:00 +0100	[thread overview]
Message-ID: <20211204104600.GT16608@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <947de021-df91-9219-7378-8addc6f66612@bytedance.com>

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.

  reply	other threads:[~2021-12-04 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  2:46 [PATCH v2 0/2] Introduce x86_get_cpufreq_khz() zhenwei pi
2021-12-01  2:46 ` [PATCH v2 1/2] x86/cpu: " zhenwei pi
2021-12-02 22:25   ` Peter Zijlstra
2021-12-03  7:34     ` zhenwei pi
2021-12-04 10:46       ` Peter Zijlstra [this message]
2021-12-01  2:46 ` [PATCH v2 2/2] KVM: x86: use x86_get_freq to get freq for kvmclock zhenwei pi
2021-12-02  2:48   ` Thomas Gleixner
2021-12-02  5:26     ` zhenwei pi
2021-12-02  7:19       ` Maxim Levitsky
2021-12-02 22:45         ` Peter Zijlstra
2021-12-03  7:53           ` Maxim Levitsky
2021-12-04 10:44             ` Peter Zijlstra

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=20211204104600.GT16608@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pizhenwei@bytedance.com \
    --cc=tglx@linutronix.de \
    --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