Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578685

Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Yu-cheng Yu <yu-cheng.yu@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state
Date Fri, 10 Feb 2017 19:30:02 +0100
Message-ID <t9o7f-73R-9@gated-at.bofh.it> (permalink)
References <t96N4-4gQ-23@gated-at.bofh.it> <t97SN-58a-3@gated-at.bofh.it> <t97SN-58a-1@gated-at.bofh.it>
X-Original-To Rik van Riel <riel@redhat.com>
X-Extloop1 1
X-Ironport-Av E=Sophos;i="5.35,142,1484035200"; d="scan'208";a="57330976"
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 41
Organization linux.* mail to news gateway
X-Original-Cc mingo@kernel.org, linux-kernel@vger.kernel.org, luto@kernel.org, dave.hansen@linux.intel.com, bp@suse.de, hpa@zytor.com
X-Original-Date Fri, 10 Feb 2017 09:18:21 -0800
X-Original-Message-ID <20170210171821.GA22519@test-lenovo>
X-Original-References <20170209184347.2ef977b9@annuminas.surriel.com> <20170210004541.GA20800@test-lenovo> <1486688411.2096.31.camel@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1578685

Show key headers only | View raw


On Thu, Feb 09, 2017 at 08:00:11PM -0500, Rik van Riel wrote:
> On Thu, 2017-02-09 at 16:45 -0800, Yu-cheng Yu wrote:
> > On Thu, Feb 09, 2017 at 06:43:47PM -0500, Rik van Riel wrote:
> > >  /*
> > > + * Weird legacy quirk: SSE and YMM states store information in the
> > > + * MXCSR and MXCSR_FLAGS fields of the FP area. That means if the
> > > FP
> > > + * area is marked as unused in the xfeatures header, we need to
> > > copy
> > > + * MXCSR and MXCSR_FLAGS if either SSE or YMM are in use.
> > > + */
> > > +static inline bool xfeatures_need_mxcsr_copy(u64 xfeatures)
> > > +{
> > > +	if (!(xfeatures & (XFEATURE_MASK_SSE|XFEATURE_MASK_YMM)))
> > > +		return 0;
> > > +
> > > +	if (xfeatures & XFEATURE_MASK_FP)
> > > +		return 0;
> > > +
> > > +	return 1;
> > > +}
> > 
> > Would you consider separating MXCSR & MXCSR_FLAGS from
> > XFEATURE_MASK_FP.  Here we assume if both xstate[0] and xstate[1]
> > are being copied, then there is no need to copy MXCSR/MXCSR_FLAGS
> > again.  What if only xstate[0] is copied and MXCSR/MXCSR_FLAGS
> > is invalid?
> 
> Surely then the CPU would ignore the contents of
> MXCSR/MXCSR_FLAGS because the SSE and YMM bits in
> the xfeatures header are clear?
> 
> What am I missing?

For example in copy_user_to_xstate(), is it possible that only
xstate[0] is copied in, but in fact the task already has a valid
xstate[1] and MXCSR is overwritten?  We can think about this
as a separate patch.

Thanks,
Yu-cheng     

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Rik van Riel <riel@redhat.com> - 2017-02-10 01:00 +0100
  Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Borislav Petkov <bp@suse.de> - 2017-02-10 01:10 +0100
    Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Rik van Riel <riel@redhat.com> - 2017-02-10 02:20 +0100
      Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Ingo Molnar <mingo@kernel.org> - 2017-02-10 09:10 +0100
        [PATCH v3] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Rik van Riel <riel@redhat.com> - 2017-02-10 15:30 +0100
          Re: [PATCH v3] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Ingo Molnar <mingo@kernel.org> - 2017-02-11 11:10 +0100
  Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Rik van Riel <riel@redhat.com> - 2017-02-10 02:10 +0100
    Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Yu-cheng Yu <yu-cheng.yu@intel.com> - 2017-02-10 19:30 +0100
  Re: [PATCH v2] x86/fpu: copy MXCSR & MXCSR_FLAGS with SSE/YMM state Yu-cheng Yu <yu-cheng.yu@intel.com> - 2017-02-10 02:30 +0100

csiph-web