[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210512084446.342526-6-like.xu@linux.intel.com>
Date: Wed, 12 May 2021 16:44:46 +0800
From: Like Xu <like.xu@...ux.intel.com>
To: Paolo Bonzini <pbonzini@...hat.com>, peterz@...radead.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, weijiang.yang@...el.com,
eranian@...gle.com, wei.w.wang@...el.com, kvm@...r.kernel.org,
x86@...nel.org, linux-kernel@...r.kernel.org,
Like Xu <like.xu@...ux.intel.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <andi.kleen@...el.com>
Subject: [PATCH v3 5/5] KVM: x86/pmu: Expose PEBS-via-PT in the KVM supported capabilities
The hypervisor userspace can dis/enable it via the MSR-based feature
"MSR_IA32_PERF_CAPABILITIES [bit 16]". If guest also has basic PT support,
it can output the PEBS records to the PT buffer.
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andi Kleen <andi.kleen@...el.com>
Signed-off-by: Like Xu <like.xu@...ux.intel.com>
---
arch/x86/kvm/vmx/capabilities.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
index fd8c9822db9e..e04b50174dd5 100644
--- a/arch/x86/kvm/vmx/capabilities.h
+++ b/arch/x86/kvm/vmx/capabilities.h
@@ -398,8 +398,11 @@ static inline u64 vmx_get_perf_capabilities(void)
perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
- if (vmx_pebs_supported())
+ if (vmx_pebs_supported()) {
perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
+ if (vmx_pt_mode_is_host_guest())
+ perf_cap |= host_perf_cap & PERF_CAP_PEBS_OUTPUT_PT;
+ }
return perf_cap;
}
--
2.31.1
Powered by blists - more mailing lists