Linux patch disabling AVX when eagerfpu is turned off - possibly not required
Regarding the patch disabling AVX when eagerfpu is off:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=394db20ca240741a08d472173db13d6f6a6e5a28
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.
Quoted 4 lines · Leonid Shatz
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?
Quoted 6 lines · Dave Hansen
Quoted 4 lines · Leonid Shatz
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.
Quoted 7 lines
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
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Dave Hansen
Quoted 4 lines · Leonid Shatz
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,
Quoted 7 lines
Quoted 5 lines
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
Hello Leonid,
You are probably right. Let me check this and get back to you.
Thanks,
Yu-cheng
Quoted 7 lines · Yu-cheng Yu
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
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Yu-cheng Yu
Hello Leonid,
You are probably right. Let me check this and get back to you.
Thanks,
Yu-cheng
Quoted 6 lines
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!
Quoted 9 lines · H. Peter Anvin
Quoted 9 lines · Yu-cheng Yu
Quoted 7 lines
Hello Leonid,
You are probably right. Let me check this and get back to you.
Thanks,
Yu-cheng
Quoted 7 lines
Quoted 6 lines
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
Quoted 5 lines · Leonid Shatz
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