[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3623400-194f-694e-5d33-bc6b1573913f@intel.com>
Date: Sun, 25 Dec 2022 12:27:21 +0800
From: "Yang, Weijiang" <weijiang.yang@...el.com>
To: Like Xu <like.xu.linux@...il.com>
CC: <kan.liang@...ux.intel.com>, <wei.w.wang@...el.com>,
<seanjc@...gle.com>, <pbonzini@...hat.com>, <jmattson@...gle.com>,
<kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 06/15] KVM: vmx/pmu: Emulate MSR_ARCH_LBR_CTL for guest
Arch LBR
On 12/22/2022 7:09 PM, Like Xu wrote:
> On 25/11/2022 12:05 pm, Yang Weijiang wrote:
>> static int intel_pmu_get_msr(struct kvm_vcpu *vcpu, struct msr_data
>> *msr_info)
>> {
>> struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
>> @@ -377,6 +402,14 @@ static int intel_pmu_get_msr(struct kvm_vcpu
>> *vcpu, struct msr_data *msr_info)
>> case MSR_ARCH_LBR_DEPTH:
>> msr_info->data = lbr_desc->records.nr;
>> return 0;
>> + case MSR_ARCH_LBR_CTL:
>> + if (!kvm_cpu_cap_has(X86_FEATURE_ARCH_LBR)) {
>> + WARN_ON_ONCE(!msr_info->host_initiated);
>
> Why we need this warning even in the format of WARN_ON_ONCE() ?
> And why not for MSR_ARCH_LBR_DEPTH msr ?
IMO, this is just to give some informative message. Not necessary for every
arch-lbr MSRs as MSR_ARCH_LBR_CTL is the master control msr.
>
>> + msr_info->data = 0;
>> + } else {
>> + msr_info->data = vmcs_read64(GUEST_IA32_LBR_CTL);
>> + }
>> + return 0;
Powered by blists - more mailing lists