public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Dean Nelson <dnelson@redhat.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	KVM list <kvm@vger.kernel.org>
Subject: [PATCH 2/2] reset mce registers of the given VCPU or all VCPUs with mce command.
Date: Thu, 25 Nov 2010 10:20:58 +0900	[thread overview]
Message-ID: <4CEDB9FA.5000400@np.css.fujitsu.com> (raw)

For saving test time, fake_panic will be set when mce test is done.
After setting fake_panic==1, injecting mce from qemu-monitor to test
mce of Guest OS, fatal mce data of last time will not be cleared.
And the result of this time is not right.

Before testing mce, mce registers could be reset with mce command now.
This operation could be sure the result more reliable.

The usage of resetting mce registers with mce command is like following:

                       COMMAND CPU BANK STATUS MCG_STATUS ADDR MISC BROADCAST
    given VCPU: (qemu) mce     N   0    0      0          0    0    -
    all VCPUs:  (qemu) mce     N   0    0      0          0    0    broadcast/b

    (Comment: "N" is the number of VCPU; "-" means no option.)

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
 hmp-commands.hx |    4 +++-
 monitor.c       |   15 ++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 3a93837..3f1389d 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1056,7 +1056,9 @@ ETEXI
 #if defined(KVM_CAP_MCE)
         .args_type  = "cpu_index:i,bank:i,status:l,mcg_status:l,addr:l,misc:l,broadcast:s?",
         .params     = "cpu bank status mcgstatus addr misc [broadcast|b]",
-        .help       = "inject a MCE on the given CPU [and broadcast to other CPUs]",
+        .help       = "\n1. inject a MCE on the given CPU [and broadcast to other CPUs] \
+                       \n2. reset MCE registers on the given CPU with !status and !mcg_status \
+                       \n   [and reset other CPUs with broadcast/b option]",
 #else
         .args_type  = "cpu_index:i,bank:i,status:l,mcg_status:l,addr:l,misc:l",
         .params     = "cpu bank status mcgstatus addr misc",
diff --git a/monitor.c b/monitor.c
index 9d0a98e..419fafd 100644
--- a/monitor.c
+++ b/monitor.c
@@ -60,6 +60,7 @@
 #include "trace.h"
 #endif
 #include "qemu-kvm.h"
+#include "kvm_x86.h"
 
 //#define DEBUG
 //#define DEBUG_COMPLETION
@@ -2277,7 +2278,19 @@ static void do_inject_mce(Monitor *mon, const QDict *qdict)
 #endif
 
     for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) {
-        if (cenv->cpu_index == cpu_index && cenv->mcg_cap) {
+        if (!cenv->mcg_cap)
+            continue;
+
+#if defined(KVM_CAP_MCE)
+        if (!status && !mcg_status) {
+            if (cenv->cpu_index == cpu_index || broadcast)
+                kvm_inject_x86_mce(cenv, 0, 0, 0, 0, 0, 0);
+
+            continue;
+        }
+#endif
+
+        if (cenv->cpu_index == cpu_index) {
             cpu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc);
 #if defined(KVM_CAP_MCE)
             if (broadcast)
-- 
1.7.1.1



             reply	other threads:[~2010-11-25  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25  1:20 Jin Dongming [this message]
2010-11-25  5:55 ` [PATCH 2/2] reset mce registers of the given VCPU or all VCPUs with mce command Huang Ying
2010-11-25  8:46   ` Jin Dongming

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=4CEDB9FA.5000400@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox