LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
@ 2021-11-23 22:19 kernel test robot
  2021-11-26 11:03 ` Mark Rutland
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-11-23 22:19 UTC (permalink / raw)
  To: Mark Rutland; +Cc: kbuild-all, linux-kernel, Peter Zijlstra

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   136057256686de39cc3a07c2e39ef6bc43003ff6
commit: c7178cdecdbef8321f418fac55f3afaca3bb4c96 locking/atomic: h8300: use asm-generic exclusively
date:   6 months ago
config: h8300-randconfig-s031-20211117 (https://download.01.org/0day-ci/archive/20211124/202111240654.4qXNBmtC-lkp@intel.com/config.gz)
compiler: h8300-linux-gcc (GCC) 11.2.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-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c7178cdecdbef8321f418fac55f3afaca3bb4c96
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c7178cdecdbef8321f418fac55f3afaca3bb4c96
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   lib/atomic64_test.c: note: in included file (through arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, arch/h8300/include/generated/asm/atomic.h, ...):
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
   lib/atomic64_test.c: note: in included file (through include/asm-generic/cmpxchg.h, arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, ...):
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)

vim +37 include/asm-generic/cmpxchg.h

b4816afa398670 David Howells 2012-03-28  24  
b4816afa398670 David Howells 2012-03-28  25  static inline
b4816afa398670 David Howells 2012-03-28  26  unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
b4816afa398670 David Howells 2012-03-28  27  {
b4816afa398670 David Howells 2012-03-28  28  	unsigned long ret, flags;
b4816afa398670 David Howells 2012-03-28  29  
b4816afa398670 David Howells 2012-03-28  30  	switch (size) {
b4816afa398670 David Howells 2012-03-28  31  	case 1:
b4816afa398670 David Howells 2012-03-28  32  #ifdef __xchg_u8
b4816afa398670 David Howells 2012-03-28  33  		return __xchg_u8(x, ptr);
b4816afa398670 David Howells 2012-03-28  34  #else
b4816afa398670 David Howells 2012-03-28  35  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  36  		ret = *(volatile u8 *)ptr;
b4816afa398670 David Howells 2012-03-28 @37  		*(volatile u8 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  38  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  39  		return ret;
b4816afa398670 David Howells 2012-03-28  40  #endif /* __xchg_u8 */
b4816afa398670 David Howells 2012-03-28  41  
b4816afa398670 David Howells 2012-03-28  42  	case 2:
b4816afa398670 David Howells 2012-03-28  43  #ifdef __xchg_u16
b4816afa398670 David Howells 2012-03-28  44  		return __xchg_u16(x, ptr);
b4816afa398670 David Howells 2012-03-28  45  #else
b4816afa398670 David Howells 2012-03-28  46  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  47  		ret = *(volatile u16 *)ptr;
b4816afa398670 David Howells 2012-03-28 @48  		*(volatile u16 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  49  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  50  		return ret;
b4816afa398670 David Howells 2012-03-28  51  #endif /* __xchg_u16 */
b4816afa398670 David Howells 2012-03-28  52  
b4816afa398670 David Howells 2012-03-28  53  	case 4:
b4816afa398670 David Howells 2012-03-28  54  #ifdef __xchg_u32
b4816afa398670 David Howells 2012-03-28  55  		return __xchg_u32(x, ptr);
b4816afa398670 David Howells 2012-03-28  56  #else
b4816afa398670 David Howells 2012-03-28  57  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  58  		ret = *(volatile u32 *)ptr;
b4816afa398670 David Howells 2012-03-28  59  		*(volatile u32 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  60  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  61  		return ret;
b4816afa398670 David Howells 2012-03-28  62  #endif /* __xchg_u32 */
b4816afa398670 David Howells 2012-03-28  63  

:::::: The code at line 37 was first introduced by commit
:::::: b4816afa3986704d1404fc48e931da5135820472 Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: David Howells <dhowells@redhat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
  2021-11-23 22:19 include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef) kernel test robot
@ 2021-11-26 11:03 ` Mark Rutland
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2021-11-26 11:03 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel, Peter Zijlstra

Hi,

