From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Huang Ying <ying.huang@intel.com>,
Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
Dean Nelson <dnelson@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress
Date: Fri, 10 Dec 2010 17:24:43 +0900 [thread overview]
Message-ID: <4D01E3CB.20809@np.css.fujitsu.com> (raw)
Share same error handing, and rename this function after
MCIP (Machine Check In Progress) flag.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
target-i386/kvm.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index a7261c0..d7aae8b 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -219,7 +219,7 @@ static int kvm_get_msr(CPUState *env, struct kvm_msr_entry *msrs, int n)
}
/* FIXME: kill this and kvm_get_msr, use env->mcg_status instead */
-static int kvm_mce_in_exception(CPUState *env)
+static int kvm_mce_in_progress(CPUState *env)
{
struct kvm_msr_entry msr_mcg_status = {
.index = MSR_MCG_STATUS,
@@ -228,7 +228,8 @@ static int kvm_mce_in_exception(CPUState *env)
r = kvm_get_msr(env, &msr_mcg_status, 1);
if (r == -1 || r == 0) {
- return -1;
+ fprintf(stderr, "Failed to get MCE status\n");
+ return 0;
}
return !!(msr_mcg_status.data & MCG_STATUS_MCIP);
}
@@ -248,10 +249,7 @@ static void kvm_do_inject_x86_mce(void *_data)
/* If there is an MCE exception being processed, ignore this SRAO MCE */
if ((data->env->mcg_cap & MCG_SER_P) &&
!(data->mce->status & MCI_STATUS_AR)) {
- r = kvm_mce_in_exception(data->env);
- if (r == -1) {
- fprintf(stderr, "Failed to get MCE status\n");
- } else if (r) {
+ if (kvm_mce_in_progress(data->env)) {
return;
}
}
@@ -1782,10 +1780,7 @@ int kvm_on_sigbus_vcpu(CPUState *env, int code, void *addr)
* If there is an MCE excpetion being processed, ignore
* this SRAO MCE
*/
- r = kvm_mce_in_exception(env);
- if (r == -1) {
- fprintf(stderr, "Failed to get MCE status\n");
- } else if (r) {
+ if (kvm_mce_in_progress(env)) {
return 0;
}
/* Fake an Intel architectural Memory scrubbing UCR */
--
1.7.1.1
next reply other threads:[~2010-12-10 8:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-10 8:24 Jin Dongming [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-12-22 3:24 [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress Jin Dongming
2010-12-23 17:31 ` Marcelo Tosatti
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=4D01E3CB.20809@np.css.fujitsu.com \
--to=jin.dongming@np.css.fujitsu.com \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=dnelson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.