From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH V4 7/7] KVM, pkeys: disable PKU feature without ept Date: Tue, 8 Mar 2016 11:02:35 +0100 Message-ID: <56DEA33B.1010005@redhat.com> References: <1457177252-7577-1-git-send-email-huaitong.han@intel.com> <1457177252-7577-8-git-send-email-huaitong.han@intel.com> <56DBF834.1020309@linux.intel.com> <56DC93D1.2070204@redhat.com> <56DE6919.4060107@linux.intel.com> <56DE91BD.4010502@redhat.com> <56DE9C45.4090504@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Xiao Guangrong , Huaitong Han , gleb@kernel.org Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:35213 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084AbcCHKCl (ORCPT ); Tue, 8 Mar 2016 05:02:41 -0500 Received: by mail-wm0-f68.google.com with SMTP id 1so3069545wmg.2 for ; Tue, 08 Mar 2016 02:02:40 -0800 (PST) In-Reply-To: <56DE9C45.4090504@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/03/2016 10:32, Xiao Guangrong wrote: > On 03/08/2016 04:47 PM, Paolo Bonzini wrote: >> Some XSAVE features (currently only MPX, but in the future PKRU too) >> will force eagerfpu on, see fpu__init_system_ctx_switch: >> >> if (xfeatures_mask & XFEATURE_MASK_EAGER) { >> if (eagerfpu == DISABLE) { >> xfeatures_mask &= ~XFEATURE_MASK_EAGER; > > So if the kernel parameter, eagerfpu is set to "off", then eager is not > enabled, so PKRU can not work in KVM? Yes. Neither PKRU nor MPX. >> KVM will use eager FPU if the host uses it. See arch/x86/kvm/cpuid.c: >> >> vcpu->arch.eager_fpu = >> use_eager_fpu() || guest_cpuid_has_mpx(vcpu); >> > > Sorry, i missread the code, yes, if vcpu->arch.eager_fpu is true, it is > always save/load fpu for every vm-exit/vm-enter. No problem, it's impossible to know all the code. :) Paolo