[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZfqJ3LkYrwR/qpsX@chao-email>
Date: Wed, 20 Mar 2024 15:01:48 +0800
From: Chao Gao <chao.gao@...el.com>
To: <isaku.yamahata@...el.com>
CC: <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<isaku.yamahata@...il.com>, Paolo Bonzini <pbonzini@...hat.com>,
<erdemaktas@...gle.com>, Sean Christopherson <seanjc@...gle.com>, Sagi Shahar
<sagis@...gle.com>, Kai Huang <kai.huang@...el.com>, <chen.bo@...el.com>,
<hang.yuan@...el.com>, <tina.zhang@...el.com>
Subject: Re: [PATCH v19 040/130] KVM: TDX: Make pmu_intel.c ignore guest TD
case
On Mon, Feb 26, 2024 at 12:25:42AM -0800, isaku.yamahata@...el.com wrote:
>From: Isaku Yamahata <isaku.yamahata@...el.com>
>
>Because TDX KVM doesn't support PMU yet (it's future work of TDX KVM
>support as another patch series) and pmu_intel.c touches vmx specific
>structure in vcpu initialization, as workaround add dummy structure to
>struct vcpu_tdx and pmu_intel.c can ignore TDX case.
Can we instead factor pmu_intel.c to avoid corrupting memory? how hard would it
be?
>+bool intel_pmu_lbr_is_enabled(struct kvm_vcpu *vcpu)
>+{
>+ struct x86_pmu_lbr *lbr = vcpu_to_lbr_records(vcpu);
>+
>+ if (is_td_vcpu(vcpu))
>+ return false;
>+
>+ return lbr->nr && (vcpu_get_perf_capabilities(vcpu) & PMU_CAP_LBR_FMT);
The check about vcpu's perf capabilities is new. is it necessary?
>-static inline bool intel_pmu_lbr_is_enabled(struct kvm_vcpu *vcpu)
>-{
>- return !!vcpu_to_lbr_records(vcpu)->nr;
>-}
>-
Powered by blists - more mailing lists