From: Kevin Hao <haokexin@gmail.com>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>,
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, 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
Date: Tue, 24 Jan 2017 13:18:33 +0800 [thread overview]
Message-ID: <20170124051833.GA10737@pek-khao-d1> (raw)
In-Reply-To: <2b638f89-70b4-7c0b-a271-a430157c5bfd@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1961 bytes --]
On Mon, Jan 23, 2017 at 06:38:42PM -0800, Dave Hansen wrote:
> On 01/23/2017 06:09 PM, Kevin Hao wrote:
> > On Mon, Jan 23, 2017 at 06:01:10PM -0800, Dave Hansen wrote:
> >> On 01/23/2017 05:50 PM, Kevin Hao wrote:
> >>> According to the ISA manual, XSAVES also set the XCOMP_BV[62:0]. My code only
> >>> try to be compatible with what the cpu does when excuting XSAVES. The following
> >>> is quoted from 325462-sdm-vol-1-2abcd-3abcd.pdf.
> >>> The XSAVES instructions sets bit 63 of the XCOMP_BV field of the XSAVE header while writing RFBM[62:0] to
> >>> XCOMP_BV[62:0]. The XSAVES instruction does not write any part of the XSAVE header other than the XSTATE_BV
> >>> and XCOMP_BV fields.
> >> What purpose does it serve to make copyin_to_xsaves() set that bit,
> > We try to fake up a memory area which is supposed to be composed by XSAVES
> > instruction. My code is just trying to do what the XSAVES do.
>
> No. copyin_to_xsaves() copies data into an *existing* XSAVES-formatted
> buffer. If you want to change what it does, fine, but that's not what
> it does or tries to do today.
No, I didn't change what the function copyin_to_xsaves() does. I just tried to
fix the bug in it.
>
> >> other than helping to hide bugs?
> > Why do you think it hide the bug? In contrast, I think my patch fixes what the
> > bug really is. The memory area we fake up is bug, we should fix it there.
>
> Yu-cheng found the bug. That bug will probably manifest in other code
> paths than copyin_to_xsaves(). If we did your patch, it would hide the
> bug in those other code paths.
The XCOMP_BV[62:0] is supposed to be updated by XSAVEC/XSAVES instructions.
It should not be touched by the software in theory except some special cases
like what we do in copyin_to_xsaves(). Trying to init the XCOMP_BV[62:0] to some
assuming values in fpstate_init() should be error prone and just paper over the
real bug.
Thanks,
Kevin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-01-24 5:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 8:50 [PATCH] x86/fpu: set the xcomp_bv when we fake up a XSAVES area Kevin Hao
2017-01-23 8:28 ` [tip:x86/urgent] x86/fpu: Set " tip-bot for Kevin Hao
2017-01-23 15:36 ` Dave Hansen
2017-01-23 16:55 ` Yu-cheng Yu
2017-01-23 17:23 ` Dave Hansen
2017-01-23 20:57 ` Yu-cheng Yu
2017-01-23 21:10 ` Dave Hansen
2017-01-23 21:16 ` Yu-cheng Yu
2017-01-23 21:28 ` Dave Hansen
2017-01-24 0:14 ` Kevin Hao
2017-01-24 0:53 ` Dave Hansen
2017-01-24 1:50 ` Kevin Hao
2017-01-24 2:01 ` Dave Hansen
2017-01-24 2:09 ` Kevin Hao
2017-01-24 2:38 ` Dave Hansen
2017-01-24 5:18 ` Kevin Hao [this message]
2017-01-24 8:08 ` Ingo Molnar
2017-01-23 9:43 ` tip-bot for Kevin Hao
2017-02-14 16:47 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170124051833.GA10737@pek-khao-d1 \
--to=haokexin@gmail.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=dvlasenk@redhat.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=quentin.casasnovas@oracle.com \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=yu-cheng.yu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.