On Wed, Nov 24, 2021 at 06:19:48AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   136057256686de39cc3a07c2e39ef6bc43003ff6
> commit: c7178cdecdbef8321f418fac55f3afaca3bb4c96 locking/atomic: h8300: use asm-generic exclusively
> date:   6 months ago
> config: h8300-randconfig-s031-20211117 (https://download.01.org/0day-ci/archive/20211124/202111240654.4qXNBmtC-lkp@intel.com/config.gz)
> compiler: h8300-linux-gcc (GCC) 11.2.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-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c7178cdecdbef8321f418fac55f3afaca3bb4c96
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout c7178cdecdbef8321f418fac55f3afaca3bb4c96
>         # save the config file to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=h8300 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
>    lib/atomic64_test.c: note: in included file (through arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, arch/h8300/include/generated/asm/atomic.h, ...):
> >> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
> >> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
> >> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
> >> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
> >> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
> >> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
> >> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
> >> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)

This is the expected behaviour for the code below. The truncation on line 37 is
when we assign to a u8, and the truncation on line 48 is when we assign to a
u16.

I'm a little confused by the wording of the warning, because there's no cast on
the value being assigned. I'm not sure if that's just misleading wording from
sparse. Would a cast on the right hand side of the assignment be sufficient to
suppress this, e.g.

  *(volatile u8 *)pte = (u8)x;

... because if so, maybe it's worth adding, unless we think this warning would
be useful for when this situation crops up outside of test code (in which case
we should just ignore it for now).

Thanks,
Mark.

