Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-02-14 Thread Dave Hansen
On 01/23/2017 01:43 AM, tip-bot for Kevin Hao wrote: > diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c > index 1d77704..e287b90 100644 > --- a/arch/x86/kernel/fpu/xstate.c > +++ b/arch/x86/kernel/fpu/xstate.c > @@ -1070,6 +1070,7 @@ int copyin_to_xsaves(const void *kbuf, co

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-24 Thread Ingo Molnar
* Kevin Hao wrote: > > 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. The intention is to have a single FPU format set at bootup and xcomp_bv is

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Kevin Hao
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 > >>

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
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 XS

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Kevin Hao
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

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
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

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Kevin Hao
On Mon, Jan 23, 2017 at 04:53:25PM -0800, Dave Hansen wrote: > >> The fix I am proposing is... > >> > >>state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | > >> xfeatures_mask; > > > > Actually I thought about this change before I made this patch, but I

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
>> The fix I am proposing is... >> >> state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | >> xfeatures_mask; > > Actually I thought about this change before I made this patch, but I don't > this > is the right fix. It is always error prone to init t

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Kevin Hao
On Mon, Jan 23, 2017 at 01:16:40PM -0800, Yu-cheng Yu wrote: > 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(

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
On 01/23/2017 01:16 PM, Yu-cheng Yu wrote: > 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); >>>

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Yu-cheng Yu
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; > > } > > > > m

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
On 01/23/2017 12:57 PM, Yu-cheng Yu wrote: > On Mon, Jan 23, 2017 at 09:23:06AM -0800, Dave Hansen wrote: >> On 01/23/2017 08:55 AM, Yu-cheng Yu wrote: The best fix here would be not to paper over the issue in the copy function but find where it got clobbered, or where some initialization

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Yu-cheng Yu
On Mon, Jan 23, 2017 at 09:23:06AM -0800, Dave Hansen wrote: > On 01/23/2017 08:55 AM, Yu-cheng Yu wrote: > >> The best fix here would be not to paper over the issue in the copy > >> function but find where it got clobbered, or where some initialization > >> code failed to set it. > > > > Someone

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
On 01/23/2017 08:55 AM, Yu-cheng Yu wrote: > On Mon, Jan 23, 2017 at 07:36:20AM -0800, Dave Hansen wrote: >> The kernel xsave buffer should *ALWAYS* have the >> XCOMP_BV_COMPACTED_FORMAT bit set. It should have been set before the >> copyin and it should be set when it's finished. >> >> The best f

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Yu-cheng Yu
On Mon, Jan 23, 2017 at 07:36:20AM -0800, Dave Hansen wrote: > The kernel xsave buffer should *ALWAYS* have the > XCOMP_BV_COMPACTED_FORMAT bit set. It should have been set before the > copyin and it should be set when it's finished. > > The best fix here would be not to paper over the issue in t

Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread Dave Hansen
On 01/23/2017 12:28 AM, tip-bot for Kevin Hao wrote: > x86/fpu: Set the xcomp_bv when we fake up a XSAVES area > > I got the following calltrace on a Apollo Lake SoC with 32-bit kernel: ... > --- a/arch/x86/kernel/fpu/xstate.c > +++ b/arch/x86/kernel/fpu/xstate.c > @@ -1070,6 +1070,7 @@ int copyi

[tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread tip-bot for Kevin Hao
Commit-ID: 4c833368f0bf748d4147bf301b1f95bc8eccb3c0 Gitweb: http://git.kernel.org/tip/4c833368f0bf748d4147bf301b1f95bc8eccb3c0 Author: Kevin Hao AuthorDate: Sun, 22 Jan 2017 16:50:23 +0800 Committer: Thomas Gleixner CommitDate: Mon, 23 Jan 2017 10:40:18 +0100 x86/fpu: Set the xcomp_bv

[tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

2017-01-23 Thread tip-bot for Kevin Hao
Commit-ID: 5fa356458b5c918bdf8307b070a3d74bc015d910 Gitweb: http://git.kernel.org/tip/5fa356458b5c918bdf8307b070a3d74bc015d910 Author: Kevin Hao AuthorDate: Sun, 22 Jan 2017 16:50:23 +0800 Committer: Ingo Molnar CommitDate: Mon, 23 Jan 2017 09:03:03 +0100 x86/fpu: Set the xcomp_bv when