Linux 5.19 Makes It Much Easier To Clear CPUID Features
Rather annoyingly, up to now if wanting to disable select CPUID features from use by the Linux kernel, you've needed to look at the cpufeatures.h header file within the x86 area of the kernel and find the bit number for the given feature(s) you want to disable. Like, for example, disabling AVX meant setting clearcpuid=156. Even worse, some of the bit numbers aren't stable across Linux kernel versions.
Going through a header file to figure out a bit number to pass to a kernel parameter isn't exactly intuitive.
With Linux 5.19, the clearcpuid= kernel parameter can be set to strings from the flags output in /proc/cpuinfo. So rather than needing to remember numbers like clearcpuid=156, you could just do clearcpuid=avx. Multiple CPUID flags can continue to be specified via delimiting them with commas.
But with Linux 5.19+, now you can just pass it the flag values shown within /proc/cpuinfo.
This is a long overdue improvement for a kernel usability improvement for administrators and those debugging kernel behavior on their systems. The bit numbers can still be used if desired while for Linux 5.19+ the feature bit names are fair game. It's important to note though that using clearcpuid= to clear CPUID bits isn't intended for production use. User-space software calling CPUID directly or just directly using any relevant instructions will continue to work, clearcpuid= is just about avoiding the usage by the Linux kernel and removing it from the /proc/cpuinfo output too. Linux 5.19 is additionally treating the kernel as tainted when clearcpuid is in use.
This change was sent in as part of the x86/cpu updates for Linux 5.19. This pull also drops the nosep, nosmep, noexec, and noclflush kernel parameters with no longer being relevant for having said dedicated options.