From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHtTS-0000Bb-NG for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:13:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHtTM-0001eJ-OO for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:13:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHtTM-0001e9-GW for qemu-devel@nongnu.org; Mon, 24 Feb 2014 06:13:20 -0500 Message-ID: <530B2949.4030000@redhat.com> Date: Mon, 24 Feb 2014 12:13:13 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 3/3] KVM: x86: Enable Intel MPX for guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Liu, Jinsong" , "'kvm@vger.kernel.org'" , "'linux-kernel@vger.kernel.org'" , "'qemu-devel@nongnu.org'" Cc: "'gleb@redhat.com'" , "'hpa@zytor.com'" Il 24/02/2014 11:58, Liu, Jinsong ha scritto: > @@ -599,6 +599,9 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) > u64 old_xcr0 = vcpu->arch.xcr0; > u64 valid_bits; > > + if (!kvm_x86_ops->mpx_supported || !kvm_x86_ops->mpx_supported()) > + xcr0 &= ~(XSTATE_BNDREGS | XSTATE_BNDCSR); > + > /* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */ > if (index != XCR_XFEATURE_ENABLED_MASK) > return 1; This hunk is incorrect, and I can simply drop it when applying. If MPX is not supported, it should not be in the 0Dh CPUID leaf and thus in vcpu->arch.guest_supported_xcr0. This however relies on userspace passing a "sensible" value of CPUID. I'll send a patch to strengthen the computation of guest_supported_xcr0. Thanks! Paolo