From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haozhong Zhang Subject: Re: [PATCH v4 1/3] target-i386: KVM: add basic Intel LMCE support Date: Mon, 20 Jun 2016 10:04:30 +0800 Message-ID: <20160620020430.5hekpmxnflnn6dx5@hz-desktop> References: <20160616060621.30422-1-haozhong.zhang@intel.com> <20160616060621.30422-2-haozhong.zhang@intel.com> <20160616193725.GT18662@thinpad.lan.raisama.net> <20160617012657.36fcgurduuhxnwsj@hz-desktop> <20160617162003.GI18662@thinpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson , "Michael S . Tsirkin" , Marcelo Tosatti , kvm@vger.kernel.org, Boris Petkov , Tony Luck , Andi Kleen , rkrcmar@redhat.com, Ashok Raj To: Eduardo Habkost Return-path: Received: from mga09.intel.com ([134.134.136.24]:21457 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbcFTCEe (ORCPT ); Sun, 19 Jun 2016 22:04:34 -0400 Content-Disposition: inline In-Reply-To: <20160617162003.GI18662@thinpad.lan.raisama.net> Sender: kvm-owner@vger.kernel.org List-ID: On 06/17/16 13:20, Eduardo Habkost wrote: > On Fri, Jun 17, 2016 at 09:26:57AM +0800, Haozhong Zhang wrote: > [...] > > > > static void mce_init(X86CPU *cpu) > > > > { > > > > CPUX86State *cenv = &cpu->env; > > > > unsigned int bank; > > > > + Error *local_err = NULL; > > > > > > > > if (((cenv->cpuid_version >> 8) & 0xf) >= 6 > > > > && (cenv->features[FEAT_1_EDX] & (CPUID_MCE | CPUID_MCA)) == > > > > (CPUID_MCE | CPUID_MCA)) { > > > > cenv->mcg_cap = MCE_CAP_DEF | MCE_BANKS_DEF; > > > > + > > > > + if (cpu->enable_lmce) { > > > > + if (!lmce_supported()) { > > > > + error_setg(&local_err, "KVM unavailable or LMCE not supported"); > > > > + error_propagate(&error_abort, local_err); > > > > + } > > > > + cenv->mcg_cap |= MCG_LMCE_P; > > > > + } > > > > + > > > > > > This duplicates the existing check in kvm_arch_init_vcpu(). The > > > difference is that the existing code is KVM-specific and doesn't > > > stop initialization when capabilities are missing. We can unify > > > them into a single mcg_cap-checking function as a follow-up. > > > > > > > If I reuse the existing MCE capability check in kvm_arch_init_vcpu(), > > is it reasonable to make change to stop initialization if missing > > capabilities? Or should we stop only for missing newly added capabilities > > (e.g. LMCE) in order to keep backwards compatibility? > > Ideally, yes. But in practice we need to check if we won't break > existing setups that were working. If all kernel versions we care > about always MCG_CTL_P|MCG_SER_P + 10 banks as supported, we can > make all bits mandatory. > Let's stop only for LMCE in this patch series. Other bits may be changed in future after the kernel support is clarified. Thanks, Haozhong > I need to re-read the thread were kvm_get_mce_cap_supported() was > discussed, to refresh my memory. > > -- > Eduardo > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEoZt-00046L-EV for qemu-devel@nongnu.org; Sun, 19 Jun 2016 22:04:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEoZn-0002sc-EP for qemu-devel@nongnu.org; Sun, 19 Jun 2016 22:04:40 -0400 Received: from mga09.intel.com ([134.134.136.24]:55415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEoZn-0002sY-5l for qemu-devel@nongnu.org; Sun, 19 Jun 2016 22:04:35 -0400 Date: Mon, 20 Jun 2016 10:04:30 +0800 From: Haozhong Zhang Message-ID: <20160620020430.5hekpmxnflnn6dx5@hz-desktop> References: <20160616060621.30422-1-haozhong.zhang@intel.com> <20160616060621.30422-2-haozhong.zhang@intel.com> <20160616193725.GT18662@thinpad.lan.raisama.net> <20160617012657.36fcgurduuhxnwsj@hz-desktop> <20160617162003.GI18662@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160617162003.GI18662@thinpad.lan.raisama.net> Subject: Re: [Qemu-devel] [PATCH v4 1/3] target-i386: KVM: add basic Intel LMCE support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Paolo Bonzini , Richard Henderson , "Michael S . Tsirkin" , Marcelo Tosatti , kvm@vger.kernel.org, Boris Petkov , Tony Luck , Andi Kleen , rkrcmar@redhat.com, Ashok Raj On 06/17/16 13:20, Eduardo Habkost wrote: > On Fri, Jun 17, 2016 at 09:26:57AM +0800, Haozhong Zhang wrote: > [...] > > > > static void mce_init(X86CPU *cpu) > > > > { > > > > CPUX86State *cenv = &cpu->env; > > > > unsigned int bank; > > > > + Error *local_err = NULL; > > > > > > > > if (((cenv->cpuid_version >> 8) & 0xf) >= 6 > > > > && (cenv->features[FEAT_1_EDX] & (CPUID_MCE | CPUID_MCA)) == > > > > (CPUID_MCE | CPUID_MCA)) { > > > > cenv->mcg_cap = MCE_CAP_DEF | MCE_BANKS_DEF; > > > > + > > > > + if (cpu->enable_lmce) { > > > > + if (!lmce_supported()) { > > > > + error_setg(&local_err, "KVM unavailable or LMCE not supported"); > > > > + error_propagate(&error_abort, local_err); > > > > + } > > > > + cenv->mcg_cap |= MCG_LMCE_P; > > > > + } > > > > + > > > > > > This duplicates the existing check in kvm_arch_init_vcpu(). The > > > difference is that the existing code is KVM-specific and doesn't > > > stop initialization when capabilities are missing. We can unify > > > them into a single mcg_cap-checking function as a follow-up. > > > > > > > If I reuse the existing MCE capability check in kvm_arch_init_vcpu(), > > is it reasonable to make change to stop initialization if missing > > capabilities? Or should we stop only for missing newly added capabilities > > (e.g. LMCE) in order to keep backwards compatibility? > > Ideally, yes. But in practice we need to check if we won't break > existing setups that were working. If all kernel versions we care > about always MCG_CTL_P|MCG_SER_P + 10 banks as supported, we can > make all bits mandatory. > Let's stop only for LMCE in this patch series. Other bits may be changed in future after the kernel support is clarified. Thanks, Haozhong > I need to re-read the thread were kvm_get_mce_cap_supported() was > discussed, to refresh my memory. > > -- > Eduardo > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html