Skip to contentSkip to conversation

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

PATCH kernel test robot 4 participants 8 messages Sep 23 – Sep 30

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,

                    from include/linux/atomic.h:7,
                    from include/asm-generic/bitops/lock.h:5,
                    from arch/arc/include/asm/bitops.h:190,
                    from include/linux/bitops.h:67,
                    from include/linux/log2.h:12,
                    from kernel/bounds.c:14:
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_' [-Wunused-variable]
      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_' [-Wunused-variable]
      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_' [-Wunused-variable]
      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_' [-Wunused-variable]
      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_' [-Wunused-variable]
      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_' [-Wunused-variable]
      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_' [-Wunused-variable]
      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
>> arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_' [-Wunused-variable]
      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

    66	
    67	#define arch_cmpxchg(ptr, old, new)				        \
    68	({									\
    69		volatile __typeof__(ptr) _p_ = (ptr);				\
  > 70		unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));		\
  > 71		unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));		\
    72		__typeof__(*(ptr)) _prev_;					\
    73		unsigned long __flags;						\
    74										\
    75		/*								\
    76		 * spin lock/unlock provide the needed smp_mb() before/after	\
    77		 */								\
    78		atomic_ops_lock(__flags);					\
    79		_prev_ = *_p_;							\
    80		if (_prev_ == _o_)						\
    81			*_p_ = _n_;						\
    82		atomic_ops_unlock(__flags);					\
    83		_prev_;								\
    84	})
    85	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#1 lore raw
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,

                   from include/linux/atomic.h:7,
                   from include/asm-generic/bitops/lock.h:5,
                   from arch/arc/include/asm/bitops.h:190,
                   from include/linux/bitops.h:67,
                   from include/linux/log2.h:12,
                   from kernel/bounds.c:14:
  include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
  arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
     80 |         if (_prev_ == _o_)                                              \
        |                       ^~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
   2026 |         return raw_cmpxchg(&v->counter, old, new);
        |                ^~~~~~~~~~~
  arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
     80 |         if (_prev_ == _o_)                                              \
        |                       ^~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
   2026 |         return raw_cmpxchg(&v->counter, old, new);
        |                ^~~~~~~~~~~
  arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
     81 |                 *_p_ = _n_;                                             \
        |                        ^~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
   2026 |         return raw_cmpxchg(&v->counter, old, new);
        |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

     71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
   2026 |         return raw_cmpxchg(&v->counter, old, new);
        |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

     70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
     55 | #define raw_cmpxchg arch_cmpxchg
        |                     ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
   2026 |         return raw_cmpxchg(&v->counter, old, new);
        |                ^~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
  arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
     80 |         if (_prev_ == _o_)                                              \
        |                       ^~~
  include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
     70 | #define raw_cmpxchg_acquire arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
   2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
     81 |                 *_p_ = _n_;                                             \
        |                        ^~~
  include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
     70 | #define raw_cmpxchg_acquire arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
   2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

     71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
     70 | #define raw_cmpxchg_acquire arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
   2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

     70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
     70 | #define raw_cmpxchg_acquire arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
   2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
  arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
     80 |         if (_prev_ == _o_)                                              \
        |                       ^~~
  include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
     82 | #define raw_cmpxchg_release arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
   2083 |         return raw_cmpxchg_release(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
     81 |                 *_p_ = _n_;                                             \
        |                        ^~~
  include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
     82 | #define raw_cmpxchg_release arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
   2083 |         return raw_cmpxchg_release(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

     71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
     82 | #define raw_cmpxchg_release arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
   2083 |         return raw_cmpxchg_release(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

     70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
     82 | #define raw_cmpxchg_release arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
   2083 |         return raw_cmpxchg_release(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
  arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
     80 |         if (_prev_ == _o_)                                              \
        |                       ^~~
  include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
     91 | #define raw_cmpxchg_relaxed arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
  arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
     81 |                 *_p_ = _n_;                                             \
        |                        ^~~
  include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
     91 | #define raw_cmpxchg_relaxed arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

     71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
     91 | #define raw_cmpxchg_relaxed arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

     70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
        |                       ^~~~~
  include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
     91 | #define raw_cmpxchg_relaxed arch_cmpxchg
        |                             ^~~~~~~~~~~~
  include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
   2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
        |                ^~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

   66	
   67	#define arch_cmpxchg(ptr, old, new)				        \
   68	({									\
   69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

   72		__typeof__(*(ptr)) _prev_;					\
   73		unsigned long __flags;						\
   74										\
   75		/*								\
   76		 * spin lock/unlock provide the needed smp_mb() before/after	\
   77		 */								\
   78		atomic_ops_lock(__flags);					\
   79		_prev_ = *_p_;							\
   80		if (_prev_ == _o_)						\
   81			*_p_ = _n_;						\
   82		atomic_ops_unlock(__flags);					\
   83		_prev_;								\
   84	})
   85	
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc
--- Thanks!
"I'm not a very positive person" - Linus torvalds

maintainer
#2 lore raw
Quoted 223 lines · Bradley Morgan
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,

                    from include/linux/atomic.h:7,
                    from include/asm-generic/bitops/lock.h:5,
                    from arch/arc/include/asm/bitops.h:190,
                    from include/linux/bitops.h:67,
                    from include/linux/log2.h:12,
                    from kernel/bounds.c:14:
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

    66	
    67	#define arch_cmpxchg(ptr, old, new)				        \
    68	({									\
    69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

    72		__typeof__(*(ptr)) _prev_;					\
    73		unsigned long __flags;						\
    74										\
    75		/*								\
    76		 * spin lock/unlock provide the needed smp_mb() before/after	\
    77		 */								\
    78		atomic_ops_lock(__flags);					\
    79		_prev_ = *_p_;							\
    80		if (_prev_ == _o_)						\
    81			*_p_ = _n_;						\
    82		atomic_ops_unlock(__flags);					\
    83		_prev_;								\
    84	})
    85	
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its not dead, if anything it is still my hobby project, like so many other things open source and you repeating this hurts.

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming. @Paul can you please apply this in your tree and rebase the series on top. If not I can send this fix to Linus urgently, but it will cause some collisions. ---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type not pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type safe")

---
 arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
 arch/arc/include/asm/cmpxchg.h        | 4 ++--

 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arc/include/asm/atomic64-arcv2.h +0 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile void *ptr, u64 old, u64 new)

 }
 #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed

+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64 new) +{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed +
 static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)
 {
     s64 prev;

arch/arc/include/asm/cmpxchg.h +0 -0
index 76f43db0890f..66b3743c9400 100644
@@ -46,7 +46,7 @@

     __typeof__(*(ptr)) _n_ = (new);                    \
     __typeof__(*(ptr)) _prev_;                    \
                                     \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
     case 1:                                \
         _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \
         break;                            \
@@ -102,7 +102,7 @@
     __typeof__(ptr) _p_ = (ptr);                    \
     __typeof__(*(ptr)) _val_ = (val);                \
                                     \
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
     case 4:                                \
         _val_ = __arch_xchg(_p_, _val_);            \
         break;                            \

Signature · 1 line
2.53.0
#3 lore raw
Quoted 233 lines · Vineet Gupta
Quoted 223 lines · Bradley Morgan
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,

                    from include/linux/atomic.h:7,
                    from include/asm-generic/bitops/lock.h:5,
                    from arch/arc/include/asm/bitops.h:190,
                    from include/linux/bitops.h:67,
                    from include/linux/log2.h:12,
                    from kernel/bounds.c:14:
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

    66	
    67	#define arch_cmpxchg(ptr, old, new)				        \
    68	({									\
    69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

    72		__typeof__(*(ptr)) _prev_;					\
    73		unsigned long __flags;						\
    74										\
    75		/*								\
    76		 * spin lock/unlock provide the needed smp_mb() before/after	\
    77		 */								\
    78		atomic_ops_lock(__flags);					\
    79		_prev_ = *_p_;							\
    80		if (_prev_ == _o_)						\
    81			*_p_ = _n_;						\
    82		atomic_ops_unlock(__flags);					\
    83		_prev_;								\
    84	})
    85	
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its not dead, if anything it is still my hobby project, like so many other things open source and you repeating this hurts.

Quoted 5 lines

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming.
@Paul can you please apply this in your tree and rebase the series on top. If not I can send this fix to Linus urgently, but it will cause some collisions.

Thank you, Vineet!

Just to make sure I understand, I apply this patch, then Bradley sends me an updated version of his patch, which I apply on top of yours.

Just double-checking. ;-)

Thanx, Paul

Quoted 70 lines

---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type not pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type

safe")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

---
 arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
 arch/arc/include/asm/cmpxchg.h        | 4 ++--

 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arc/include/asm/atomic64-arcv2.h +6 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile
 void *ptr, u64 old, u64 new)
  }
  #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed
 
