public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Like Xu <like.xu@linux.intel.com>
To: "Li,Rongqing" <lirongqing@baidu.com>,
	"like.xu@intel.com" <like.xu@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>, "bp@alien8.de" <bp@alien8.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"jmattson@google.com" <jmattson@google.com>,
	"wanpengli@tencent.com" <wanpengli@tencent.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"sean.j.christopherson@intel.com"
	<sean.j.christopherson@intel.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"xiaoyao.li@intel.com" <xiaoyao.li@intel.com>,
	"wei.huang2@amd.com" <wei.huang2@amd.com>
Subject: Re: 答复: [PATCH][v6] KVM: X86: support APERF/MPERF registers
Date: Fri, 5 Jun 2020 13:28:30 +0800	[thread overview]
Message-ID: <3a88bd63-ff51-ad70-d92e-893660c63bca@linux.intel.com> (raw)
In-Reply-To: <c21c6ffa19b6483ea57feab3f98f279c@baidu.com>

On 2020/6/5 12:23, Li,Rongqing wrote:
> 
> 
>> -----邮件原件-----
>> 发件人: Xu, Like [mailto:like.xu@intel.com]
>> 发送时间: 2020年6月5日 10:32
>> 收件人: Li,Rongqing <lirongqing@baidu.com>
>> 抄送: linux-kernel@vger.kernel.org; kvm@vger.kernel.org; x86@kernel.org;
>> hpa@zytor.com; bp@alien8.de; mingo@redhat.com; tglx@linutronix.de;
>> jmattson@google.com; wanpengli@tencent.com; vkuznets@redhat.com;
>> sean.j.christopherson@intel.com; pbonzini@redhat.com; xiaoyao.li@intel.com;
>> wei.huang2@amd.com
>> 主题: Re: [PATCH][v6] KVM: X86: support APERF/MPERF registers
>>
>> Hi RongQing,
>>
>> On 2020/6/5 9:44, Li RongQing wrote:
>>> Guest kernel reports a fixed cpu frequency in /proc/cpuinfo, this is
>>> confused to user when turbo is enable, and aperf/mperf can be used to
>>> show current cpu frequency after 7d5905dc14a
>>> "(x86 / CPU: Always show current CPU frequency in /proc/cpuinfo)"
>>> so guest should support aperf/mperf capability
>>>
>>> This patch implements aperf/mperf by three mode: none, software
>>> emulation, and pass-through
>>>
>>> None: default mode, guest does not support aperf/mperf
>> s/None/Note
>>>
>>> Software emulation: the period of aperf/mperf in guest mode are
>>> accumulated as emulated value
>>>
>>> Pass-though: it is only suitable for KVM_HINTS_REALTIME, Because that
>>> hint guarantees we have a 1:1 vCPU:CPU binding and guaranteed no
>>> over-commit.
>> The flag "KVM_HINTS_REALTIME 0" (in the Documentation/virt/kvm/cpuid.rst)
>> is claimed as "guest checks this feature bit to determine that vCPUs are never
>> preempted for an unlimited time allowing optimizations".
>>
>> I couldn't see its relationship with "1:1 vCPU: pCPU binding".
>> The patch doesn't check this flag as well for your pass-through purpose.
>>
>> Thanks,
>> Like Xu
> 
> 
> I think this is user space jobs to bind HINT_REALTIME and mperf passthrough, KVM just do what userspace wants.
> 

That's fine for user space to bind HINT_REALTIME and mperf passthrough,
But I was asking why HINT_REALTIME means "1:1 vCPU: pCPU binding".

As you said, "Pass-though: it is only suitable for KVM_HINTS_REALTIME",
which means, KVM needs to make sure the kvm->arch.aperfmperf_mode value
could "only" be set to KVM_APERFMPERF_PT when the check
kvm_para_has_hint(KVM_HINTS_REALTIME) is passed.

Specifically, the KVM_HINTS_REALTIME is a per-kvm capability
while the kvm_aperfmperf_mode is a per-vm capability. It's unresolved.

KVM doesn't always do what userspace wants especially
you're trying to expose some features about
power and thermal management in the virtualization context.

> and this gives user space a possibility, guest has passthrough mperfaperf without HINT_REALTIME, guest can get coarse cpu frequency without performance effect if guest can endure error frequency occasionally
> 


> 
> -Li
> 


  reply	other threads:[~2020-06-05  5:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05  1:44 [PATCH][v6] KVM: X86: support APERF/MPERF registers Li RongQing
2020-06-05  2:32 ` Xu, Like
2020-06-05  4:23   ` 答复: " Li,Rongqing
2020-06-05  5:28     ` Like Xu [this message]
2020-06-05  9:41       ` 答复: " Li,Rongqing
2020-06-05 11:15         ` Paolo Bonzini
2020-06-05  5:00 ` Xiaoyao Li
2020-06-05  6:35   ` Paolo Bonzini
2020-06-05 17:16     ` Jim Mattson
2020-06-05 17:22       ` Paolo Bonzini
2020-06-06 11:53         ` 答复: " Li,Rongqing

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=3a88bd63-ff51-ad70-d92e-893660c63bca@linux.intel.com \
    --to=like.xu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=wei.huang2@amd.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.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