From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751474AbdAWVUT (ORCPT ); Mon, 23 Jan 2017 16:20:19 -0500 Received: from mga03.intel.com ([134.134.136.65]:40539 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbdAWVUS (ORCPT ); Mon, 23 Jan 2017 16:20:18 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,275,1477983600"; d="scan'208";a="216729480" Date: Mon, 23 Jan 2017 13:16:40 -0800 From: Yu-cheng Yu To: Dave Hansen Cc: fenghua.yu@intel.com, dvlasenk@redhat.com, peterz@infradead.org, oleg@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, brgerst@gmail.com, luto@kernel.org, bp@alien8.de, jpoimboe@redhat.com, haokexin@gmail.com, hpa@zytor.com, quentin.casasnovas@oracle.com, tglx@linutronix.de, torvalds@linux-foundation.org, riel@redhat.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area Message-ID: <20170123211640.GA3976@test-lenovo> References: <1485075023-30161-1-git-send-email-haokexin@gmail.com> <20170123165529.GA4996@test-lenovo> <2be814b7-9fd6-7955-b4e3-6ecb4ef76052@linux.intel.com> <20170123205725.GA3920@test-lenovo> <90b0fbee-273b-31c2-6fe9-228f00c0a205@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <90b0fbee-273b-31c2-6fe9-228f00c0a205@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 23, 2017 at 01:10:20PM -0800, Dave Hansen wrote: > The code is: > > > void fpstate_init(union fpregs_state *state) > > { > > if (!static_cpu_has(X86_FEATURE_FPU)) { > > fpstate_init_soft(&state->soft); > > return; > > } > > > > memset(state, 0, fpu_kernel_xstate_size); > > > > /* > > * XRSTORS requires that this bit is set in xcomp_bv, or > > * it will #GP. Make sure it is replaced after the memset(). > > */ > > if (static_cpu_has(X86_FEATURE_XSAVES)) > > state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT; > > That seems to set it unconditionally. What am I missing? The fix I am proposing is... state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | xfeatures_mask;