From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Lange Subject: Re: [PATCH] KVM: svm: virtualize MSR reads from MC4_MISC1 Date: Thu, 10 Jul 2014 11:31:23 +0200 Message-ID: <20140710093123.GA20320@triton> References: <1403785327-1357-1-git-send-email-matthias.lange@kernkonzept.com> <1403785327-1357-2-git-send-email-matthias.lange@kernkonzept.com> <53BD6D2F.8070504@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Gleb Natapov To: Paolo Bonzini Return-path: Received: from os.inf.tu-dresden.de ([141.76.48.99]:45413 "EHLO os.inf.tu-dresden.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbaGJJbd (ORCPT ); Thu, 10 Jul 2014 05:31:33 -0400 Content-Disposition: inline In-Reply-To: <53BD6D2F.8070504@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 09, 2014 at 06:26:23PM +0200, Paolo Bonzini wrote: > Il 26/06/2014 14:22, Matthias Lange ha scritto: > >Linux' AMD MCE code tries to read from the MC4_MISC1 (0xc0000408) MSR. Because > >this read is not virtualized within KVM, a GPE is injected into the guest. > >This patch handles guest reads from MC4_MISC and returns 0 to the guest. > > > >Signed-off-by: Matthias Lange > >--- > > arch/x86/kvm/x86.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > >index 24d70d4..d5a305b 100644 > >--- a/arch/x86/kvm/x86.c > >+++ b/arch/x86/kvm/x86.c > >@@ -2530,6 +2530,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) > > return 1; > > data = vcpu->arch.osvw.status; > > break; > >+ case 0xc0000408: /* MC4_MISC1 */ > >+ data = 0; > >+ break; > > default: > > if (kvm_pmu_msr(vcpu, msr)) > > return kvm_pmu_get_msr(vcpu, msr, pdata); > > > > Why don't you have to do the same with MC4_MISC0? MC4_MISC0 (0x413) is handled in kvm_get_msr_common by this statement case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: return get_msr_mce(vcpu, msr, pdata); and get_msr_mce returns a sane value from the vcpu mce_banks. > Is your kernel compiled with or without CONFIG_PARAVIRT? Paravirt does > > .read_msr = native_read_msr_safe, > .write_msr = native_write_msr_safe, > > so you shouldn't get these #GP exceptions. I used the default i386_defconfig to build the guest kernel. CONFIG_PARAVIRT is disabled in this setup. Matthias.