public inbox for [email protected]
 help / color / mirror / Atom feed
* [ammarfaizi2-block:tglx/devel/rcuref 2/3] arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)
@ 2023-03-01  7:48 kernel test robot
  2023-03-01 21:57 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-03-01  7:48 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List

tree:   https://github.com/ammarfaizi2/linux-block tglx/devel/rcuref
head:   9dcf0830de36103b3a5ed2bdd1bfa5cbcc1032d8
commit: 212b3a6f7d18535cb6b745193608bf2ffaf111b9 [2/3] atomics: Provide rcuref - scalable reference counting
config: sparc64-randconfig-s051-20230226 (https://download.01.org/0day-ci/archive/20230301/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/ammarfaizi2/linux-block/commit/212b3a6f7d18535cb6b745193608bf2ffaf111b9
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block tglx/devel/rcuref
        git checkout 212b3a6f7d18535cb6b745193608bf2ffaf111b9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
   lib/rcuref.c: note: in included file (through arch/sparc/include/asm/cmpxchg.h, arch/sparc/include/asm/atomic_64.h, arch/sparc/include/asm/atomic.h, ...):
>> arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)

vim +161 arch/sparc/include/asm/cmpxchg_64.h

d550bbd40c0e10 David Howells 2012-03-28  155  
d550bbd40c0e10 David Howells 2012-03-28  156  static inline unsigned long
d550bbd40c0e10 David Howells 2012-03-28  157  __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
d550bbd40c0e10 David Howells 2012-03-28  158  {
d550bbd40c0e10 David Howells 2012-03-28  159  	switch (size) {
a12ee2349312d7 Babu Moger    2017-05-24  160  		case 1:
a12ee2349312d7 Babu Moger    2017-05-24 @161  			return __cmpxchg_u8(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28  162  		case 4:
d550bbd40c0e10 David Howells 2012-03-28  163  			return __cmpxchg_u32(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28  164  		case 8:
d550bbd40c0e10 David Howells 2012-03-28  165  			return __cmpxchg_u64(ptr, old, new);
d550bbd40c0e10 David Howells 2012-03-28  166  	}
d550bbd40c0e10 David Howells 2012-03-28  167  	__cmpxchg_called_with_bad_pointer();
d550bbd40c0e10 David Howells 2012-03-28  168  	return old;
d550bbd40c0e10 David Howells 2012-03-28  169  }
d550bbd40c0e10 David Howells 2012-03-28  170  

:::::: The code at line 161 was first introduced by commit
:::::: a12ee2349312d7112b9b7c6ac2e70c5ec2ca334e arch/sparc: Introduce cmpxchg_u8 SPARC

:::::: TO: Babu Moger <[email protected]>
:::::: CC: David S. Miller <[email protected]>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ammarfaizi2-block:tglx/devel/rcuref 2/3] arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)
  2023-03-01  7:48 [ammarfaizi2-block:tglx/devel/rcuref 2/3] arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0) kernel test robot
@ 2023-03-01 21:57 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2023-03-01 21:57 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List,
	David S. Miller, sparclinux, Peter Zijlstra, Will Deacon,
	David Howells

On Wed, Mar 01 2023 at 15:48, kernel test robot wrote:
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <[email protected]>
> | Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> sparse warnings: (new ones prefixed by >>)
>    lib/rcuref.c: note: in included file (through arch/sparc/include/asm/cmpxchg.h, arch/sparc/include/asm/atomic_64.h, arch/sparc/include/asm/atomic.h, ...):
>>> arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0)

Cute. The constant value is 0xFFFF FFFF E000 0000. So how is that implicit down
cast causing it to become 0? Sparse is silly.

But that aside, the sparc64 cmpxchg() code is silly as well:

> vim +161 arch/sparc/include/asm/cmpxchg_64.h
>
> d550bbd40c0e10 David Howells 2012-03-28  155  
> d550bbd40c0e10 David Howells 2012-03-28  156  static inline unsigned long
> d550bbd40c0e10 David Howells 2012-03-28  157  __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
> d550bbd40c0e10 David Howells 2012-03-28  158  {
> d550bbd40c0e10 David Howells 2012-03-28  159  	switch (size) {
> a12ee2349312d7 Babu Moger    2017-05-24  160  		case 1:
> a12ee2349312d7 Babu Moger    2017-05-24 @161  			return __cmpxchg_u8(ptr, old, new);
> d550bbd40c0e10 David Howells 2012-03-28  162  		case 4:
> d550bbd40c0e10 David Howells 2012-03-28  163  			return __cmpxchg_u32(ptr, old, new);
> d550bbd40c0e10 David Howells 2012-03-28  164  		case 8:
> d550bbd40c0e10 David Howells 2012-03-28  165  			return __cmpxchg_u64(ptr, old, new);
> d550bbd40c0e10 David Howells 2012-03-28  166  	}
> d550bbd40c0e10 David Howells 2012-03-28  167  	__cmpxchg_called_with_bad_pointer();
> d550bbd40c0e10 David Howells 2012-03-28  168  	return old;
> d550bbd40c0e10 David Howells 2012-03-28  169  }
> d550bbd40c0e10 David Howells 2012-03-28  170  

which gets invoked via:

#define arch_cmpxchg(ptr,o,n)						 \
  ({									 \
     __typeof__(*(ptr)) _o_ = (o);					 \
     __typeof__(*(ptr)) _n_ = (n);					 \
     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \
				    (unsigned long)_n_, sizeof(*(ptr))); \
  })

and then ends up in

static inline unsigned long __cmpxchg_u32(volatile int *m, int old, int new)

I'm sure a sparse build of sparc64 is full of those warnings. This just
happens to add one to the existing noise.

Oh well.

        tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-01 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-01  7:48 [ammarfaizi2-block:tglx/devel/rcuref 2/3] arch/sparc/include/asm/cmpxchg_64.h:161:55: sparse: sparse: cast truncates bits from constant value (ffffffffe0000000 becomes 0) kernel test robot
2023-03-01 21:57 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox