Re: [PATCH 2/8] um: Check for missing AVX and AVX-512 xstate bits
David Laight <[email protected]> Fri, 26 Jun 2026 08:41:13 +0100
| Newsgroups | org.infradead.lists.linux-um,org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel,org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <20260626084113.42eae31c@pumpkin> |
On Thu, 25 Jun 2026 21:37:25 -0700 Eric Biggers <[email protected]> wrote: > If the CPU declares AVX or AVX-512 support, verify that all the > corresponding xstate bits are also set. If any are missing, warn and > don't set the corresponding X86_FEATURE_* flags. > > This eliminates the perceived need for UML-supporting AVX and AVX-512 > optimized code in the kernel (that is, lib/raid/ currently) to start > checking the xstate bits in addition to X86_FEATURE_AVX*. > ... > static void __init parse_host_cpu_flags(char *line) > { > + u64 xcr0 = read_xcr0(); > int i; > + > for (i = 0; i < 32*NCAPINTS; i++) { > if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i])) 'line' comes from /proc/cpuinfo Surely something would be terribly wrong if that included something the kernel had disabled (or didn't support). David > - set_cpu_cap(&boot_cpu_data, i); > + validate_and_set_cpu_cap(i, xcr0); > } > } > > static void __init parse_cache_line(char *line) > {