linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux patch disabling AVX when eagerfpu is turned off - possibly not required
@ 2016-01-21 10:33 Leonid Shatz
  2016-01-21 20:08 ` Dave Hansen
  2016-01-21 21:03 ` Yu-cheng Yu
  0 siblings, 2 replies; 9+ messages in thread
From: Leonid Shatz @ 2016-01-21 10:33 UTC (permalink / raw)
  To: 'Ingo Molnar', linux-kernel, 'Yu-cheng Yu',
	'Andy Lutomirski', 'Borislav Petkov',
	'Dave Hansen', 'Fenghua Yu',
	'H. Peter Anvin', 'Linus Torvalds',
	'Oleg Nesterov', 'Peter Zijlstra',
	'Quentin Casasnovas', 'Ravi V. Shankar',
	'Sai Praneeth Prakhya', 'Thomas Gleixner'
  Cc: liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

Regarding the patch disabling AVX when eagerfpu is off:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3
94db20ca240741a08d472173db13d6f6a6e5a28

We have a suggestion that Intel documentation related to usage of CR0.TS bit
may be not properly updated with additional support of AVX/AVX2/etc
instructions. In fact, there is certain ambiguity about the causes of #NM
exception in other sections of Intel documentation. Based on the chapter 2.4
INSTRUCTION EXCEPTION SPECIFICATION of Intel 64 and IA-32 Architectures
Software Developer's Manual, all SSE/SSE2/SSE4/MMX/AVX/etc. instructions,
which modify the FPU/MMX/AVX state are supposed to generate #NM exception
when CR0.TS = 1.

In addition, based on AMD documentation, the #NM exception is generated for
both SSE and AVX instructions in protected mode - refer to AMD64
Architecture Programmer's Manual Volume 4: 128-Bit and 256-Bit Media
Instructions and also "AMD64 Architecture
Programmer's Manual Volume 2: System Programming" Chapter 3.1 (Task Switched
(TS) Bit.3. When an attempt is made to execute an x87 or media instruction
while TS=1, a device-not-available exception (#NM) occurs).

Also, in our limited internal test on Intel I7 processor (repeated on two
different machines), while executing the AVX VMOVAPS instruction with CR0.TS
bit set, we've observed the #NM exception being always generated (although
we didn't perform all-inclusive tests for entire set of AVX and similar new
instructions).

In view of above findings we would like to suggest to double check if
disabling AVX together with "eagerfpu off" is actually required and is a
real necessity. It would be helpful to consult with Intel engineers
regarding related design details.

Sincerely,
Leonid Shatz,
Seniour Software Enigneer, Hypervisor Team,
Ravello Systems, Inc.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 10:33 Linux patch disabling AVX when eagerfpu is turned off - possibly not required Leonid Shatz
@ 2016-01-21 20:08 ` Dave Hansen
  2016-01-21 20:11   ` H. Peter Anvin
  2016-01-21 21:03 ` Yu-cheng Yu
  1 sibling, 1 reply; 9+ messages in thread
From: Dave Hansen @ 2016-01-21 20:08 UTC (permalink / raw)
  To: Leonid Shatz, 'Ingo Molnar', linux-kernel,
	'Yu-cheng Yu', 'Andy Lutomirski',
	'Borislav Petkov', 'Fenghua Yu',
	'H. Peter Anvin', 'Linus Torvalds',
	'Oleg Nesterov', 'Peter Zijlstra',
	'Quentin Casasnovas', 'Ravi V. Shankar',
	'Sai Praneeth Prakhya', 'Thomas Gleixner'
  Cc: liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

On 01/21/2016 02:33 AM, Leonid Shatz wrote:
> In view of above findings we would like to suggest to double check if
> disabling AVX together with "eagerfpu off" is actually required and is a
> real necessity. It would be helpful to consult with Intel engineers
> regarding related design details.

Hi Leonid,

Thanks for the report!

Are you aware of any actual eagerfpu=off use in practice, or is this
mostly a theoretical concern?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 20:08 ` Dave Hansen
@ 2016-01-21 20:11   ` H. Peter Anvin
  2016-01-21 21:03     ` Andy Lutomirski
  0 siblings, 1 reply; 9+ messages in thread
From: H. Peter Anvin @ 2016-01-21 20:11 UTC (permalink / raw)
  To: Dave Hansen, Leonid Shatz, 'Ingo Molnar', linux-kernel,
	'Yu-cheng Yu', 'Andy Lutomirski',
	'Borislav Petkov', 'Fenghua Yu',
	'Linus Torvalds', 'Oleg Nesterov',
	'Peter Zijlstra', 'Quentin Casasnovas',
	'Ravi V. Shankar', 'Sai Praneeth Prakhya',
	'Thomas Gleixner'
  Cc: liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

