All of lore.kernel.org
 help / color / mirror / Atom feed
* [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.
@ 2022-07-26 15:58 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-07-26  7:16 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Pavel Begunkov <asml.silence@gmail.com>

tree:   https://github.com/isilence/linux zc_perf_tests
head:   0909a53e1c81ca9432cbb58d15b87e500595bcbd
commit: 0909a53e1c81ca9432cbb58d15b87e500595bcbd [10/10] io_uring: simple zc
:::::: branch date: 31 hours ago
:::::: commit date: 31 hours ago
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220726/202207261540.tELcS8V6-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.

vim +1113 io_uring/net.c

0909a53e1c81ca Pavel Begunkov 2022-07-24  1086  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1087  int io_sendzc1(struct io_kiocb *req, unsigned int issue_flags)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1088  {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1089  	struct io_sendzc1 *zc = io_kiocb_to_cmd(req);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1090  	struct msghdr msg;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1091  	struct iovec iov;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1092  	struct socket *sock;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1093  	unsigned msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1094  	int ret, min_ret = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1095  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1096  	sock = sock_from_file(req->file);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1097  	if (unlikely(!sock))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1098  		return -ENOTSOCK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1099  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1100  	msg.msg_name = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1101  	msg.msg_control = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1102  	msg.msg_controllen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1103  	msg.msg_namelen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1104  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1105  	if (req->imu) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1106  		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1107  				      (u64)(uintptr_t)zc->buf, zc->len);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1108  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1109  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1110  	} else {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1111  		return -EFAULT;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1112  
0909a53e1c81ca Pavel Begunkov 2022-07-24 @1113  		ret = import_single_range(WRITE, zc->buf, zc->len, &iov,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1114  					  &msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1115  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1116  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1117  		/* TODO: add pinning accounting */
0909a53e1c81ca Pavel Begunkov 2022-07-24  1118  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1119  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1120  	msg_flags = zc->msg_flags | MSG_ZEROCOPY;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1121  	if (issue_flags & IO_URING_F_NONBLOCK)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1122  		msg_flags |= MSG_DONTWAIT;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1123  	if (msg_flags & MSG_WAITALL)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1124  		min_ret = iov_iter_count(&msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1125  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1126  	msg.msg_flags = msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1127  	msg.msg_ubuf = &zc->ubuf;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1128  	msg.sg_from_iter = io_sg_from_iter;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1129  	ret = sock_sendmsg(sock, &msg);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1130  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1131  	req->cqe.res = ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1132  	if (refcount_dec_and_test(&zc->ubuf.refcnt)) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1133  		io_req_set_res(req, req->cqe.res, 0);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1134  		return IOU_OK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1135  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1136  	return IOU_ISSUE_SKIP_COMPLETE;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1137  }
0909a53e1c81ca Pavel Begunkov 2022-07-24  1138  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.
@ 2022-07-26 15:58 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-07-26 15:58 UTC (permalink / raw)
  To: kbuild, Pavel Begunkov; +Cc: lkp, kbuild-all, linux-kernel

tree:   https://github.com/isilence/linux zc_perf_tests
head:   0909a53e1c81ca9432cbb58d15b87e500595bcbd
commit: 0909a53e1c81ca9432cbb58d15b87e500595bcbd [10/10] io_uring: simple zc
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220726/202207261540.tELcS8V6-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.

vim +1113 io_uring/net.c

0909a53e1c81ca Pavel Begunkov 2022-07-24  1087  int io_sendzc1(struct io_kiocb *req, unsigned int issue_flags)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1088  {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1089  	struct io_sendzc1 *zc = io_kiocb_to_cmd(req);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1090  	struct msghdr msg;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1091  	struct iovec iov;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1092  	struct socket *sock;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1093  	unsigned msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1094  	int ret, min_ret = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1095  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1096  	sock = sock_from_file(req->file);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1097  	if (unlikely(!sock))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1098  		return -ENOTSOCK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1099  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1100  	msg.msg_name = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1101  	msg.msg_control = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1102  	msg.msg_controllen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1103  	msg.msg_namelen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1104  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1105  	if (req->imu) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1106  		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1107  				      (u64)(uintptr_t)zc->buf, zc->len);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1108  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1109  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1110  	} else {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1111  		return -EFAULT;
                                                                ^^^^^^^^^^^^^^^

0909a53e1c81ca Pavel Begunkov 2022-07-24  1112  
0909a53e1c81ca Pavel Begunkov 2022-07-24 @1113  		ret = import_single_range(WRITE, zc->buf, zc->len, &iov,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1114  					  &msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1115  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1116  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1117  		/* TODO: add pinning accounting */
0909a53e1c81ca Pavel Begunkov 2022-07-24  1118  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1119  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1120  	msg_flags = zc->msg_flags | MSG_ZEROCOPY;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1121  	if (issue_flags & IO_URING_F_NONBLOCK)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1122  		msg_flags |= MSG_DONTWAIT;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1123  	if (msg_flags & MSG_WAITALL)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1124  		min_ret = iov_iter_count(&msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1125  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1126  	msg.msg_flags = msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1127  	msg.msg_ubuf = &zc->ubuf;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1128  	msg.sg_from_iter = io_sg_from_iter;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1129  	ret = sock_sendmsg(sock, &msg);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1130  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1131  	req->cqe.res = ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1132  	if (refcount_dec_and_test(&zc->ubuf.refcnt)) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1133  		io_req_set_res(req, req->cqe.res, 0);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1134  		return IOU_OK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1135  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1136  	return IOU_ISSUE_SKIP_COMPLETE;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1137  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.
@ 2022-07-26 15:58 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-07-26 15:58 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://github.com/isilence/linux zc_perf_tests
head:   0909a53e1c81ca9432cbb58d15b87e500595bcbd
commit: 0909a53e1c81ca9432cbb58d15b87e500595bcbd [10/10] io_uring: simple zc
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220726/202207261540.tELcS8V6-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.

vim +1113 io_uring/net.c

0909a53e1c81ca Pavel Begunkov 2022-07-24  1087  int io_sendzc1(struct io_kiocb *req, unsigned int issue_flags)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1088  {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1089  	struct io_sendzc1 *zc = io_kiocb_to_cmd(req);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1090  	struct msghdr msg;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1091  	struct iovec iov;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1092  	struct socket *sock;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1093  	unsigned msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1094  	int ret, min_ret = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1095  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1096  	sock = sock_from_file(req->file);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1097  	if (unlikely(!sock))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1098  		return -ENOTSOCK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1099  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1100  	msg.msg_name = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1101  	msg.msg_control = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1102  	msg.msg_controllen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1103  	msg.msg_namelen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1104  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1105  	if (req->imu) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1106  		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1107  				      (u64)(uintptr_t)zc->buf, zc->len);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1108  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1109  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1110  	} else {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1111  		return -EFAULT;
                                                                ^^^^^^^^^^^^^^^

0909a53e1c81ca Pavel Begunkov 2022-07-24  1112  
0909a53e1c81ca Pavel Begunkov 2022-07-24 @1113  		ret = import_single_range(WRITE, zc->buf, zc->len, &iov,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1114  					  &msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1115  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1116  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1117  		/* TODO: add pinning accounting */
0909a53e1c81ca Pavel Begunkov 2022-07-24  1118  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1119  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1120  	msg_flags = zc->msg_flags | MSG_ZEROCOPY;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1121  	if (issue_flags & IO_URING_F_NONBLOCK)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1122  		msg_flags |= MSG_DONTWAIT;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1123  	if (msg_flags & MSG_WAITALL)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1124  		min_ret = iov_iter_count(&msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1125  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1126  	msg.msg_flags = msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1127  	msg.msg_ubuf = &zc->ubuf;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1128  	msg.sg_from_iter = io_sg_from_iter;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1129  	ret = sock_sendmsg(sock, &msg);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1130  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1131  	req->cqe.res = ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1132  	if (refcount_dec_and_test(&zc->ubuf.refcnt)) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1133  		io_req_set_res(req, req->cqe.res, 0);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1134  		return IOU_OK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1135  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1136  	return IOU_ISSUE_SKIP_COMPLETE;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1137  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-07-26 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26  7:16 [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code kernel test robot
2022-07-26 15:58 ` Dan Carpenter
2022-07-26 15:58 ` Dan Carpenter

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.