All of lore.kernel.org
 help / color / mirror / Atom feed
* [kdave-btrfs-devel:dev/raid-policy 83/85] fs/btrfs/volumes.c:5739:6: warning: variable 'now' is used uninitialized whenever 'if' condition is false
@ 2021-01-28 18:08 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-01-28 18:08 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 15498 bytes --]

tree:   https://github.com/kdave/btrfs-devel.git dev/raid-policy
head:   92ab5dba1e9e01e617039e8450d1491b0806c31c
commit: 4535566286913fb8ad62c3efef00e6d2593b25e4 [83/85] btrfs: Add roundrobin read policy
config: s390-randconfig-r005-20210128 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 48bdd676a1d1338c10541460bf5beb69ac17e451)
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
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/kdave/btrfs-devel/commit/4535566286913fb8ad62c3efef00e6d2593b25e4
        git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
        git fetch --no-tags kdave-btrfs-devel dev/raid-policy
        git checkout 4535566286913fb8ad62c3efef00e6d2593b25e4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All warnings (new ones prefixed by >>):

   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
                     ^
   In file included from fs/btrfs/volumes.c:10:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   In file included from fs/btrfs/volumes.c:10:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   In file included from fs/btrfs/volumes.c:10:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   In file included from fs/btrfs/volumes.c:10:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   In file included from fs/btrfs/volumes.c:10:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> fs/btrfs/volumes.c:5739:6: warning: variable 'now' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (last_sched_time != 0) {
               ^~~~~~~~~~~~~~~~~~~~
   fs/btrfs/volumes.c:5772:44: note: uninitialized use occurs here
           this_cpu_write(*fs_info->last_sched_time, now);
                                                     ^~~
   include/linux/percpu-defs.h:508:73: note: expanded from macro 'this_cpu_write'
   #define this_cpu_write(pcp, val)        __pcpu_size_call(this_cpu_write_, pcp, val)
                                                                                  ^~~
   include/linux/percpu-defs.h:380:29: note: expanded from macro '__pcpu_size_call'
                   case 8: stem##8(variable, __VA_ARGS__);break;           \
                                             ^~~~~~~~~~~
   include/asm-generic/percpu.h:342:64: note: expanded from macro 'this_cpu_write_8'
   #define this_cpu_write_8(pcp, val)      this_cpu_generic_to_op(pcp, val, =)
                                                                       ^~~
   include/asm-generic/percpu.h:148:29: note: expanded from macro 'this_cpu_generic_to_op'
           raw_cpu_generic_to_op(pcp, val, op);                            \
                                      ^~~
   include/asm-generic/percpu.h:72:26: note: expanded from macro 'raw_cpu_generic_to_op'
           *raw_cpu_ptr(&(pcp)) op val;                                    \
                                   ^~~
   fs/btrfs/volumes.c:5739:2: note: remove the 'if' if its condition is always true
           if (last_sched_time != 0) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/volumes.c:5736:9: note: initialize the variable 'now' to silence this warning
           u64 now;
                  ^
                   = 0
   In file included from fs/btrfs/volumes.c:6:
   In file included from include/linux/sched.h:14:
   In file included from include/linux/pid.h:5:
   In file included from include/linux/rculist.h:10:
   In file included from include/linux/list.h:9:
   In file included from include/linux/kernel.h:11:
   In file included from include/linux/bitops.h:32:
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
                           "ni     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
                           "oi     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
                           "ni     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
                           "oi     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
                           "ni     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
                           "oi     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
   arch/s390/include/asm/bitops.h:90:4: error: invalid operand in inline asm: 'ni	$0,${1:b}'
                           "ni     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
                           "oi     %0,%b1\n"
                           ^
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
   arch/s390/include/asm/bitops.h:69:4: error: invalid operand in inline asm: 'oi	$0,${1:b}'
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   21 warnings and 20 errors generated.


vim +5739 fs/btrfs/volumes.c

  5712	
  5713	/*
  5714	 * find_live_mirror_roundrobin() searches for a raid1 mirror which can process
  5715	 * more requests.
  5716	 *
  5717	 * @fs_info:     the filesystem
  5718	 * @map:         extent mapping which contains stripes
  5719	 * @first:       number of the first mirror
  5720	 * @num_stripes: number of stripes in the array
  5721	 *
  5722	 * It calls __find_live_mirror_roundrobin() function to try to find a suitable
  5723	 * mirror, firstly non-rotational, then rotational.
  5724	 *
  5725	 * If no suitable mirror found, it selects the next (last used + 1) mirror.
  5726	 */
  5727	static int find_live_mirror_roundrobin(struct btrfs_fs_info *fs_info,
  5728					       struct map_lookup *map, int first,
  5729					       int num_stripes)
  5730	{
  5731		int preferred_mirror;
  5732		int rotational_first;
  5733		u64 last_sched_time;
  5734		u64 duration;
  5735		int limit;
  5736		u64 now;
  5737	
  5738		last_sched_time = this_cpu_read(*fs_info->last_sched_time);
> 5739		if (last_sched_time != 0) {
  5740			now = ktime_get_ns();
  5741			duration = now - last_sched_time;
  5742	
  5743			if (duration < (NSEC_PER_MSEC *
  5744					fs_info->fs_devices->read_policy_roundrobin_duration)) {
  5745				preferred_mirror = this_cpu_read(*fs_info->last_mirror);
  5746				goto out;
  5747			}
  5748		}
  5749	
  5750		limit = first + num_stripes;
  5751	
  5752		/* Try to find non-rotational mirror */
  5753		__find_live_mirror_roundrobin_nonrot(fs_info, map, first, limit,
  5754						     &preferred_mirror,
  5755						     &rotational_first);
  5756		if (preferred_mirror >= 0)
  5757			goto out;
  5758	
  5759		/* Try to find rotational mirror if any available */
  5760		if (rotational_first >= 0) {
  5761			preferred_mirror = __find_live_mirror_roundrobin_rot(
  5762				fs_info, map, first, num_stripes);
  5763			if (preferred_mirror >= 0)
  5764				goto out;
  5765		}
  5766	
  5767		/* If no suitable mirror found, return the next mirror */
  5768		preferred_mirror = (
  5769			this_cpu_read(*fs_info->last_mirror) + 1) % num_stripes;
  5770	
  5771	out:
  5772		this_cpu_write(*fs_info->last_sched_time, now);
  5773		this_cpu_write(*fs_info->last_mirror, preferred_mirror);
  5774		return preferred_mirror;
  5775	}
  5776	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 15022 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-28 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 18:08 [kdave-btrfs-devel:dev/raid-policy 83/85] fs/btrfs/volumes.c:5739:6: warning: variable 'now' is used uninitialized whenever 'if' condition is false kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.