Re: [paulmck-rcu:dev.2024.05.18a 44/51] update.c:undefined reference to `cmpxchg_emu_u8'
From: Paul E. McKenney
Date: Wed May 29 2024 - 13:26:29 EST
On Wed, May 29, 2024 at 03:54:26PM +0800, Yujie Liu wrote:
> On Tue, May 28, 2024 at 12:26:43PM -0700, Paul E. McKenney wrote:
> > On Mon, May 27, 2024 at 01:25:58PM +0800, kernel test robot wrote:
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2024.05.18a
> > > head: 0e3eb8082184e066eb389f5e6f9c7b8c2d452d66
> > > commit: c48887df74a95090e633a29ffbcef00b71cdab66 [44/51] rcu-tasks: Remove open-coded one-byte cmpxchg() emulation
> > > config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240527/202405271352.XYjxKyUi-lkp@xxxxxxxxx/config)
> > > compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240527/202405271352.XYjxKyUi-lkp@xxxxxxxxx/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202405271352.XYjxKyUi-lkp@xxxxxxxxx/
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > > /usr/bin/ld: kernel/rcu/update.o: in function `rcu_trc_cmpxchg_need_qs':
> > > >> update.c:(.text+0x27d5): undefined reference to `cmpxchg_emu_u8'
> > > /usr/bin/ld: kernel/rcu/update.o: in function `trc_read_check_handler':
> > > update.c:(.text+0x2839): undefined reference to `cmpxchg_emu_u8'
> > > >> /usr/bin/ld: update.c:(.text+0x2882): undefined reference to `cmpxchg_emu_u8'
> > > /usr/bin/ld: kernel/rcu/update.o: in function `trc_inspect_reader':
> > > update.c:(.text+0x52ce): undefined reference to `cmpxchg_emu_u8'
> > > /usr/bin/ld: update.c:(.text+0x5330): undefined reference to `cmpxchg_emu_u8'
> > > /usr/bin/ld: kernel/rcu/update.o:update.c:(.text+0x5933): more undefined references to `cmpxchg_emu_u8' follow
> > > >> collect2: error: ld returned 1 exit status
> >
> > Good catch!!!
> >
> > Does the patch below clear this up?
>
> The patch below will select ARCH_NEED_CMPXCHG_1_EMU by default on um
> arch, so that cmpxchg-emu.o can be built, and it fixes the link error
> for me.
>
> Tested-by: Yujie Liu <yujie.liu@xxxxxxxxx>
Thank you! I will apply your Tested-by on my next rebase.
Thanx, Paul
> >
> > ------------------------------------------------------------------------
> >
> > commit 47450c70303a11da1bd650403844ad9e688f05a4
> > Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
> > Date: Tue May 28 12:15:06 2024 -0700
> >
> > um: Emulate one-byte cmpxchg
> >
> > Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on um.
> >
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/all/202405271352.XYjxKyUi-lkp@xxxxxxxxx/
> > Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> > Cc: Richard Weinberger <richard@xxxxxx>
> > Cc: Anton Ivanov <anton.ivanov@xxxxxxxxxxxxxxxxxx>
> > Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> > Cc: <linux-um@xxxxxxxxxxxxxxxxxxx>
> >
> > diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> > index 93a5a8999b07e..5fc55e1d71122 100644
> > --- a/arch/um/Kconfig
> > +++ b/arch/um/Kconfig
> > @@ -11,6 +11,7 @@ config UML
> > select ARCH_HAS_KCOV
> > select ARCH_HAS_STRNCPY_FROM_USER
> > select ARCH_HAS_STRNLEN_USER
> > + select ARCH_NEED_CMPXCHG_1_EMU
> > select ARCH_NO_PREEMPT
> > select HAVE_ARCH_AUDITSYSCALL
> > select HAVE_ARCH_KASAN if X86_64
> >