On 01/21/16 12:08, Dave Hansen wrote:
> On 01/21/2016 02:33 AM, Leonid Shatz wrote:
>> In view of above findings we would like to suggest to double check if
>> disabling AVX together with "eagerfpu off" is actually required and is a
>> real necessity. It would be helpful to consult with Intel engineers
>> regarding related design details.
> 
> Hi Leonid,
> 
> Thanks for the report!
> 
> Are you aware of any actual eagerfpu=off use in practice, or is this
> mostly a theoretical concern?
> 

Looking into this, FWIW.

	-hpa

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 20:11   ` H. Peter Anvin
@ 2016-01-21 21:03     ` Andy Lutomirski
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Lutomirski @ 2016-01-21 21:03 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Thomas Gleixner, Borislav Petkov, Eyal Moscovici, Ravi V. Shankar,
	liran.alon, Quentin Casasnovas, Ingo Molnar, Leonid Shatz,
	Sai Praneeth Prakhya, Linus Torvalds, Fenghua Yu, gil.hoffer,
	linux-kernel@vger.kernel.org, Elazar Leibovich, Oleg Nesterov,
	Dave Hansen, mendel.aizner, Peter Zijlstra, Yu-cheng Yu

On Jan 21, 2016 12:12 PM, "H. Peter Anvin" <hpa@zytor.com> wrote:
>
> On 01/21/16 12:08, Dave Hansen wrote:
> > On 01/21/2016 02:33 AM, Leonid Shatz wrote:
> >> In view of above findings we would like to suggest to double check if
> >> disabling AVX together with "eagerfpu off" is actually required and is a
> >> real necessity. It would be helpful to consult with Intel engineers
> >> regarding related design details.
> >
> > Hi Leonid,
> >
> > Thanks for the report!
> >
> > Are you aware of any actual eagerfpu=off use in practice, or is this
> > mostly a theoretical concern?
> >
>
> Looking into this, FWIW.

I still think that we should default eagerfpu=on on all CPUs for one
release and then, when nothing breaks, delete all the old lazy code.
I'll respin and send that patch.

--Andy

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 10:33 Linux patch disabling AVX when eagerfpu is turned off - possibly not required Leonid Shatz
  2016-01-21 20:08 ` Dave Hansen
@ 2016-01-21 21:03 ` Yu-cheng Yu
  2016-01-21 21:08   ` H. Peter Anvin
  1 sibling, 1 reply; 9+ messages in thread
From: Yu-cheng Yu @ 2016-01-21 21:03 UTC (permalink / raw)
  To: Leonid Shatz
  Cc: 'Ingo Molnar', linux-kernel, 'Andy Lutomirski',
	'Borislav Petkov', 'Dave Hansen',
	'Fenghua Yu', 'H. Peter Anvin',
	'Linus Torvalds', 'Oleg Nesterov',
	'Peter Zijlstra', 'Quentin Casasnovas',
	'Ravi V. Shankar', 'Sai Praneeth Prakhya',
	'Thomas Gleixner', liran.alon, mendel.aizner,
	'Elazar Leibovich', 'Eyal Moscovici', gil.hoffer

Hello Leonid,

You are probably right. Let me check this and get back to you.

Thanks,
Yu-cheng

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 21:03 ` Yu-cheng Yu
@ 2016-01-21 21:08   ` H. Peter Anvin
  2016-01-21 21:12     ` Yu-cheng Yu
  0 siblings, 1 reply; 9+ messages in thread
From: H. Peter Anvin @ 2016-01-21 21:08 UTC (permalink / raw)
  To: Yu-cheng Yu, Leonid Shatz
  Cc: 'Ingo Molnar', linux-kernel, 'Andy Lutomirski',
	'Borislav Petkov', 'Dave Hansen',
	'Fenghua Yu', 'Linus Torvalds',
	'Oleg Nesterov', 'Peter Zijlstra',
	'Quentin Casasnovas', 'Ravi V. Shankar',
	'Sai Praneeth Prakhya', 'Thomas Gleixner',
	liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

On 01/21/16 13:03, Yu-cheng Yu wrote:
> Hello Leonid,
> 
> You are probably right. Let me check this and get back to you.
> 
> Thanks,
> Yu-cheng
> 

The hardware people have gotten back to us and this inconsistency in the
SDM is unintentional (other places in the SDM has it correctly.)  So we
should revert this patch.

	-hpa

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 21:08   ` H. Peter Anvin
@ 2016-01-21 21:12     ` Yu-cheng Yu
  2016-01-21 21:19       ` Leonid Shatz
  0 siblings, 1 reply; 9+ messages in thread
From: Yu-cheng Yu @ 2016-01-21 21:12 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Leonid Shatz, 'Ingo Molnar', linux-kernel,
	'Andy Lutomirski', 'Borislav Petkov',
	'Dave Hansen', 'Fenghua Yu',
	'Linus Torvalds', 'Oleg Nesterov',
	'Peter Zijlstra', 'Quentin Casasnovas',
	'Ravi V. Shankar', 'Sai Praneeth Prakhya',
	'Thomas Gleixner', liran.alon, mendel.aizner,
	'Elazar Leibovich', 'Eyal Moscovici', gil.hoffer

On Thu, Jan 21, 2016 at 01:08:18PM -0800, H. Peter Anvin wrote:
> On 01/21/16 13:03, Yu-cheng Yu wrote:
> > Hello Leonid,
> > 
> > You are probably right. Let me check this and get back to you.
> > 
> > Thanks,
> > Yu-cheng
> > 
> 
> The hardware people have gotten back to us and this inconsistency in the
> SDM is unintentional (other places in the SDM has it correctly.)  So we
> should revert this patch.
> 
> 	-hpa
> 
Agree. Thanks Peter and Leonid!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 21:12     ` Yu-cheng Yu
@ 2016-01-21 21:19       ` Leonid Shatz
  2016-01-21 21:22         ` H. Peter Anvin
  0 siblings, 1 reply; 9+ messages in thread
From: Leonid Shatz @ 2016-01-21 21:19 UTC (permalink / raw)
  To: 'Yu-cheng Yu', 'H. Peter Anvin'
  Cc: 'Ingo Molnar', linux-kernel, 'Andy Lutomirski',
	'Borislav Petkov', 'Dave Hansen',
	'Fenghua Yu', 'Linus Torvalds',
	'Oleg Nesterov', 'Peter Zijlstra',
	'Quentin Casasnovas', 'Ravi V. Shankar',
	'Sai Praneeth Prakhya', 'Thomas Gleixner',
	liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

On Thu, Jan 21, 2016 at 01:08:18PM -0800, H. Peter Anvin wrote:
>> On 01/21/16 13:03, Yu-cheng Yu wrote:
>> > Hello Leonid,
>> > 
>> > You are probably right. Let me check this and get back to you.
>> > 
>> > Thanks,
>> > Yu-cheng
>> > 
>> 
>> The hardware people have gotten back to us and this inconsistency in 
>> the SDM is unintentional (other places in the SDM has it correctly.)  
>> So we should revert this patch.
>> 
>> 	-hpa
>> 
>Agree. Thanks Peter and Leonid!

Thank you all for your feedback and clarifications. That's was my assumption
that SDM was somewhat misleading, but I was not %100 sure about it. It could
be nice, though to see future releases of SDM taking this issue in account.

Leonid

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux patch disabling AVX when eagerfpu is turned off - possibly not required
  2016-01-21 21:19       ` Leonid Shatz
@ 2016-01-21 21:22         ` H. Peter Anvin
  0 siblings, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2016-01-21 21:22 UTC (permalink / raw)
  To: Leonid Shatz, 'Yu-cheng Yu'
  Cc: 'Ingo Molnar', linux-kernel, 'Andy Lutomirski',
	'Borislav Petkov', 'Dave Hansen',
	'Fenghua Yu', 'Linus Torvalds',
	'Oleg Nesterov', 'Peter Zijlstra',
	'Quentin Casasnovas', 'Ravi V. Shankar',
	'Sai Praneeth Prakhya', 'Thomas Gleixner',
	liran.alon, mendel.aizner, 'Elazar Leibovich',
	'Eyal Moscovici', gil.hoffer

On 01/21/16 13:19, Leonid Shatz wrote:
> 
> Thank you all for your feedback and clarifications. That's was my assumption
> that SDM was somewhat misleading, but I was not %100 sure about it. It could
> be nice, though to see future releases of SDM taking this issue in account.
> 

It will.

	-hpa

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-01-21 21:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 10:33 Linux patch disabling AVX when eagerfpu is turned off - possibly not required Leonid Shatz
2016-01-21 20:08 ` Dave Hansen
2016-01-21 20:11   ` H. Peter Anvin
2016-01-21 21:03     ` Andy Lutomirski
2016-01-21 21:03 ` Yu-cheng Yu
2016-01-21 21:08   ` H. Peter Anvin
2016-01-21 21:12     ` Yu-cheng Yu
2016-01-21 21:19       ` Leonid Shatz
2016-01-21 21:22         ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).