Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757493AbcCXNGg (ORCPT ); Thu, 24 Mar 2016 09:06:36 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35295 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753255AbcCXNGc (ORCPT ); Thu, 24 Mar 2016 09:06:32 -0400 Subject: Re: [PATCH 1/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features To: Paolo Bonzini References: <1457437481-65784-1-git-send-email-pbonzini@redhat.com> <1457437481-65784-2-git-send-email-pbonzini@redhat.com> <56E2B58B.8020605@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Xiao Guangrong From: Yang Zhang Message-ID: <56F3E653.6040901@gmail.com> Date: Thu, 24 Mar 2016 21:06:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56E2B58B.8020605@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1163 Lines: 36 On 2016/3/11 20:09, Paolo Bonzini wrote: Sorry for the late reply. > > > On 11/03/2016 03:37, Yang Zhang wrote: >>> @@ -97,7 +104,7 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) >>> if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) >>> best->ebx = xstate_required_size(vcpu->arch.xcr0, true); >>> >>> - vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu); >>> + vcpu->arch.eager_fpu = use_eager_fpu(); >> >> Hi Paolo, >> >> As i mentioned on another thread, force KVM to use eager fpu >> unconditionally may introduce the performance regression. Though the >> cost for eager fpu is very small especially in modern CPU, it still >> cannot be ignored on old platform. > > This patch doesn't change anything in that respect. It doesn't enable > eager FPU in any case where it wasn't already enabled before the patch. I mean why not keep the old way that only activate the eager_fpu while guest sees the MPX bit in CPUID, like: vcpu->arch.eager_fpu = use_eager_fpu() && guest_cpuid_has_mpx(vcpu); Besides, vmx_fpu_activate is called when do vcpu_reset. So it seems no need to call fpu_activate() here again. -- best regards yang