All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress
@ 2010-12-10  8:24 Jin Dongming
  0 siblings, 0 replies; 3+ messages in thread
From: Jin Dongming @ 2010-12-10  8:24 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti
  Cc: Andi Kleen, Huang Ying, Hidetoshi Seto, Dean Nelson, KVM list

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress
  2010-12-22  3:24 Jin Dongming
@ 2010-12-23 17:31 ` Marcelo Tosatti
  0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2010-12-23 17:31 UTC (permalink / raw)
  To: Jin Dongming
  Cc: Avi Kivity, Andi Kleen, Huang Ying, Hidetoshi Seto, Dean Nelson,
	KVM list

On Wed, Dec 22, 2010 at 12:24:22PM +0900, Jin Dongming wrote:
> Hi, Marcelo-san
> 
> I modified the patches sent before and made them work well
> on origin/uq/master tree.
> 
> Resend the patches.

Applied all 3, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress
@ 2010-12-22  3:24 Jin Dongming
  2010-12-23 17:31 ` Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Jin Dongming @ 2010-12-22  3:24 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti
  Cc: Andi Kleen, Huang Ying, Hidetoshi Seto, Dean Nelson, KVM list

Hi, Marcelo-san

I modified the patches sent before and made them work well
on origin/uq/master tree.

Resend the patches.

Best Regards,
Jin Dongming
---------------------------------------------------------------
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 2115a58..5a699fc 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;
         }
     }
@@ -1752,10 +1750,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.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-23 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10  8:24 [PATCH 1/3] kvm, x86: introduce kvm_mce_in_progress Jin Dongming
2010-12-22  3:24 Jin Dongming
2010-12-23 17:31 ` Marcelo Tosatti

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.