Re: [PATCHv3 for-next 05/20] RDMA/rtrs: Change MAX_SESS_QUEUE_DEPTH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jack,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on rdma/for-next]
[also build test WARNING on v5.13-rc3 next-20210528]
[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/Jack-Wang/RTRS-update-for-5-14/20210528-193313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: x86_64-randconfig-a012-20210526 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6505c630407c5feec818f0bb1c284f9eeebf2071)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/66f95f659060028d1f0f91473ad1c16a6595fcac
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jack-Wang/RTRS-update-for-5-14/20210528-193313
        git checkout 66f95f659060028d1f0f91473ad1c16a6595fcac
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
                   if (queue_depth > MAX_SESS_QUEUE_DEPTH) {
                       ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
>> drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
                   if (queue_depth > MAX_SESS_QUEUE_DEPTH) {
                       ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
                   if (queue_depth > MAX_SESS_QUEUE_DEPTH) {
                       ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   3 warnings generated.


vim +1786 drivers/infiniband/ulp/rtrs/rtrs-clt.c

6a98d71daea186 Jack Wang      2020-05-11  1750  
6a98d71daea186 Jack Wang      2020-05-11  1751  static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,
6a98d71daea186 Jack Wang      2020-05-11  1752  				       struct rdma_cm_event *ev)
6a98d71daea186 Jack Wang      2020-05-11  1753  {
6a98d71daea186 Jack Wang      2020-05-11  1754  	struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess);
6a98d71daea186 Jack Wang      2020-05-11  1755  	struct rtrs_clt *clt = sess->clt;
6a98d71daea186 Jack Wang      2020-05-11  1756  	const struct rtrs_msg_conn_rsp *msg;
6a98d71daea186 Jack Wang      2020-05-11  1757  	u16 version, queue_depth;
6a98d71daea186 Jack Wang      2020-05-11  1758  	int errno;
6a98d71daea186 Jack Wang      2020-05-11  1759  	u8 len;
6a98d71daea186 Jack Wang      2020-05-11  1760  
6a98d71daea186 Jack Wang      2020-05-11  1761  	msg = ev->param.conn.private_data;
6a98d71daea186 Jack Wang      2020-05-11  1762  	len = ev->param.conn.private_data_len;
6a98d71daea186 Jack Wang      2020-05-11  1763  	if (len < sizeof(*msg)) {
6a98d71daea186 Jack Wang      2020-05-11  1764  		rtrs_err(clt, "Invalid RTRS connection response\n");
6a98d71daea186 Jack Wang      2020-05-11  1765  		return -ECONNRESET;
6a98d71daea186 Jack Wang      2020-05-11  1766  	}
6a98d71daea186 Jack Wang      2020-05-11  1767  	if (le16_to_cpu(msg->magic) != RTRS_MAGIC) {
6a98d71daea186 Jack Wang      2020-05-11  1768  		rtrs_err(clt, "Invalid RTRS magic\n");
6a98d71daea186 Jack Wang      2020-05-11  1769  		return -ECONNRESET;
6a98d71daea186 Jack Wang      2020-05-11  1770  	}
6a98d71daea186 Jack Wang      2020-05-11  1771  	version = le16_to_cpu(msg->version);
6a98d71daea186 Jack Wang      2020-05-11  1772  	if (version >> 8 != RTRS_PROTO_VER_MAJOR) {
6a98d71daea186 Jack Wang      2020-05-11  1773  		rtrs_err(clt, "Unsupported major RTRS version: %d, expected %d\n",
6a98d71daea186 Jack Wang      2020-05-11  1774  			  version >> 8, RTRS_PROTO_VER_MAJOR);
6a98d71daea186 Jack Wang      2020-05-11  1775  		return -ECONNRESET;
6a98d71daea186 Jack Wang      2020-05-11  1776  	}
6a98d71daea186 Jack Wang      2020-05-11  1777  	errno = le16_to_cpu(msg->errno);
6a98d71daea186 Jack Wang      2020-05-11  1778  	if (errno) {
6a98d71daea186 Jack Wang      2020-05-11  1779  		rtrs_err(clt, "Invalid RTRS message: errno %d\n",
6a98d71daea186 Jack Wang      2020-05-11  1780  			  errno);
6a98d71daea186 Jack Wang      2020-05-11  1781  		return -ECONNRESET;
6a98d71daea186 Jack Wang      2020-05-11  1782  	}
6a98d71daea186 Jack Wang      2020-05-11  1783  	if (con->c.cid == 0) {
6a98d71daea186 Jack Wang      2020-05-11  1784  		queue_depth = le16_to_cpu(msg->queue_depth);
6a98d71daea186 Jack Wang      2020-05-11  1785  
6a98d71daea186 Jack Wang      2020-05-11 @1786  		if (queue_depth > MAX_SESS_QUEUE_DEPTH) {
6a98d71daea186 Jack Wang      2020-05-11  1787  			rtrs_err(clt, "Invalid RTRS message: queue=%d\n",
6a98d71daea186 Jack Wang      2020-05-11  1788  				  queue_depth);
6a98d71daea186 Jack Wang      2020-05-11  1789  			return -ECONNRESET;
6a98d71daea186 Jack Wang      2020-05-11  1790  		}
6a98d71daea186 Jack Wang      2020-05-11  1791  		if (!sess->rbufs || sess->queue_depth < queue_depth) {
6a98d71daea186 Jack Wang      2020-05-11  1792  			kfree(sess->rbufs);
6a98d71daea186 Jack Wang      2020-05-11  1793  			sess->rbufs = kcalloc(queue_depth, sizeof(*sess->rbufs),
6a98d71daea186 Jack Wang      2020-05-11  1794  					      GFP_KERNEL);
6a98d71daea186 Jack Wang      2020-05-11  1795  			if (!sess->rbufs)
6a98d71daea186 Jack Wang      2020-05-11  1796  				return -ENOMEM;
6a98d71daea186 Jack Wang      2020-05-11  1797  		}
6a98d71daea186 Jack Wang      2020-05-11  1798  		sess->queue_depth = queue_depth;
6a98d71daea186 Jack Wang      2020-05-11  1799  		sess->max_hdr_size = le32_to_cpu(msg->max_hdr_size);
6a98d71daea186 Jack Wang      2020-05-11  1800  		sess->max_io_size = le32_to_cpu(msg->max_io_size);
6a98d71daea186 Jack Wang      2020-05-11  1801  		sess->flags = le32_to_cpu(msg->flags);
6a98d71daea186 Jack Wang      2020-05-11  1802  		sess->chunk_size = sess->max_io_size + sess->max_hdr_size;
6a98d71daea186 Jack Wang      2020-05-11  1803  
6a98d71daea186 Jack Wang      2020-05-11  1804  		/*
6a98d71daea186 Jack Wang      2020-05-11  1805  		 * Global queue depth and IO size is always a minimum.
6a98d71daea186 Jack Wang      2020-05-11  1806  		 * If while a reconnection server sends us a value a bit
6a98d71daea186 Jack Wang      2020-05-11  1807  		 * higher - client does not care and uses cached minimum.
6a98d71daea186 Jack Wang      2020-05-11  1808  		 *
6a98d71daea186 Jack Wang      2020-05-11  1809  		 * Since we can have several sessions (paths) restablishing
6a98d71daea186 Jack Wang      2020-05-11  1810  		 * connections in parallel, use lock.
6a98d71daea186 Jack Wang      2020-05-11  1811  		 */
6a98d71daea186 Jack Wang      2020-05-11  1812  		mutex_lock(&clt->paths_mutex);
6a98d71daea186 Jack Wang      2020-05-11  1813  		clt->queue_depth = min_not_zero(sess->queue_depth,
6a98d71daea186 Jack Wang      2020-05-11  1814  						clt->queue_depth);
6a98d71daea186 Jack Wang      2020-05-11  1815  		clt->max_io_size = min_not_zero(sess->max_io_size,
6a98d71daea186 Jack Wang      2020-05-11  1816  						clt->max_io_size);
6a98d71daea186 Jack Wang      2020-05-11  1817  		mutex_unlock(&clt->paths_mutex);
6a98d71daea186 Jack Wang      2020-05-11  1818  
6a98d71daea186 Jack Wang      2020-05-11  1819  		/*
6a98d71daea186 Jack Wang      2020-05-11  1820  		 * Cache the hca_port and hca_name for sysfs
6a98d71daea186 Jack Wang      2020-05-11  1821  		 */
6a98d71daea186 Jack Wang      2020-05-11  1822  		sess->hca_port = con->c.cm_id->port_num;
6a98d71daea186 Jack Wang      2020-05-11  1823  		scnprintf(sess->hca_name, sizeof(sess->hca_name),
6a98d71daea186 Jack Wang      2020-05-11  1824  			  sess->s.dev->ib_dev->name);
6a98d71daea186 Jack Wang      2020-05-11  1825  		sess->s.src_addr = con->c.cm_id->route.addr.src_addr;
03e9b33a0fd677 Md Haris Iqbal 2021-02-12  1826  		/* set for_new_clt, to allow future reconnect on any path */
03e9b33a0fd677 Md Haris Iqbal 2021-02-12  1827  		sess->for_new_clt = 1;
6a98d71daea186 Jack Wang      2020-05-11  1828  	}
6a98d71daea186 Jack Wang      2020-05-11  1829  
6a98d71daea186 Jack Wang      2020-05-11  1830  	return 0;
6a98d71daea186 Jack Wang      2020-05-11  1831  }
6a98d71daea186 Jack Wang      2020-05-11  1832  

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux