Re: [PATCH 14/20] x86/barrier: Use alternative_io() in 32-bit barrier functions
From: Ingo Molnar
Date: Sat Mar 15 2025 - 04:48:10 EST
* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 14 Mar 2025 at 14:09, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> >
> > Thing is, we still have alternative(), which is also an asm wrapper, but
> > it's for when the caller doesn't care about adding any constraints.
> >
> > So the "_io()" distinguishes from that.
>
> .. but I think it does so very badly because "io" really means
> something else entirely in absolutely all other contexts.
Yeah, alternative_io() is really a misnomer we should fix.
As a minor side note, it's *doubly* a misnomer, because 'io' mixes up
the defined 'o/i' order of the output/input constraints:
arch/x86/include/asm/alternative.h:#define alternative_io(oldinstr, newinstr, ft_flags, output, input...) \
So it should have been alternative_oi().
> And it really makes no sense as "io", since it doesn't take inputs and
> outputs, it takes inputs, outputs AND CLOBBERS.
>
> So it would make more sense to call it "ioc", but that's just obvious
> nonsense, and "ioc" is already taken as a globally recognized
> shorthand for "corruption in sports".
lol ...
> So "ioc" is bad too, but that should make you go "Oh, 'io' is _doubly_
> nonsensical".
>
> Ergo: I think "asm" would be a better distinguishing marker, withg the
> plain "alternative()" being used for particularly simple asms.
Yeah, alternative_asm() or alternative_opts(). Anything but '_io()' :-)
Thanks,
Ingo