lkml.org 
[lkml]   [2024]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v19 040/130] KVM: TDX: Make pmu_intel.c ignore guest TD case
    On Wed, Mar 20, 2024 at 03:01:48PM +0800,
    Chao Gao <chao.gao@intel.com> wrote:

    > On Mon, Feb 26, 2024 at 12:25:42AM -0800, isaku.yamahata@intel.com wrote:
    > >From: Isaku Yamahata <isaku.yamahata@intel.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?

    Do you mean sprinkling "if (tdx) return"? It's easy. Just add it to all hooks
    in kvm_pmu_ops.

    I chose this approach because we'll soon support vPMU support. For simplicity,
    will switch to sprinkle "if (tdx) return".

    > >+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?

    No. Will delete it. It crept in during rebase.
    --
    Isaku Yamahata <isaku.yamahata@intel.com>

    \
     
     \ /
      Last update: 2024-05-27 15:58    [W:6.624 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site