Messages in this thread Patch in this message | | | From | Xiong Zhang <> | Subject | [RFC PATCH 32/41] KVM: x86/pmu: Add support for PMU context switch at VM-exit/enter | Date | Fri, 26 Jan 2024 16:54:35 +0800 |
| |
From: Xiong Zhang <xiong.y.zhang@intel.com>
Add correct PMU context switch at VM_entry/exit boundary.
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> --- arch/x86/kvm/x86.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 074452aa700d..fe7da1a16c3b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10898,6 +10898,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) set_debugreg(0, 7); } + if (is_passthrough_pmu_enabled(vcpu)) + kvm_pmu_restore_pmu_context(vcpu); + guest_timing_enter_irqoff(); for (;;) { @@ -10926,6 +10929,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) ++vcpu->stat.exits; } + if (is_passthrough_pmu_enabled(vcpu)) + kvm_pmu_save_pmu_context(vcpu); + /* * Do this here before restoring debug registers on the host. And * since we do this before handling the vmexit, a DR access vmexit -- 2.34.1
| |