diff options
author | Like Xu <like.xu@linux.intel.com> | 2019-10-27 18:52:43 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-11-15 11:44:10 +0100 |
commit | b35e5548b41131eb06de041af2f5fb0890d96f96 (patch) | |
tree | 2ec144c378e67f57b87986d502aa4b7ed0733078 /kernel/locking/rtmutex-debug.h | |
parent | a6da0d77e98e94fa66187a5ce3cf7e11fbf95503 (diff) |
KVM: x86/vPMU: Add lazy mechanism to release perf_event per vPMC
Currently, a host perf_event is created for a vPMC functionality emulation.
It’s unpredictable to determine if a disabled perf_event will be reused.
If they are disabled and are not reused for a considerable period of time,
those obsolete perf_events would increase host context switch overhead that
could have been avoided.
If the guest doesn't WRMSR any of the vPMC's MSRs during an entire vcpu
sched time slice, and its independent enable bit of the vPMC isn't set,
we can predict that the guest has finished the use of this vPMC, and then
do request KVM_REQ_PMU in kvm_arch_sched_in and release those perf_events
in the first call of kvm_pmu_handle_event() after the vcpu is scheduled in.
This lazy mechanism delays the event release time to the beginning of the
next scheduled time slice if vPMC's MSRs aren't changed during this time
slice. If guest comes back to use this vPMC in next time slice, a new perf
event would be re-created via perf_event_create_kernel_counter() as usual.
Suggested-by: Wei Wang <wei.w.wang@intel.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'kernel/locking/rtmutex-debug.h')
0 files changed, 0 insertions, 0 deletions