çå: [PATCH][v6] KVM: X86: support APERF/MPERF registers

From: Li,Rongqing
Date: Fri Jun 05 2020 - 00:39:48 EST




> -----éäåä-----
> åää: Xu, Like [mailto:like.xu@xxxxxxxxx]
> åéæé: 2020å6æ5æ 10:32
> æää: Li,Rongqing <lirongqing@xxxxxxxxx>
> æé: linux-kernel@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx;
> hpa@xxxxxxxxx; bp@xxxxxxxxx; mingo@xxxxxxxxxx; tglx@xxxxxxxxxxxxx;
> jmattson@xxxxxxxxxx; wanpengli@xxxxxxxxxxx; vkuznets@xxxxxxxxxx;
> sean.j.christopherson@xxxxxxxxx; pbonzini@xxxxxxxxxx; xiaoyao.li@xxxxxxxxx;
> wei.huang2@xxxxxxx
> äé: 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.

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