çå: [PATCH][v6] KVM: X86: support APERF/MPERF registers
From: Li,Rongqing
Date: Sat Jun 06 2020 - 07:53:56 EST
> -----éäåä-----
> åää: Paolo Bonzini [mailto:pbonzini@xxxxxxxxxx]
> åéæé: 2020å6æ6æ 1:22
> æää: Jim Mattson <jmattson@xxxxxxxxxx>
> æé: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>; Li,Rongqing <lirongqing@xxxxxxxxx>;
> LKML <linux-kernel@xxxxxxxxxxxxxxx>; kvm list <kvm@xxxxxxxxxxxxxxx>; the
> arch/x86 maintainers <x86@xxxxxxxxxx>; H . Peter Anvin <hpa@xxxxxxxxx>;
> Borislav Petkov <bp@xxxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>; Thomas
> Gleixner <tglx@xxxxxxxxxxxxx>; Wanpeng Li <wanpengli@xxxxxxxxxxx>; Vitaly
> Kuznetsov <vkuznets@xxxxxxxxxx>; Sean Christopherson
> <sean.j.christopherson@xxxxxxxxx>; wei.huang2@xxxxxxx
> äé: Re: [PATCH][v6] KVM: X86: support APERF/MPERF registers
>
> On 05/06/20 19:16, Jim Mattson wrote:
> >>>> @@ -4930,6 +4939,11 @@ int kvm_vm_ioctl_enable_cap(struct kvm
> *kvm,
> >>>> kvm->arch.exception_payload_enabled = cap->args[0];
> >>>> r = 0;
> >>>> break;
> >>>> + case KVM_CAP_APERFMPERF:
> >>>> + kvm->arch.aperfmperf_mode =
> >>>> + boot_cpu_has(X86_FEATURE_APERFMPERF) ?
> cap->args[0] :
> >>>> + 0;
> >>> Shouldn't check whether cap->args[0] is a valid value?
> >> Yes, only valid values should be allowed.
> >>
> >> Also, it should fail with -EINVAL if the host does not have
> >> X86_FEATURE_APERFMPERF.
> > Should enabling/disabling this capability be disallowed once vCPUs
> > have been created?
> >
>
> That's a good idea, yes.
>
> Paolo
Thank you all, I will send a new version
-Li