Subject: Re: [PATCH 3/3] powerpc: rewrite atomics to use ARCH_ATOMIC

From: kernel test robot <[email-masked]>
Date: Thu, 12 Nov 2020 03:07:19 +0800

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on asm-generic/master linus/master v5.10-rc3 next-20201111]
[cannot apply to scottwood/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-convert-to-use-ARCH_ATOMIC/20201111-190941
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9e1bec8fe216b0745c647e52c40d1f0033fb4efd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/powerpc-convert-to-use-ARCH_ATOMIC/20201111-190941
        git checkout 9e1bec8fe216b0745c647e52c40d1f0033fb4efd
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   In file included from arch/powerpc/include/asm/atomic.h:11,
                    from include/linux/atomic.h:7,
                    from include/linux/rcupdate.h:25,
                    from include/linux/rculist.h:11,
                    from include/linux/sched/signal.h:5,
                    from drivers/gpu/drm/drm_lock.c:37:
   drivers/gpu/drm/drm_lock.c: In function 'drm_lock_take':
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:73:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
      73 |  typeof(op##_relaxed(args)) __ret;    \
         |         ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:75:10: note: in expansion of macro 'cmpxchg'
      75 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:75:10: note: in expansion of macro 'arch_cmpxchg_relaxed'
      75 |  __ret = op##_relaxed(args);     \
         |          ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:75:10: note: in expansion of macro 'cmpxchg'
      75 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
   drivers/gpu/drm/drm_lock.c: In function 'drm_lock_transfer':
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:73:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
      73 |  typeof(op##_relaxed(args)) __ret;    \
         |         ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:118:10: note: in expansion of macro 'cmpxchg'
     118 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:75:10: note: in expansion of macro 'arch_cmpxchg_relaxed'
      75 |  __ret = op##_relaxed(args);     \
         |          ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:118:10: note: in expansion of macro 'cmpxchg'
     118 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
   drivers/gpu/drm/drm_lock.c: In function 'drm_legacy_lock_free':
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:73:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
      73 |  typeof(op##_relaxed(args)) __ret;    \
         |         ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:141:10: note: in expansion of macro 'cmpxchg'
     141 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:75:10: note: in expansion of macro 'arch_cmpxchg_relaxed'
      75 |  __ret = op##_relaxed(args);     \
         |          ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:141:10: note: in expansion of macro 'cmpxchg'
     141 |   prev = cmpxchg(lock, old, new);
         |          ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
   drivers/gpu/drm/drm_lock.c: In function 'drm_legacy_idlelock_release':
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:73:9: note: in expansion of macro 'arch_cmpxchg_relaxed'
      73 |  typeof(op##_relaxed(args)) __ret;    \
         |         ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:319:12: note: in expansion of macro 'cmpxchg'
     319 |     prev = cmpxchg(lock, old, DRM_KERNEL_CONTEXT);
         |            ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~
>> arch/powerpc/include/asm/cmpxchg.h:463:41: warning: passing argument 1 of '__cmpxchg_relaxed' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
     463 |  (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),   \
         |                                         ^~~~~
   include/linux/atomic.h:75:10: note: in expansion of macro 'arch_cmpxchg_relaxed'
      75 |  __ret = op##_relaxed(args);     \
         |          ^~
   include/linux/atomic-arch-fallback.h:52:2: note: in expansion of macro '__atomic_op_fence'
      52 |  __atomic_op_fence(arch_cmpxchg, __VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~
   include/asm-generic/atomic-instrumented.h:1685:2: note: in expansion of macro 'arch_cmpxchg'
    1685 |  arch_cmpxchg(__ai_ptr, __VA_ARGS__);    \
         |  ^~~~~~~~~~~~
   drivers/gpu/drm/drm_lock.c:319:12: note: in expansion of macro 'cmpxchg'
     319 |     prev = cmpxchg(lock, old, DRM_KERNEL_CONTEXT);
         |            ^~~~~~~
   arch/powerpc/include/asm/cmpxchg.h:432:25: note: expected 'void *' but argument is of type 'volatile unsigned int *'
     432 | __cmpxchg_relaxed(void *ptr, unsigned long old, unsigned long new,
         |                   ~~~~~~^~~

vim +463 arch/powerpc/include/asm/cmpxchg.h

56c08e6d226c860 Boqun Feng      2015-12-15  450  
9e1bec8fe216b07 Nicholas Piggin 2020-11-11  451  #define arch_cmpxchg_local(ptr, o, n)					 \
ae3a197e3d0bfe3 David Howells   2012-03-28  452    ({									 \
ae3a197e3d0bfe3 David Howells   2012-03-28  453       __typeof__(*(ptr)) _o_ = (o);					 \
ae3a197e3d0bfe3 David Howells   2012-03-28  454       __typeof__(*(ptr)) _n_ = (n);					 \
ae3a197e3d0bfe3 David Howells   2012-03-28  455       (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_,	 \
ae3a197e3d0bfe3 David Howells   2012-03-28  456  				    (unsigned long)_n_, sizeof(*(ptr))); \
ae3a197e3d0bfe3 David Howells   2012-03-28  457    })
ae3a197e3d0bfe3 David Howells   2012-03-28  458  
9e1bec8fe216b07 Nicholas Piggin 2020-11-11  459  #define arch_cmpxchg_relaxed(ptr, o, n)					\
56c08e6d226c860 Boqun Feng      2015-12-15  460  ({									\
56c08e6d226c860 Boqun Feng      2015-12-15  461  	__typeof__(*(ptr)) _o_ = (o);					\
56c08e6d226c860 Boqun Feng      2015-12-15  462  	__typeof__(*(ptr)) _n_ = (n);					\
56c08e6d226c860 Boqun Feng      2015-12-15 @463  	(__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),			\
56c08e6d226c860 Boqun Feng      2015-12-15  464  			(unsigned long)_o_, (unsigned long)_n_,		\
56c08e6d226c860 Boqun Feng      2015-12-15  465  			sizeof(*(ptr)));				\
56c08e6d226c860 Boqun Feng      2015-12-15  466  })
56c08e6d226c860 Boqun Feng      2015-12-15  467  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]