+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64
 new)
+{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed
+
  static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)

 {
     s64 prev;

arch/arc/include/asm/cmpxchg.h +1 -1
index 76f43db0890f..66b3743c9400 100644
@@ -46,7 +46,7 @@
      __typeof__(*(ptr)) _n_ = (new);                    \
      __typeof__(*(ptr)) _prev_;                    \
                                      \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
      case 1:                                \

         _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \
         break;                            \

arch/arc/include/asm/cmpxchg.h +1 -1
@@ -102,7 +102,7 @@
      __typeof__(ptr) _p_ = (ptr);                    \
      __typeof__(*(ptr)) _val_ = (val);                \
                                      \
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
      case 4:                                \
          _val_ = __arch_xchg(_p_, _val_);            \
          break;                            \
Signature · 1 line
2.53.0
#4 lore raw
In reply to Vineet Gupta
Quoted 233 lines · Vineet Gupta
Quoted 223 lines · Bradley Morgan
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,

                    from include/linux/atomic.h:7,
                    from include/asm-generic/bitops/lock.h:5,
                    from arch/arc/include/asm/bitops.h:190,
                    from include/linux/bitops.h:67,
                    from include/linux/log2.h:12,
                    from kernel/bounds.c:14:
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
      55 | #define raw_cmpxchg arch_cmpxchg
         |                     ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
    2026 |         return raw_cmpxchg(&v->counter, old, new);
         |                ^~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
      70 | #define raw_cmpxchg_acquire arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
    2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
      82 | #define raw_cmpxchg_release arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
    2083 |         return raw_cmpxchg_release(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
   arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
      80 |         if (_prev_ == _o_)                                              \
         |                       ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
   arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
      81 |                 *_p_ = _n_;                                             \
         |                        ^~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

      71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

      70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
         |                       ^~~~~
   include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
      91 | #define raw_cmpxchg_relaxed arch_cmpxchg
         |                             ^~~~~~~~~~~~
   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
         |                ^~~~~~~~~~~~~~~~~~~

make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

    66	
    67	#define arch_cmpxchg(ptr, old, new)				        \
    68	({									\
    69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

    72		__typeof__(*(ptr)) _prev_;					\
    73		unsigned long __flags;						\
    74										\
    75		/*								\
    76		 * spin lock/unlock provide the needed smp_mb() before/after	\
    77		 */								\
    78		atomic_ops_lock(__flags);					\
    79		_prev_ = *_p_;							\
    80		if (_prev_ == _o_)						\
    81			*_p_ = _n_;						\
    82		atomic_ops_unlock(__flags);					\
    83		_prev_;								\
    84	})
    85	
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its not dead, if anything it is still my hobby project, like so many other things open source and you repeating this hurts.

Quoted 5 lines

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming.
@Paul can you please apply this in your tree and rebase the series on top. If not I can send this fix to Linus urgently, but it will cause some collisions.

I tried applying this against current linux/master, v7.2, and v7.3-rc1, and no go. Please let me know what you based this on.

Or is this in your recent pull request from Linus? In which case, I could pull that and cherry-pick this patch.

Thanx, Paul

Quoted 70 lines

---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type not pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type

safe")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

---
 arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
 arch/arc/include/asm/cmpxchg.h        | 4 ++--

 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arc/include/asm/atomic64-arcv2.h +6 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile
 void *ptr, u64 old, u64 new)
  }
  #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed
 
+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64
 new)
+{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed
+
  static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)

 {
     s64 prev;

arch/arc/include/asm/cmpxchg.h +1 -1
index 76f43db0890f..66b3743c9400 100644
@@ -46,7 +46,7 @@
      __typeof__(*(ptr)) _n_ = (new);                    \
      __typeof__(*(ptr)) _prev_;                    \
                                      \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
      case 1:                                \

         _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \
         break;                            \

arch/arc/include/asm/cmpxchg.h +1 -1
@@ -102,7 +102,7 @@
      __typeof__(ptr) _p_ = (ptr);                    \
      __typeof__(*(ptr)) _val_ = (val);                \
                                      \
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
      case 4:                                \
          _val_ = __arch_xchg(_p_, _val_);            \
          break;                            \
Signature · 1 line
2.53.0
maintainer
#5 lore raw
Quoted 238 lines · Paul E. McKenney
Quoted 232 lines · Vineet Gupta
Quoted 223 lines · Bradley Morgan
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:190,
from include/linux/bitops.h:67,
from include/linux/log2.h:12,
from kernel/bounds.c:14:
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
     2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
     2083 |         return raw_cmpxchg_release(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
91 | #define raw_cmpxchg_relaxed arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
2108 | return raw_cmpxchg_relaxed(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
91 | #define raw_cmpxchg_relaxed arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
2108 | return raw_cmpxchg_relaxed(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
    make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161
    make[3]: Target 'prepare' not remade because of errors.
    make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161
    make[2]: Target 'prepare' not remade because of errors.
    make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
    make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

     66	
     67	#define arch_cmpxchg(ptr, old, new)				        \
     68	({									\
     69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

     72		__typeof__(*(ptr)) _prev_;					\
     73		unsigned long __flags;						\
     74										\
     75		/*								\
     76		 * spin lock/unlock provide the needed smp_mb() before/after	\
     77		 */								\
     78		atomic_ops_lock(__flags);					\
     79		_prev_ = *_p_;							\
     80		if (_prev_ == _o_)						\
     81			*_p_ = _n_;						\
     82		atomic_ops_unlock(__flags);					\
     83		_prev_;								\
     84	})
     85	
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its not dead, if anything it is still my hobby project, like so many other things open source and you repeating this hurts.

Quoted 5 lines

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming.
@Paul can you please apply this in your tree and rebase the series on top. If not I can send this fix to Linus urgently, but it will cause some collisions.

Quoted 5 lines

I tried applying this against current linux/master, v7.2, and v7.3-rc1, and no go. Please let me know what you based this on.

Or is this in your recent pull request from Linus? In which case, I could pull that and cherry-pick this patch.

Its the latter.

Thx,
-Vineet

Quoted 73 lines

Thanx, Paul

Quoted 70 lines

---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type not
 pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type

safe")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

---
  arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
  arch/arc/include/asm/cmpxchg.h        | 4 ++--
  2 files changed, 8 insertions(+), 2 deletions(-)
arch/arc/include/asm/atomic64-arcv2.h +6 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile
 void *ptr, u64 old, u64 new)
  }
  #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed
 
+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64
 new)
+{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed
+
  static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)

 {
     s64 prev;

arch/arc/include/asm/cmpxchg.h +1 -1
index 76f43db0890f..66b3743c9400 100644
@@ -46,7 +46,7 @@
      __typeof__(*(ptr)) _n_ = (new);                    \
      __typeof__(*(ptr)) _prev_;                    \
                                      \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
      case 1:                                \
          _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8
 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \

         break;                            \

arch/arc/include/asm/cmpxchg.h +1 -1
@@ -102,7 +102,7 @@
      __typeof__(ptr) _p_ = (ptr);                    \
      __typeof__(*(ptr)) _val_ = (val);                \
                                      \
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
      case 4:                                \
          _val_ = __arch_xchg(_p_, _val_);            \
          break;                            \
Signature · 1 line
2.53.0
#6 lore raw
Quoted 333 lines · Vineet Gupta
Quoted 3 lines · Paul E. McKenney
Quoted 2 lines · Vineet Gupta
Quoted 1 line · Bradley Morgan

On 23 September 2026 22:12:09 BST, kernel test robot <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate

two-byte cmpxchg

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

config: arc-randconfig-1001-20260924

(https://download.01.org/0day-ci/archive/20260924/[email protected]/config)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

compiler: arc-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build):

(https://download.01.org/0day-ci/archive/20260924/[email protected]/reproduce)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

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 <[email protected]>
| Closes:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7, from include/asm-generic/bitops/lock.h:5, from arch/arc/include/asm/bitops.h:190, from include/linux/bitops.h:67, from include/linux/log2.h:12, from kernel/bounds.c:14:
include/linux/atomic/atomic-arch-fallback.h: In function

'raw_atomic_cmpxchg':

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       80 |         if (_prev_ == _o_)                               
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in

expansion of macro 'raw_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
    arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared

identifier is reported only once for each function it appears in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       80 |         if (_prev_ == _o_)                               
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in

expansion of macro 'raw_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
    arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       81 |                 *_p_ = _n_;                              
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in

expansion of macro 'raw_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable

'_new_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_)

: (new)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in

expansion of macro 'raw_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable

'_old_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_)

: (old)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in

expansion of macro 'raw_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h: In function

'raw_atomic_cmpxchg_acquire':

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       80 |         if (_prev_ == _o_)                               
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in

expansion of macro 'raw_cmpxchg_acquire'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2055 |         return raw_cmpxchg_acquire(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
    arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       81 |                 *_p_ = _n_;                              
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in

expansion of macro 'raw_cmpxchg_acquire'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2055 |         return raw_cmpxchg_acquire(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable

'_new_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_)

: (new)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in

expansion of macro 'raw_cmpxchg_acquire'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2055 |         return raw_cmpxchg_acquire(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable

'_old_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_)

: (old)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in

expansion of macro 'raw_cmpxchg_acquire'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2055 |         return raw_cmpxchg_acquire(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function

'raw_atomic_cmpxchg_release':

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       80 |         if (_prev_ == _o_)                               
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in

expansion of macro 'raw_cmpxchg_release'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2083 |         return raw_cmpxchg_release(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
    arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       81 |                 *_p_ = _n_;                              
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in

expansion of macro 'raw_cmpxchg_release'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2083 |         return raw_cmpxchg_release(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable

'_new_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_)

: (new)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in

expansion of macro 'raw_cmpxchg_release'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2083 |         return raw_cmpxchg_release(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable

'_old_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_)

: (old)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in

expansion of macro 'raw_cmpxchg_release'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2083 |         return raw_cmpxchg_release(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function

'raw_atomic_cmpxchg_relaxed':

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
    arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       80 |         if (_prev_ == _o_)                               
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in

expansion of macro 'raw_cmpxchg_relaxed'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
    arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared

(first use in this function); did you mean '_p_'?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
       81 |                 *_p_ = _n_;                              
             \
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in

expansion of macro 'raw_cmpxchg_relaxed'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable

'_new_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_)

: (new)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in

expansion of macro 'raw_cmpxchg_relaxed'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable

'_old_'

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_)

: (old)); \

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in

expansion of macro 'arch_cmpxchg'

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in

expansion of macro 'raw_cmpxchg_relaxed'

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old,

new);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          |                ^~~~~~~~~~~~~~~~~~~
    make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error

1 shuffle=1050985161

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

make[3]: Target 'prepare' not remade because of errors. make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161 make[2]: Target 'prepare' not remade because of errors. make[1]: *** [Makefile:248: __sub-make] Error 2

shuffle=1050985161

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

     66	
     67	#define arch_cmpxchg(ptr, old, new)				        \
     68	({									\
     69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

     72		__typeof__(*(ptr)) _prev_;					\
     73		unsigned long __flags;						\
     74										\
     75		/*								\
     76		 * spin lock/unlock provide the needed smp_mb() before/after	\
     77		 */								\
     78		atomic_ops_lock(__flags);					\
     79		_prev_ = *_p_;							\
     80		if (_prev_ == _o_)						\
     81			*_p_ = _n_;						\
     82		atomic_ops_unlock(__flags);					\
     83		_prev_;								\
     84	})
     85	
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its

not

Quoted 1 line
Quoted 1 line

dead, if anything it is still my hobby project, like so many other

things

Quoted 5 lines
Quoted 5 lines

open source and you repeating this hurts.

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming.
@Paul can you please apply this in your tree and rebase the series on

top.

Quoted 2 lines
Quoted 2 lines

If not I can send this fix to Linus urgently, but it will cause some collisions.

Quoted 7 lines
Quoted 5 lines

I tried applying this against current linux/master, v7.2, and v7.3-rc1, and no go. Please let me know what you based this on.

Or is this in your recent pull request from Linus? In which case, I could pull that and cherry-pick this patch.

Its the latter.

Cheers for the patch

Quoted 74 lines

Thx,
-Vineet

Quoted 8 lines

Thanx, Paul

Quoted 5 lines

---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type

not

Quoted 7 lines
Quoted 7 lines

 pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Quoted 5 lines
Quoted 5 lines
Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type

safe")

Closes:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 7 lines
Quoted 7 lines
---
  arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
  arch/arc/include/asm/cmpxchg.h        | 4 ++--
  2 files changed, 8 insertions(+), 2 deletions(-)
Quoted 6 lines

arch/arc/include/asm/atomic64-arcv2.h static inline u64

Quoted 6 lines
arch/arc/include/asm/atomic64-arcv2.h +0 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64

__arch_cmpxchg64_relaxed(volatile

Quoted 5 lines

arch/arc/include/asm/atomic64-arcv2.h static inline u64 · line 160

Quoted 5 lines
arch/arc/include/asm/atomic64-arcv2.h +1 -0
 void *ptr, u64 old, u64 new)
  }
  #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed
 
+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64

old, s64

Quoted 10 lines

Review

Quoted 10 lines
arch/arc/include/asm/atomic64-arcv2.h +5 -0
 new)
+{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed
+
  static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)

 {
     s64 prev;

(quoted diff) +0 -0

b/arch/arc/include/asm/cmpxchg.h

Quoted 17 lines
Quoted 17 lines

index 76f43db0890f..66b3743c9400 100644

arch/arc/include/asm/cmpxchg.h +1 -1
@@ -46,7 +46,7 @@
      __typeof__(*(ptr)) _n_ = (new);                    \
      __typeof__(*(ptr)) _prev_;                    \
                                      \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
      case 1:                                \
          _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8
 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \

         break;                            \

arch/arc/include/asm/cmpxchg.h +0 -0
@@ -102,7 +102,7 @@
      __typeof__(ptr) _p_ = (ptr);                    \
      __typeof__(*(ptr)) _val_ = (val);                \
                                      \
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
arch/arc/include/asm/cmpxchg.h +1 -1
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
      case 4:                                \
          _val_ = __arch_xchg(_p_, _val_);            \
          break;                            \
Signature · 1 line
2.53.0

--- Thanks!
"I'm not a very positive person" - Linus torvalds

#7 lore raw
In reply to Vineet Gupta
Quoted 239 lines · Vineet Gupta
Quoted 238 lines · Paul E. McKenney
Quoted 237 lines · Vineet Gupta
Quoted 223 lines · Bradley Morgan
Quoted 222 lines · kernel test robot
tree:   https://github.com/paulmckrcu/linux cmpxchg2.2026.09.22a
head:   54c282c15475ebfae4712fe3ab637c9d19c723d6
commit: b6d4f6af38f85e7948fd64f9bf09cbb858b4dade [25/28] ARC: Emulate two-byte cmpxchg
config: arc-randconfig-1001-20260924 (https://download.01.org/0day-ci/archive/20260924/[email protected]/config)
compiler: arc-linux-gcc (GCC) 14.3.0

reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260924/[email protected]/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 <[email protected]>
| Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/arc/include/asm/atomic.h:13,
from include/linux/atomic.h:7,
from include/asm-generic/bitops/lock.h:5,
from arch/arc/include/asm/bitops.h:190,
from include/linux/bitops.h:67,
from include/linux/log2.h:12,
from kernel/bounds.c:14:
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:80:23: note: each undeclared identifier is reported only once for each function it appears in
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
       55 | #define raw_cmpxchg arch_cmpxchg
          |                     ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
     2026 |         return raw_cmpxchg(&v->counter, old, new);
          |                ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
55 | #define raw_cmpxchg arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2026:16: note: in expansion of macro 'raw_cmpxchg'
2026 | return raw_cmpxchg(&v->counter, old, new);
| ^~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_acquire':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
       70 | #define raw_cmpxchg_acquire arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
     2055 |         return raw_cmpxchg_acquire(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:70:29: note: in expansion of macro 'arch_cmpxchg'
70 | #define raw_cmpxchg_acquire arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2055:16: note: in expansion of macro 'raw_cmpxchg_acquire'
2055 | return raw_cmpxchg_acquire(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_release':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
       82 | #define raw_cmpxchg_release arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
     2083 |         return raw_cmpxchg_release(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]
70 | unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
| ^~~~~
include/linux/atomic/atomic-arch-fallback.h:82:29: note: in expansion of macro 'arch_cmpxchg'
82 | #define raw_cmpxchg_release arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2083:16: note: in expansion of macro 'raw_cmpxchg_release'
2083 | return raw_cmpxchg_release(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
arch/arc/include/asm/cmpxchg.h:80:23: error: '_o_' undeclared (first use in this function); did you mean '_p_'?
80 | if (_prev_ == _o_) \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
91 | #define raw_cmpxchg_relaxed arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
2108 | return raw_cmpxchg_relaxed(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~
arch/arc/include/asm/cmpxchg.h:81:24: error: '_n_' undeclared (first use in this function); did you mean '_p_'?
81 | *_p_ = _n_; \
| ^~~
include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
91 | #define raw_cmpxchg_relaxed arch_cmpxchg
| ^~~~~~~~~~~~
include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
2108 | return raw_cmpxchg_relaxed(&v->counter, old, new);
| ^~~~~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:71:23: warning: unused variable '_new_'

[-Wunused-variable]

       71 |         unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

arch/arc/include/asm/cmpxchg.h:70:23: warning: unused variable '_old_'

[-Wunused-variable]

       70 |         unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old));              \
          |                       ^~~~~
    include/linux/atomic/atomic-arch-fallback.h:91:29: note: in expansion of macro 'arch_cmpxchg'
       91 | #define raw_cmpxchg_relaxed arch_cmpxchg
          |                             ^~~~~~~~~~~~
    include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
     2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
          |                ^~~~~~~~~~~~~~~~~~~
    make[3]: *** [scripts/Makefile.build:185: kernel/bounds.s] Error 1 shuffle=1050985161
    make[3]: Target 'prepare' not remade because of errors.
    make[2]: *** [Makefile:1425: prepare0] Error 2 shuffle=1050985161
    make[2]: Target 'prepare' not remade because of errors.
    make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [Makefile:248: __sub-make] Error 2 shuffle=1050985161
    make: Target 'prepare' not remade because of errors.

vim +/_new_ +71 arch/arc/include/asm/cmpxchg.h

     66	
     67	#define arch_cmpxchg(ptr, old, new)				        \
     68	({									\
     69		volatile __typeof__(ptr) _p_ = (ptr);				\
Quoted 2 lines

70 unsigned long _old_ = (unsigned long)(0 ? *(_p_) : (old)); \
71 unsigned long _new_ = (unsigned long)(0 ? *(_p_) : (new)); \

     72		__typeof__(*(ptr)) _prev_;					\
     73		unsigned long __flags;						\
     74										\
     75		/*								\
     76		 * spin lock/unlock provide the needed smp_mb() before/after	\
     77		 */								\
     78		atomic_ops_lock(__flags);					\
     79		_prev_ = *_p_;							\
     80		if (_prev_ == _o_)						\
     81			*_p_ = _n_;						\
     82		atomic_ops_unlock(__flags);					\
     83		_prev_;								\
     84	})
     85	
Quoted 4 lines
Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Apparently nobody uses arc

Yes the development has slowed down compared to five years ago, but its not dead, if anything it is still my hobby project, like so many other things open source and you repeating this hurts.

You stumbled onto a real issue: typeof ptr vs. *ptr which unmasked an existing shortcoming.
@Paul can you please apply this in your tree and rebase the series on top. If not I can send this fix to Linus urgently, but it will cause some collisions.

Quoted 7 lines
Quoted 5 lines

I tried applying this against current linux/master, v7.2, and v7.3-rc1, and no go. Please let me know what you based this on.

Or is this in your recent pull request from Linus? In which case, I could pull that and cherry-pick this patch.

Its the latter.

Done!

Thanx, Paul

Quoted 77 lines

Thx,
-Vineet

Quoted 73 lines

Thanx, Paul

Quoted 70 lines

---------->
From f3e2402f62bebfa9f1ad21e23d1663a0a3e5a58d Mon Sep 17 00:00:00 2001
From: Vineet Gupta <[email protected]>
Date: Wed, 23 Sep 2026 15:01:38 -0700
Subject: [PATCH] ARC: arch_cmpxchg_relaxed to use size of pointed type not
 pointer

Bradley spotted this snafu when working on two-byte cmpxchg emulation. He originally folded this fix into his series but the fix itself uncovered a pre-existing issue, missing arch_atomic64_cmpxchg_relaxed which just needed to be wired up.

Fixes e188f3330a13 ("ARC: cmpxchg/xchg: rewrite as macros to make type

safe")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

---
  arch/arc/include/asm/atomic64-arcv2.h | 6 ++++++
  arch/arc/include/asm/cmpxchg.h        | 4 ++--
  2 files changed, 8 insertions(+), 2 deletions(-)
arch/arc/include/asm/atomic64-arcv2.h +6 -0
index 73080a664369..1ca4a1047fb3 100644
@@ -156,6 +156,12 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile
 void *ptr, u64 old, u64 new)
  }
  #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed
 
+static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64
 new)
+{
+    return arch_cmpxchg64_relaxed(&v->counter, old, new);
+}
+#define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed
+
  static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new)

 {
     s64 prev;

arch/arc/include/asm/cmpxchg.h +1 -1
index 76f43db0890f..66b3743c9400 100644
@@ -46,7 +46,7 @@
      __typeof__(*(ptr)) _n_ = (new);                    \
      __typeof__(*(ptr)) _prev_;                    \
                                      \
-    switch(sizeof((_p_))) {                        \
+    switch (sizeof(*(_p_))) {                        \
      case 1:                                \
          _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8
 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_);    \

         break;                            \

arch/arc/include/asm/cmpxchg.h +1 -1
@@ -102,7 +102,7 @@
      __typeof__(ptr) _p_ = (ptr);                    \
      __typeof__(*(ptr)) _val_ = (val);                \
                                      \
-    switch(sizeof(*(_p_))) {                    \
+    switch (sizeof(*(_p_))) {                    \
      case 4:                                \
          _val_ = __arch_xchg(_p_, _val_);            \
          break;                            \
Signature · 1 line
2.53.0