Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752422AbcCKMJ6 (ORCPT ); Fri, 11 Mar 2016 07:09:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049AbcCKMJw (ORCPT ); Fri, 11 Mar 2016 07:09:52 -0500 Subject: Re: [PATCH 1/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features To: Yang Zhang References: <1457437481-65784-1-git-send-email-pbonzini@redhat.com> <1457437481-65784-2-git-send-email-pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Xiao Guangrong From: Paolo Bonzini Message-ID: <56E2B58B.8020605@redhat.com> Date: Fri, 11 Mar 2016 13:09:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: 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.39]); Fri, 11 Mar 2016 12:09:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1178 Lines: 33 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. All this patch does is hide MPX completely to the guests (just like it's hidden on the host) if the host is using lazy FPU. > And we have observed some performance > decrease on those platforms according the result from some experiments > which did several years ago. Indeed after the merge window I plan to benchmark KVM on old systems (pre-XSAVE) to see if there is a negative benefit from eager FPU. Thanks, Paolo