Re: [GIT PULL] Add two-byte cmpxchg emulation function for v7.4
From: Paul E. McKenney
Date: Tue Nov 03 2026 - 15:33:23 EST
On Tue, Nov 03, 2026 at 09:11:17PM +0100, Jan Engelhardt wrote:
>
> On Tuesday 2026-11-03 19:19, Paul E. McKenney wrote:
> >> >>
> >> >> I can get gcc-17.0.0-20261102 with no further command line options
> >> >> to turn `atomic_compare_exchange_strong`+uint16 into some object code
> >> >> that does not contain a call to libatomic, for sh2, sh3, sh4. Haven't
> >> >> tried xtensa or the others.
> >> >> Thus, is the patch really needed?
> >> >
> >> >Won't that need a big jump in the minimum supported compiler version?
> >>
> >> 12.0.0-20210420 behaves the same. I just chose 17 because that was
> >> convenient to try first.
> >
> >Are you also advocating ditching the single-byte cmpxchg() emulation?
>
> There is more?
Indeed there is, and has been for some years. See cmpxchg_emu_u8()
in that same file.
> Please note, I have not looked at the code at all. The patch
> description _alone_ was enough to make me ask, such conflicting
> rationale it had when presented to me.
>
> I had not planned to go on an expedition to see what gcc would
> produce, and was hoping the patch author had done that initially,
> to provide a good case for his patch rather than against it.
I am also not planning to go on such an expedition. ;-)
The case for the patch is that it is a simple and small change that
enables cmpxchg() on two-byte arguments to be used in common code.
Another advantage is that it works on all compilers currently supported
by the Linux kernel, no expeditions required.
When and if someone comes up with a better patch, then yes, we should
of course consider it.
Thanx, Paul