Re: [PATCH] [RFC] x86/cpu: rework instruction set selection
From: David Laight
Date: Wed Apr 30 2025 - 17:55:00 EST
On Sat, 26 Apr 2025 12:24:37 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sat, 26 Apr 2025 at 11:59, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >
> > Right. With the current set of features, CMOV is almost the
> > same as 686. My reasoning was that support for CMOV has a
> > very clear definition, with the instruction either being
> > available or not.
>
> Yeah, I don't think there's any reason to make CMOV a reason to drop support.
>
> It has questionable performance impact - I doubt anybody can measure
> it - and the "maintenance burden" is basically a single compiler flag.
There is also the user/kernel address check for copy_to/from_user (etc).
The 'cmov' version used for 64bit is nice and succinct (as well as being
speculative execution safe).
Unlike the 'sbb' version it doesn't rely on the first access being to
the first address of the buffer (or page 0 not being mapped).
But I'd guess that the kernel ought to have a boot time test for some
of these instructions - so at least it fails gracefully.
Which would required compiling some early code without cmov.
David