From mboxrd@z Thu Jan 1 00:00:00 1970 From: Huang Ying Subject: Re: [BUGFIX] MCE: Fix bug of IA32_MCG_STATUS after system reset Date: Wed, 06 Jan 2010 15:05:13 +0800 Message-ID: <1262761513.17852.4.camel@yhuang-dev.sh.intel.com> References: <1262680448.31401.228.camel@yhuang-dev.sh.intel.com> <4B431968.9030304@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Andi Kleen , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from mga11.intel.com ([192.55.52.93]:13603 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752293Ab0AFHFP (ORCPT ); Wed, 6 Jan 2010 02:05:15 -0500 In-Reply-To: <4B431968.9030304@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi, Avi, On Tue, 2010-01-05 at 18:50 +0800, Avi Kivity wrote: > On 01/05/2010 10:34 AM, Huang Ying wrote: > > Now, if we inject a fatal MCE into guest OS, for example Linux, Linux > > will go panic and then reboot. But if we inject another MCE now, > > system will reset directly instead of go panic firstly, because > > MCG_STATUS.MCIP is set to 1 and not cleared after reboot. This is does > > not follow the behavior in real hardware. > > > > This patch fixes this via set IA32_MCG_STATUS to 0 during system reset. > > > > Signed-off-by: Huang Ying > > --- > > qemu-kvm-x86.c | 1 + > > 1 file changed, 1 insertion(+) > > > > --- a/qemu-kvm-x86.c > > +++ b/qemu-kvm-x86.c > > @@ -1015,6 +1015,7 @@ void kvm_arch_load_regs(CPUState *env) > > #endif > > set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr); > > set_msr_entry(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr); > > + set_msr_entry(&msrs[n++], MSR_MCG_STATUS, 0); > > > > > > Not sure why you reset this in kvm_arch_load_regs(). Shouldn't this be > in the cpu reset code? I found kvm_arch_load_regs() is called by kvm_arch_cpu_reset(), which is called by qemu_kvm_system_reset(). It is not in cpu reset path? Best Regards, Huang Ying