On 11/3/21 15:52, Herbert Xu wrote:
On Wed, Nov 03, 2021 at 07:43:43AM -0700, Dave Hansen wrote:
The kernel shouldn't crash in this case. We've got a software
dependency which should disable AVX2 if AVX is off:
It's qemu, I thought it was a qemu bug but Paulo disagrees.
I don't disagree that QEMU could do better in preventing nonsensical
combinations; however, independent of that you shouldn't use AVX2
without factoring XCR0 in the decision. This is true no matter if
userspace/kernel or even bare metal/virt.
That does not have to be done directly with cpu_has_xfeatures as in
Maxim's patch: if boot_cpu_has(AVX) returns false after
xsave_cpuid_features has filtered it out, or if boot_cpu_has(AVX2)
returns false after cpuid_deps has filtered it out, that's fine. I
guess Maxim can look at the pointers that Dave provided and check if
there's another bug somewhere in arch/x86/kernel.
Paolo