KVM: x86/pmu: Apply event filter mechanism to emulated instructions
PATCH 1/1 KVM: x86/pmu: Apply event filter mechanism to emulated instructions
From: Like Xu <[email protected]>
The check_pmu_event_filter() prevents the perf_event from being created and stops the associated counters from increasing, the same check should also be applied to counter increases caused by emulated instructions. Otherwise this filter mechanism cannot be considered to be in effect.
--- arch/x86/kvm/pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/pmu.c +2 -1
@@ -684,7 +684,8 @@ void kvm_pmu_trigger_event(struct kvm_vcpu *vcpu, u64 perf_hw_id)for_each_set_bit (i, pmu->all_valid_pmc_idx,X86_PMC_IDX_MAX ) { pmc =static_call (kvm_x86_pmu_pmc_idx_to_pmc)(pmu, i); -if (!pmc || !pmc_is_enabled (pmc) || !pmc_speculative_in_use (pmc)) +if (!pmc || !pmc_is_enabled (pmc) || !pmc_speculative_in_use (pmc) || + !check_pmu_event_filter (pmc))continue ;/* Ignore checks for edge detect, pin control, invert and CMASK bits */
base-commit: 13738a3647368f7f600b30d241779bcd2a3ebbfd
Signature · 1 line
2.39.2
Sean Christopherson
maintainerQuoted 8 lines · Like Xu
From: Like Xu <[email protected]>
The
check_pmu_event_filter()prevents theperf_eventfrom being created and stops the associated counters from increasing, the same check should also be applied to counter increases caused by emulated instructions. Otherwise this filter mechanism cannot be considered to be in effect.Reported-by Jinrong Liang <[email protected]>
Already posted by Aaron[*], but I don't think there's been a follow-up. Aaron?
Quoted 9 lines · Sean Christopherson
Quoted 7 lines · Like Xu
From: Like Xu <[email protected]>
The
check_pmu_event_filter()prevents theperf_eventfrom being created and stops the associated counters from increasing, the same check should also be applied to counter increases caused by emulated instructions. Otherwise this filter mechanism cannot be considered to be in effect.
Quoted 5 lines
Quoted 1 line
Reported-by Jinrong Liang <[email protected]>Already posted by Aaron[*], but I don't think there's been a follow-up. Aaron?
There hasn't been a follow-up yet. I'll try to get one out in the next week or so.