> vim +37 include/asm-generic/cmpxchg.h
> 
> b4816afa398670 David Howells 2012-03-28  24  
> b4816afa398670 David Howells 2012-03-28  25  static inline
> b4816afa398670 David Howells 2012-03-28  26  unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
> b4816afa398670 David Howells 2012-03-28  27  {
> b4816afa398670 David Howells 2012-03-28  28  	unsigned long ret, flags;
> b4816afa398670 David Howells 2012-03-28  29  
> b4816afa398670 David Howells 2012-03-28  30  	switch (size) {
> b4816afa398670 David Howells 2012-03-28  31  	case 1:
> b4816afa398670 David Howells 2012-03-28  32  #ifdef __xchg_u8
> b4816afa398670 David Howells 2012-03-28  33  		return __xchg_u8(x, ptr);
> b4816afa398670 David Howells 2012-03-28  34  #else
> b4816afa398670 David Howells 2012-03-28  35  		local_irq_save(flags);
> b4816afa398670 David Howells 2012-03-28  36  		ret = *(volatile u8 *)ptr;
> b4816afa398670 David Howells 2012-03-28 @37  		*(volatile u8 *)ptr = x;
> b4816afa398670 David Howells 2012-03-28  38  		local_irq_restore(flags);
> b4816afa398670 David Howells 2012-03-28  39  		return ret;
> b4816afa398670 David Howells 2012-03-28  40  #endif /* __xchg_u8 */
> b4816afa398670 David Howells 2012-03-28  41  
> b4816afa398670 David Howells 2012-03-28  42  	case 2:
> b4816afa398670 David Howells 2012-03-28  43  #ifdef __xchg_u16
> b4816afa398670 David Howells 2012-03-28  44  		return __xchg_u16(x, ptr);
> b4816afa398670 David Howells 2012-03-28  45  #else
> b4816afa398670 David Howells 2012-03-28  46  		local_irq_save(flags);
> b4816afa398670 David Howells 2012-03-28  47  		ret = *(volatile u16 *)ptr;
> b4816afa398670 David Howells 2012-03-28 @48  		*(volatile u16 *)ptr = x;
> b4816afa398670 David Howells 2012-03-28  49  		local_irq_restore(flags);
> b4816afa398670 David Howells 2012-03-28  50  		return ret;
> b4816afa398670 David Howells 2012-03-28  51  #endif /* __xchg_u16 */
> b4816afa398670 David Howells 2012-03-28  52  
> b4816afa398670 David Howells 2012-03-28  53  	case 4:
> b4816afa398670 David Howells 2012-03-28  54  #ifdef __xchg_u32
> b4816afa398670 David Howells 2012-03-28  55  		return __xchg_u32(x, ptr);
> b4816afa398670 David Howells 2012-03-28  56  #else
> b4816afa398670 David Howells 2012-03-28  57  		local_irq_save(flags);
> b4816afa398670 David Howells 2012-03-28  58  		ret = *(volatile u32 *)ptr;
> b4816afa398670 David Howells 2012-03-28  59  		*(volatile u32 *)ptr = x;
> b4816afa398670 David Howells 2012-03-28  60  		local_irq_restore(flags);
> b4816afa398670 David Howells 2012-03-28  61  		return ret;
> b4816afa398670 David Howells 2012-03-28  62  #endif /* __xchg_u32 */
> b4816afa398670 David Howells 2012-03-28  63  
> 
> :::::: The code at line 37 was first introduced by commit
> :::::: b4816afa3986704d1404fc48e931da5135820472 Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h
> 
> :::::: TO: David Howells <dhowells@redhat.com>
> :::::: CC: David Howells <dhowells@redhat.com>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
@ 2022-01-01 11:04 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-01-01 11:04 UTC (permalink / raw)
  To: Mark Rutland; +Cc: kbuild-all, linux-kernel, Peter Zijlstra

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8008293888188c3923f5bd8a69370dae25ed14e5
commit: c7178cdecdbef8321f418fac55f3afaca3bb4c96 locking/atomic: h8300: use asm-generic exclusively
date:   7 months ago
config: h8300-randconfig-s031-20211117 (https://download.01.org/0day-ci/archive/20220101/202201011813.hKjzPzZI-lkp@intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.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-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c7178cdecdbef8321f418fac55f3afaca3bb4c96
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c7178cdecdbef8321f418fac55f3afaca3bb4c96
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=h8300 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   lib/atomic64_test.c: note: in included file (through arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, arch/h8300/include/generated/asm/atomic.h, ...):
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg.h:48:40: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
   lib/atomic64_test.c: note: in included file (through include/asm-generic/cmpxchg.h, arch/h8300/include/generated/asm/cmpxchg.h, include/asm-generic/atomic.h, ...):
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)
>> include/asm-generic/cmpxchg-local.h:30:42: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef)
>> include/asm-generic/cmpxchg-local.h:34:44: sparse: sparse: cast truncates bits from constant value (deadbeef becomes beef)

vim +37 include/asm-generic/cmpxchg.h

b4816afa398670 David Howells 2012-03-28  24  
b4816afa398670 David Howells 2012-03-28  25  static inline
b4816afa398670 David Howells 2012-03-28  26  unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
b4816afa398670 David Howells 2012-03-28  27  {
b4816afa398670 David Howells 2012-03-28  28  	unsigned long ret, flags;
b4816afa398670 David Howells 2012-03-28  29  
b4816afa398670 David Howells 2012-03-28  30  	switch (size) {
b4816afa398670 David Howells 2012-03-28  31  	case 1:
b4816afa398670 David Howells 2012-03-28  32  #ifdef __xchg_u8
b4816afa398670 David Howells 2012-03-28  33  		return __xchg_u8(x, ptr);
b4816afa398670 David Howells 2012-03-28  34  #else
b4816afa398670 David Howells 2012-03-28  35  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  36  		ret = *(volatile u8 *)ptr;
b4816afa398670 David Howells 2012-03-28 @37  		*(volatile u8 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  38  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  39  		return ret;
b4816afa398670 David Howells 2012-03-28  40  #endif /* __xchg_u8 */
b4816afa398670 David Howells 2012-03-28  41  
b4816afa398670 David Howells 2012-03-28  42  	case 2:
b4816afa398670 David Howells 2012-03-28  43  #ifdef __xchg_u16
b4816afa398670 David Howells 2012-03-28  44  		return __xchg_u16(x, ptr);
b4816afa398670 David Howells 2012-03-28  45  #else
b4816afa398670 David Howells 2012-03-28  46  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  47  		ret = *(volatile u16 *)ptr;
b4816afa398670 David Howells 2012-03-28 @48  		*(volatile u16 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  49  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  50  		return ret;
b4816afa398670 David Howells 2012-03-28  51  #endif /* __xchg_u16 */
b4816afa398670 David Howells 2012-03-28  52  
b4816afa398670 David Howells 2012-03-28  53  	case 4:
b4816afa398670 David Howells 2012-03-28  54  #ifdef __xchg_u32
b4816afa398670 David Howells 2012-03-28  55  		return __xchg_u32(x, ptr);
b4816afa398670 David Howells 2012-03-28  56  #else
b4816afa398670 David Howells 2012-03-28  57  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  58  		ret = *(volatile u32 *)ptr;
b4816afa398670 David Howells 2012-03-28  59  		*(volatile u32 *)ptr = x;
b4816afa398670 David Howells 2012-03-28  60  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  61  		return ret;
b4816afa398670 David Howells 2012-03-28  62  #endif /* __xchg_u32 */
b4816afa398670 David Howells 2012-03-28  63  

:::::: The code at line 37 was first introduced by commit
:::::: b4816afa3986704d1404fc48e931da5135820472 Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: David Howells <dhowells@redhat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2022-01-01 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 22:19 include/asm-generic/cmpxchg.h:37:39: sparse: sparse: cast truncates bits from constant value (deadbeef becomes ef) kernel test robot
2021-11-26 11:03 ` Mark Rutland
2022-01-01 11:04 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).