[PATCH 2/2] KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the RDMSR/WRMSR emulation uses a sepearte emualtor interface,
the trace points for RDMSR/WRMSR can be added in emulator path like
normal path.

Signed-off-by: Hou Wenlong <houwenlong.hwl@xxxxxxxxxxxx>
---
 arch/x86/kvm/x86.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8df89b9c212f..6e45b20ce9a4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7908,12 +7908,16 @@ static int emulator_get_msr_with_filter(struct x86_emulate_ctxt *ctxt,
 	int r;
 
 	r = kvm_get_msr_with_filter(vcpu, msr_index, pdata);
-	if (r) {
+	if (!r) {
+		trace_kvm_msr_read(msr_index, *pdata);
+	} else {
 		if (kvm_msr_user_space(vcpu, msr_index, KVM_EXIT_X86_RDMSR, 0,
-				       complete_emulated_rdmsr, r))
+				       complete_emulated_rdmsr, r)) {
 			r = X86EMUL_IO_NEEDED;
-		else
+		} else {
+			trace_kvm_msr_read_ex(msr_index);
 			r = X86EMUL_UNHANDLEABLE;
+		}
 	}
 
 	return r;
@@ -7926,12 +7930,16 @@ static int emulator_set_msr_with_filter(struct x86_emulate_ctxt *ctxt,
 	int r;
 
 	r = kvm_set_msr_with_filter(vcpu, msr_index, data);
-	if (r > 0) {
+	if (!r) {
+		trace_kvm_msr_write(msr_index, data);
+	} else if (r > 0) {
 		if (kvm_msr_user_space(vcpu, msr_index, KVM_EXIT_X86_WRMSR, data,
-				       complete_emulated_msr_access, r))
+				       complete_emulated_msr_access, r)) {
 			r = X86EMUL_IO_NEEDED;
-		else
+		} else {
+			trace_kvm_msr_write_ex(msr_index, data);
 			r = X86EMUL_UNHANDLEABLE;
+		}
 	}
 
 	return r;
-- 
2.31.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux