Re: [paulmck-rcu:dev.2024.03.27b 64/69] arch/xtensa/include/asm/cmpxchg.h:77:25: error: implicit declaration of function 'cmpxchg_emu_u8'

From: Yujie Liu
Date: Sun Mar 31 2024 - 12:00:03 EST


On Fri, Mar 29, 2024 at 11:48:37AM -0700, Paul E. McKenney wrote:
> On Fri, Mar 29, 2024 at 11:08:04PM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2024.03.27b
> > head: 786fab3085d764055a78edb54023420920344333
> > commit: b3b1a154281fc97efc4c1d5818a83c29c228dbd5 [64/69] xtensa: Emulate one-byte and two-byte cmpxchg
> > config: xtensa-allnoconfig (https://download.01.org/0day-ci/archive/20240329/202403292321.T55etywH-lkp@xxxxxxxxx/config)
> > compiler: xtensa-linux-gcc (GCC) 13.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240329/202403292321.T55etywH-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/202403292321.T55etywH-lkp@xxxxxxxxx/
> >
> > All errors (new ones prefixed by >>):
> >
> > In file included from arch/xtensa/include/asm/atomic.h:19,
> > from include/linux/atomic.h:7,
> > from include/asm-generic/bitops/atomic.h:5,
> > from arch/xtensa/include/asm/bitops.h:192,
> > from include/linux/bitops.h:68,
> > from include/linux/log2.h:12,
> > from kernel/bounds.c:13:
> > arch/xtensa/include/asm/cmpxchg.h: In function '__cmpxchg':
> > >> arch/xtensa/include/asm/cmpxchg.h:77:25: error: implicit declaration of function 'cmpxchg_emu_u8' [-Werror=implicit-function-declaration]
> > 77 | case 1: return cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
> > | ^~~~~~~~~~~~~~
>
> Good catch! Does the diff at the end fix this?

The error is fixed by the diff at the end.

Tested-by: Yujie Liu <yujie.liu@xxxxxxxxx>

>
> Thanx, Paul
>
> > >> arch/xtensa/include/asm/cmpxchg.h:78:25: error: implicit declaration of function 'cmpxchg_emu_u16' [-Werror=implicit-function-declaration]
> > 78 | case 2: return cmpxchg_emu_u16((volatile u16 *)ptr, old, new);
> > | ^~~~~~~~~~~~~~~
> > cc1: some warnings being treated as errors
> > make[3]: *** [scripts/Makefile.build:117: kernel/bounds.s] Error 1
> > make[3]: Target 'prepare' not remade because of errors.
> > make[2]: *** [Makefile:1197: prepare0] Error 2
> > make[2]: Target 'prepare' not remade because of errors.
> > make[1]: *** [Makefile:240: __sub-make] Error 2
> > make[1]: Target 'prepare' not remade because of errors.
> > make: *** [Makefile:240: __sub-make] Error 2
> > make: Target 'prepare' not remade because of errors.
> >
> >
> > vim +/cmpxchg_emu_u8 +77 arch/xtensa/include/asm/cmpxchg.h
> >
> > 72
> > 73 static __inline__ unsigned long
> > 74 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
> > 75 {
> > 76 switch (size) {
> > > 77 case 1: return cmpxchg_emu_u8((volatile u8 *)ptr, old, new);
> > > 78 case 2: return cmpxchg_emu_u16((volatile u16 *)ptr, old, new);
> > 79 case 4: return __cmpxchg_u32(ptr, old, new);
> > 80 default: __cmpxchg_called_with_bad_pointer();
> > 81 return old;
> > 82 }
> > 83 }
> > 84
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
>
> commit 663161aaa5c3286dcfc9ba2cd9e12170f9354ea7
> Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Date: Fri Mar 29 11:47:13 2024 -0700
>
> squash! xtensa: Emulate one-byte and two-byte cmpxchg
>
> [ paulmck: Apply kernel test robot feedback. ]
>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
>
> diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h
> index bcce915a98e21..a0f9a2070209b 100644
> --- a/arch/xtensa/include/asm/cmpxchg.h
> +++ b/arch/xtensa/include/asm/cmpxchg.h
> @@ -15,6 +15,7 @@
>
> #include <linux/bits.h>
> #include <linux/stringify.h>
> +#include <linux/cmpxchg-emu.h>
>
> /*
> * cmpxchg
>