Re: [jlayton:mgtime 5/13] inode.c:undefined reference to `__invalid_cmpxchg_size'

From: Geert Uytterhoeven
Date: Tue Jul 09 2024 - 09:46:30 EST


Hi Jeff,

On Tue, Jul 9, 2024 at 1:58 PM Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> I've been getting some of these warning emails from the KTR. I think
> this is in reference to this patch, which adds a 64-bit try_cmpxchg in
> the timestamp handling code:
>
> https://lore.kernel.org/linux-fsdevel/20240708-mgtime-v4-0-a0f3c6fb57f3@xxxxxxxxxx/
>
> On m68k, there is a prototype for __invalid_cmpxchg_size, but no actual
> function, AFAICT. Should that be defined somewhere, or is this a
> deliberate way to force a build break in this case?

It's a deliberate way to break the build.

> More to the point though: do I need to do anything special for m86k
> here (or for other arches that can't do a native 64-bit cmpxchg)?

64-bit cmpxchg() is only guaranteed to exist on 64-bit platforms.
See also
https://elixir.bootlin.com/linux/latest/source/include/asm-generic/cmpxchg.h#L62

I think you can use arch_cmpxchg64(), though.

> ---------- Forwarded message ----------
> From: kernel test robot <lkp@xxxxxxxxx>

> m68k-linux-ld: fs/inode.o: in function `inode_set_ctime_current':
> >> inode.c:(.text+0x167a): undefined reference to `__invalid_cmpxchg_size'

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds