lkml.org 
[lkml]   [2024]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 32/41] KVM: x86/pmu: Add support for PMU context switch at VM-exit/enter
Date
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

\
 
 \ /
  Last update: 2024-05-27 14:34    [W:0.953 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site