[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <f7d395b60eb7e6dcc149ba39d86f9296bd81b0ac.1658913543.git.houwenlong.hwl@antgroup.com>
Date: Thu, 28 Jul 2022 16:25:05 +0800
From: "Hou Wenlong" <houwenlong.hwl@...group.com>
To: kvm@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] KVM: x86: Add missing trace points for RDMSR/WRMSR in emulator path
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@...group.com>
---
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
Powered by blists - more mailing lists