On Wed, Nov 20, 2024, Dapeng Mi wrote: > On 11/20/2024 2:24 AM, Sean Christopherson wrote: > >> + pmu->nr_arch_gp_counters == kvm_pmu_cap.num_counters_gp && > >> + pmu->nr_arch_fixed_counters == kvm_pmu_cap.num_counters_fixed) > >> + msr_intercept = false; > >> + else > >> + msr_intercept = true; > > This reinforces that checking PERF_CAPABILITIES for PERF_METRICS is likely doomed > > to fail, because doesn't PERF_GLOBAL_CTRL need to be intercepted, strictly speaking, > > to prevent setting EN_PERF_METRICS? > > Sean, do you mean we need to check if guest supports PERF_METRICS here? If > not, we need to set global MSRs to interception and then avoid guest tries > to enable guest PERF_METRICS, right? Yep, exactly. And that the "nr_arch_fixed_counter == num_counters_fixed" takes care of things here as well.