Re: [PATCH] KVM: x86: Adjust counter sample period after a wrmsr

From: Like Xu
Date: Tue Feb 25 2020 - 22:04:08 EST


On 2020/2/25 8:08, Eric Hankland wrote:
Hi Like -

Thanks for the feedback - is your recommendation to do the read and
period change at the same time and only take the lock once or is there
another way around this while still handling writes correctly?

For non-running counters(the most common situation), we have too many
chances to reflect their new periods. In this case, calling
perf_event_period() in the trap of counter msr is redundant and burdensome.

A better way is to check if this counter is running via
pmc_speculative_in_use (), and if so,
just trigger kvm_make_request(KVM_REQ_PMU, pmc->vcpu).

Thanks,
Like Xu


Eric