RE: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread David Laight
From: Li, Aubrey > Sent: 13 November 2018 13:07 ... > > Isn't there an obvious optimisation to execute VZEROALL during system call > > entry? > > I'm not aware of this in the kernel, maybe you are talking about some > optimization in glibc? I've not seen it anywhere either. IIRC all the xmm and

RE: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread David Laight
From: Li, Aubrey > Sent: 13 November 2018 13:07 ... > > Isn't there an obvious optimisation to execute VZEROALL during system call > > entry? > > I'm not aware of this in the kernel, maybe you are talking about some > optimization in glibc? I've not seen it anywhere either. IIRC all the xmm and

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread Li, Aubrey
On 2018/11/13 18:25, David Laight wrote: > From: Li, Aubrey >> Sent: 12 November 2018 01:41 > ... >> VZEROUPPER instruction resets the init state. If context switch happens >> to occur exactly after VZEROUPPER instruction, XINUSE bitmap is empty(all >> zeros), which indicates the task is not using

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread Li, Aubrey
On 2018/11/13 18:25, David Laight wrote: > From: Li, Aubrey >> Sent: 12 November 2018 01:41 > ... >> VZEROUPPER instruction resets the init state. If context switch happens >> to occur exactly after VZEROUPPER instruction, XINUSE bitmap is empty(all >> zeros), which indicates the task is not using

RE: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread David Laight
From: Li, Aubrey > Sent: 12 November 2018 01:41 ... > VZEROUPPER instruction resets the init state. If context switch happens > to occur exactly after VZEROUPPER instruction, XINUSE bitmap is empty(all > zeros), which indicates the task is not using AVX. That's why the state > decay count is used

RE: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-13 Thread David Laight
From: Li, Aubrey > Sent: 12 November 2018 01:41 ... > VZEROUPPER instruction resets the init state. If context switch happens > to occur exactly after VZEROUPPER instruction, XINUSE bitmap is empty(all > zeros), which indicates the task is not using AVX. That's why the state > decay count is used

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-12 Thread Li, Aubrey
On 2018/11/12 23:46, Dave Hansen wrote: > On 11/11/18 9:38 PM, Li, Aubrey wrote: > >>> Do we want this, or do we want something more time-based? >>> >> This counter is introduced here to solve the race of context switch and >> VZEROUPPER. 3 context switches mean the same thread is on-off CPU 3

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-12 Thread Li, Aubrey
On 2018/11/12 23:46, Dave Hansen wrote: > On 11/11/18 9:38 PM, Li, Aubrey wrote: > >>> Do we want this, or do we want something more time-based? >>> >> This counter is introduced here to solve the race of context switch and >> VZEROUPPER. 3 context switches mean the same thread is on-off CPU 3

[RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-12 Thread Dave Hansen
On 11/11/18 9:38 PM, Li, Aubrey wrote: > If there is a valid state in the AVX registers, we can say the tasks contains > AVX instructions, can't we? XRSTOR, for instance, can take XSAVE state out of the init state, but it is not necessarily an AVX instruction. In fact, we had a kernel bug along

[RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-12 Thread Dave Hansen
On 11/11/18 9:38 PM, Li, Aubrey wrote: > If there is a valid state in the AVX registers, we can say the tasks contains > AVX instructions, can't we? XRSTOR, for instance, can take XSAVE state out of the init state, but it is not necessarily an AVX instruction. In fact, we had a kernel bug along

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Li, Aubrey
Hi Dave, Thanks for your comments! On 2018/11/12 10:32, Dave Hansen wrote: > On 11/7/18 9:16 AM, Aubrey Li wrote: >> XSAVES and its variants use init optimization to reduce the amount of >> data that they save to memory during context switch. Init optimization >> uses the state component bitmap

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Li, Aubrey
Hi Dave, Thanks for your comments! On 2018/11/12 10:32, Dave Hansen wrote: > On 11/7/18 9:16 AM, Aubrey Li wrote: >> XSAVES and its variants use init optimization to reduce the amount of >> data that they save to memory during context switch. Init optimization >> uses the state component bitmap

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Dave Hansen
On 11/7/18 9:16 AM, Aubrey Li wrote: > XSAVES and its variants use init optimization to reduce the amount of > data that they save to memory during context switch. Init optimization > uses the state component bitmap to denote if a component is in its init > configuration. We use this information

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Dave Hansen
On 11/7/18 9:16 AM, Aubrey Li wrote: > XSAVES and its variants use init optimization to reduce the amount of > data that they save to memory during context switch. Init optimization > uses the state component bitmap to denote if a component is in its init > configuration. We use this information

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Li, Aubrey
On 2018/11/9 19:21, Thomas Gleixner wrote: > Aubrey, > > On Thu, 8 Nov 2018, Aubrey Li wrote: > >> Subject: x86/fpu: detect AVX task > > What is an AVX task? I know what you mean, but for the casual reader this > is not very informative. So something like: > > x86/fpu: Track AVX usage

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-11 Thread Li, Aubrey
On 2018/11/9 19:21, Thomas Gleixner wrote: > Aubrey, > > On Thu, 8 Nov 2018, Aubrey Li wrote: > >> Subject: x86/fpu: detect AVX task > > What is an AVX task? I know what you mean, but for the casual reader this > is not very informative. So something like: > > x86/fpu: Track AVX usage

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-09 Thread Thomas Gleixner
Aubrey, On Thu, 8 Nov 2018, Aubrey Li wrote: > Subject: x86/fpu: detect AVX task What is an AVX task? I know what you mean, but for the casual reader this is not very informative. So something like: x86/fpu: Track AVX usage of tasks would be more informative and precise. The mechanism

Re: [RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-09 Thread Thomas Gleixner
Aubrey, On Thu, 8 Nov 2018, Aubrey Li wrote: > Subject: x86/fpu: detect AVX task What is an AVX task? I know what you mean, but for the casual reader this is not very informative. So something like: x86/fpu: Track AVX usage of tasks would be more informative and precise. The mechanism

[RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-07 Thread Aubrey Li
XSAVES and its variants use init optimization to reduce the amount of data that they save to memory during context switch. Init optimization uses the state component bitmap to denote if a component is in its init configuration. We use this information to detect if a task contains AVX instructions.

[RFC PATCH v2 1/2] x86/fpu: detect AVX task

2018-11-07 Thread Aubrey Li
XSAVES and its variants use init optimization to reduce the amount of data that they save to memory during context switch. Init optimization uses the state component bitmap to denote if a component is in its init configuration. We use this information to detect if a task contains AVX instructions.