From: Oliver Upton <oupton@google.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Oliver Upton" <oupton@google.com>
Subject: [PATCH] KVM: nVMX: Use SET_MSR_OR_WARN() to simplify failure logging
Date: Thu, 28 Nov 2019 01:46:09 -0800 [thread overview]
Message-ID: <20191128094609.22161-1-oupton@google.com> (raw)
commit 458151f65b4d ("KVM: nVMX: Use kvm_set_msr to load
IA32_PERF_GLOBAL_CTRL on VM-Exit") introduced the SET_MSR_OR_WARN()
macro to WARN when kvm_set_msr() fails. Replace other occurences of this
pattern with the macro to remove the need of printing on failure.
Signed-off-by: Oliver Upton <oupton@google.com>
---
arch/x86/kvm/vmx/nested.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 4aea7d304beb..f7dbaac7cb90 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -928,12 +928,8 @@ static u32 nested_vmx_load_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count)
__func__, i, e.index, e.reserved);
goto fail;
}
- if (kvm_set_msr(vcpu, e.index, e.value)) {
- pr_debug_ratelimited(
- "%s cannot write MSR (%u, 0x%x, 0x%llx)\n",
- __func__, i, e.index, e.value);
+ if (SET_MSR_OR_WARN(vcpu, e.index, e.value))
goto fail;
- }
}
return 0;
fail:
@@ -4175,12 +4171,8 @@ static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu)
goto vmabort;
}
- if (kvm_set_msr(vcpu, h.index, h.value)) {
- pr_debug_ratelimited(
- "%s WRMSR failed (%u, 0x%x, 0x%llx)\n",
- __func__, j, h.index, h.value);
+ if (SET_MSR_OR_WARN(vcpu, h.index, h.value))
goto vmabort;
- }
}
}
--
2.24.0.432.g9d3f5f5b63-goog
next reply other threads:[~2019-11-28 9:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 9:46 Oliver Upton [this message]
2019-12-02 21:21 ` [PATCH] KVM: nVMX: Use SET_MSR_OR_WARN() to simplify failure logging Sean Christopherson
2019-12-12 0:43 ` Paolo Bonzini
2019-12-13 23:55 ` Oliver Upton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191128094609.22161-1-oupton@google.com \
--to=oupton@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).