From: Huang Ying Subject: Re: [PATCH 2/2] reset mce registers of the given VCPU or all VCPUs with mce command. Date: Thu, 25 Nov 2010 13:55:58 +0800 Message-ID: <1290664558.2903.317.camel@yhuang-dev> References: <4CEDB9FA.5000400@np.css.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , Andi Kleen , Dean Nelson , Hidetoshi Seto , KVM list To: Jin Dongming Return-path: Received: from mga02.intel.com ([134.134.136.20]:44645 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919Ab0KYF4B (ORCPT ); Thu, 25 Nov 2010 00:56:01 -0500 In-Reply-To: <4CEDB9FA.5000400@np.css.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2010-11-25 at 09:20 +0800, Jin Dongming wrote: > --- 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) Are you sure there is no test cases that require the Machine Check registers not cleared? I have had a test case before that injects another MCE when MCIP in MCGSTATUS is set to check whether system will go reset. It may be better to clear MC registers in an explicit mode. Best Regards, Huang Ying