On Wed, Dec 4, 2024, at 19:10, Linus Torvalds wrote: > "On second thought , let’s not go to x86-64 microarchitectural > levels. ‘Tis a silly place" Fair enough. I'll just make it use -march=x86_64 to override the compiler default then. > On Wed, 4 Dec 2024 at 02:31, Arnd Bergmann <arnd@xxxxxxxxxx> wrote: >> >> To allow reliably building a kernel for either the oldest x86-64 >> CPUs or a more recent level, add three separate options for >> v1, v2 and v3 of the architecture as defined by gcc and clang >> and make them all turn on CONFIG_GENERIC_CPU. > > The whole "v2", "v3", "v4" etc naming seems to be some crazy glibc > artifact and is stupid and needs to die. > > It has no relevance to anything. Please do *not* introduce that > mind-fart into the kernel sources. > > I have no idea who came up with the "microarchitecture levels" > garbage, but as far as I can tell, it's entirely unofficial, and it's > a completely broken model. I agree that both the name and the concept are broken. My idea was based on how distros (Red Hat Enterprise Linux at least) already use the same levels for making userspace require newer CPUs, so using the same flag for the kernel makes some sense. Making a point about the levels being stupid is a useful goal as well. > There is a very real model for microarchitectural features, and it's > the CPUID bits. Trying to linearize those bits is technically wrong, > since these things simply aren't some kind of linear progression. > > And worse, it's a "simplification" that literally adds complexity. Now > instead of asking "does this CPU support the cmpxchgb16 instruction?", > the question instead becomes one of "what the hell does 'v3' mean > again?" I guess the other side of it is that the current selection between pentium4/core2/k8/bonnell/generic is not much better, given that in practice nobody has any of the pentium4/core2/k8/bonnell variants any more. A more radical solution would be to just drop the entire menu for 64-bit kernels and always default to "-march=x86_64 -mtune=generic" and 64 byte L1 cachelines. Arnd