From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754335AbcFPL5S (ORCPT ); Thu, 16 Jun 2016 07:57:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42213 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753945AbcFPL5P (ORCPT ); Thu, 16 Jun 2016 07:57:15 -0400 Subject: Re: [PATCH v2 1/3] KVM: VMX: move msr_ia32_feature_control to vcpu_vmx To: Borislav Petkov , Haozhong Zhang References: <20160616060531.30028-1-haozhong.zhang@intel.com> <20160616060531.30028-2-haozhong.zhang@intel.com> <20160616114916.GA20058@pd.tnic> Cc: kvm@vger.kernel.org, rkrcmar@redhat.com, Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Gleb Natapov , Tony Luck , Andi Kleen , Ashok Raj From: Paolo Bonzini Message-ID: Date: Thu, 16 Jun 2016 13:57:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160616114916.GA20058@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 16 Jun 2016 11:57:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/06/2016 13:49, Borislav Petkov wrote: >> > enum segment_cache_field { >> > @@ -2907,7 +2908,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) >> > case MSR_IA32_FEATURE_CONTROL: >> > if (!nested_vmx_allowed(vcpu)) >> > return 1; >> > - msr_info->data = to_vmx(vcpu)->nested.msr_ia32_feature_control; >> > + msr_info->data = to_vmx(vcpu)->msr_ia32_feature_control; > Since this moves out of struct nested_vmx, that check above it: > > if (!nested_vmx_allowed(vcpu)) > > should not influence it anymore, no? For get, yes, this "if" should go. For set, you need to check that the guest doesn't write to reserved bits. So as of this patch the "if" remains tied to VMX, but the next patch changes it to be generic. Paolo > Ditto for the rest.