Messages in this thread Patch in this message | | | From | Like Xu <> | Subject | [PATCH v3 11/17] KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter | Date | Mon, 4 Jan 2021 21:15:36 +0800 |
| |
The PEBS-PDIR facility on Ice Lake server is supported on IA31_FIXED0 only. If the guest configures counter 32 and PEBS is enabled, the PEBS-PDIR facility is supposed to be used, in which case KVM adjusts attr.precise_ip to 3 and request host perf to assign the exactly requested counter or fail.
The cpu model check is also required since some platforms may place the PEBS-PDIR facility in another counter index.
Signed-off-by: Like Xu <like.xu@linux.intel.com> --- arch/x86/kvm/pmu.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 2e81c50323e2..67c20ab81991 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -144,6 +144,8 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, * in the PEBS record is calibrated on the guest side. */ attr.precise_ip = 1; + if (x86_match_cpu(vmx_icl_pebs_cpu) && pmc->idx == 32) + attr.precise_ip = 3; } event = perf_event_create_kernel_counter(&attr, -1, current, -- 2.29.2
| |